mass import fix
This commit is contained in:
@@ -235,15 +235,18 @@ class Migration:
|
||||
with create_temp_file(content=exported_content, suffix=".zip", logger=self.logger) as tmp_zip_path, \
|
||||
create_temp_file(suffix=".dir", logger=self.logger) as tmp_unpack_dir:
|
||||
|
||||
with zipfile.ZipFile(tmp_zip_path, "r") as zip_ref:
|
||||
zip_ref.extractall(tmp_unpack_dir)
|
||||
|
||||
if self.db_config_replacement:
|
||||
update_yamls(db_configs=[self.db_config_replacement], path=str(tmp_unpack_dir))
|
||||
|
||||
with create_temp_file(suffix=".zip", logger=self.logger) as tmp_new_zip:
|
||||
create_dashboard_export(zip_path=tmp_new_zip, source_paths=[str(tmp_unpack_dir)])
|
||||
self.to_c.import_dashboard(file_name=tmp_new_zip, dash_id=dash_id, dash_slug=dash_slug)
|
||||
if not self.db_config_replacement:
|
||||
self.to_c.import_dashboard(file_name=tmp_zip_path, dash_id=dash_id, dash_slug=dash_slug)
|
||||
else:
|
||||
with zipfile.ZipFile(tmp_zip_path, "r") as zip_ref:
|
||||
zip_ref.extractall(tmp_unpack_dir)
|
||||
|
||||
if self.db_config_replacement:
|
||||
update_yamls(db_configs=[self.db_config_replacement], path=str(tmp_unpack_dir))
|
||||
|
||||
with create_temp_file(suffix=".zip", logger=self.logger) as tmp_new_zip:
|
||||
create_dashboard_export(zip_path=tmp_new_zip, source_paths=[str(tmp_unpack_dir)])
|
||||
self.to_c.import_dashboard(file_name=tmp_new_zip, dash_id=dash_id, dash_slug=dash_slug)
|
||||
|
||||
self.logger.info("[execute_migration][Success] Dashboard %s imported.", title)
|
||||
except Exception as exc:
|
||||
|
||||
Reference in New Issue
Block a user