- if target_version == '1.0':
- if not current_version:
- # create database version
- serial = urandom(32)
- version_data = {
- "_id": 'version', # Always 'version'
- "version_int": 1000, # version number
- "version": '1.0', # version text
- "date": "2018-10-25", # version date
- "description": "added serial", # changes in this version
- 'status': 'ENABLED', # ENABLED, DISABLED (migration in process), ERROR,
- 'serial': b64encode(serial)
- }
- self.db.create("admin", version_data)
- self.db.set_secret_key(serial)
- # TODO add future migrations here
+
+ target_version_int = self.map_target_version_to_int[target_version]
+
+ if not current_version:
+ # create database version
+ serial = urandom(32)
+ version_data = {
+ "_id": "version", # Always "version"
+ "version_int": 1000, # version number
+ "version": "1.0", # version text
+ "date": "2018-10-25", # version date
+ "description": "added serial", # changes in this version
+ 'status': "ENABLED", # ENABLED, DISABLED (migration in process), ERROR,
+ 'serial': b64encode(serial)
+ }
+ self.db.create("admin", version_data)
+ self.db.set_secret_key(serial)
+ current_version = "1.0"
+
+ if current_version in ("1.0", "1.1") and target_version_int >= self.map_target_version_to_int["1.2"]:
+ if self.config['authentication']['backend'] == "internal":
+ self.db.del_list("roles")