Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge branch "dev" into branch "staging" #1288

Merged
merged 12 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: Update Database.py to set custom_configs_changed flag and last…
…_custom_configs_change timestamp when saving config and services were removed to avoid deleted custom configs still hanging
  • Loading branch information
TheophileDiot committed Jun 18, 2024
commit 9b2805afb51672371a1cb0996f4bc19dae44ec65
3 changes: 3 additions & 0 deletions src/common/db/Database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,9 @@ def save_config(self, config: Dict[str, Any], method: str, changed: Optional[boo
session.query(Services_settings).filter(Services_settings.service_id.in_(missing_ids)).delete()
session.query(Custom_configs).filter(Custom_configs.service_id.in_(missing_ids)).delete()
session.query(Jobs_cache).filter(Jobs_cache.service_id.in_(missing_ids)).delete()
session.query(Metadata).filter_by(id=1).update(
{Metadata.custom_configs_changed: True, Metadata.last_custom_configs_change: datetime.now()}
)
changed_services = True

drafts = {service for service in services if config.pop(f"{service}_IS_DRAFT", "no") == "yes"}
Expand Down
8 changes: 0 additions & 8 deletions src/ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,6 @@ def manage_bunkerweb(method: str, *args, operation: str = "reloads", is_draft: b
operation, error = app.config["CONFIG"].edit_service(args[1], args[0], check_changes=(was_draft != is_draft or not is_draft), is_draft=is_draft)
elif operation == "delete":
operation, error = app.config["CONFIG"].delete_service(args[2], check_changes=(was_draft != is_draft or not is_draft))

if not error:
if was_draft != is_draft or not is_draft:
# update changes in db
ret = app.config["DB"].checked_changes(["config", "custom_configs"], value=True)
if ret:
app.logger.error(f"Couldn't set the changes to checked in the database: {ret}")
ui_data["TO_FLASH"].append({"content": f"An error occurred when setting the changes to checked in the database : {ret}", "type": "error"})
elif method == "global_config":
operation, error = app.config["CONFIG"].edit_global_conf(args[0])

Expand Down
Loading