def upgrade(lv, options): """ Perform the upgrade. :param lv: The CRIPTs version we are running. :type lv: str :param options: The options passed in for what to upgrade. :type options: dict """ # eventually we will do something to check to see what the current version # of the CRIPTs DB is so we can upgrade through several versions at once. # this is important if prep scripts need to be run for certain upgrades # to work properly. mall = options.get('mall') events = options.get('events') skip = options.get('skip') # run prep migrations if not skip: prep_database() # run full migrations if mall or events: migrate_collection(Event, sort_ids) # Always bump the version to the latest in settings.py config = CRIPTsConfig.objects() if len(config) > 1: print "You have more than one config object. This is really bad." else: config = config[0] config.cripts_version = settings.CRIPTS_VERSION config.save()
def upgrade(lv, options): """ Perform the upgrade. :param lv: The CRITs version we are running. :type lv: str :param options: The options passed in for what to upgrade. :type options: dict """ # eventually we will do something to check to see what the current version # of the CRITs DB is so we can upgrade through several versions at once. # this is important if prep scripts need to be run for certain upgrades # to work properly. mall = options.get('mall') campaigns = options.get('campaigns') domains = options.get('domains') emails = options.get('emails') events = options.get('events') indicators = options.get('indicators') ips = options.get('ips') pcaps = options.get('pcaps') samples = options.get('samples') targets = options.get('targets') skip = options.get('skip') sort_ids = options.get('sort_ids') # run prep migrations if not skip: prep_database() # run full migrations if mall or campaigns: migrate_collection(Campaign, sort_ids) if mall or domains: migrate_collection(Domain, sort_ids) if mall or emails: migrate_collection(Email, sort_ids) if mall or events: migrate_collection(Event, sort_ids) if mall or indicators: migrate_collection(Indicator, sort_ids) if mall or ips: migrate_collection(IP, sort_ids) if mall or pcaps: migrate_collection(PCAP, sort_ids) if mall or samples: migrate_collection(Sample, sort_ids) if mall or targets: migrate_collection(Target, sort_ids) # Always bump the version to the latest in settings.py config = CRITsConfig.objects() if len(config) > 1: print "You have more than one config object. This is really bad." else: config = config[0] config.crits_version = settings.CRITS_VERSION config.save()