From 234bab1805444d0aae84ce7c3b6317739988d336 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 14 Dec 2023 20:27:48 +0100 Subject: [PATCH] Solved argument passing bug --- .../templates/backup-docker-to-local.service.j2 | 2 +- .../templates/backup-remote-to-local.service.j2 | 2 +- .../templates/cleanup-backups.service.j2 | 2 +- .../cleanup-disc-space/templates/cleanup-disc-space.service.j2 | 2 +- .../templates/cleanup-failed-docker-backups.service.j2 | 2 +- roles/heal-docker/handlers/main.yml | 1 - roles/heal-docker/templates/heal-docker.service.j2 | 2 +- .../templates/system-maintenance-service-freezer.service.j2 | 2 +- roles/update-docker/templates/update-docker.service.j2 | 2 +- 9 files changed, 8 insertions(+), 9 deletions(-) diff --git a/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 b/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 index 4940e14e..b4dc55c2 100644 --- a/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 +++ b/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 @@ -4,5 +4,5 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service [Service] Type=oneshot -ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services }}" --ignore "{{system_maintenance_backup_services}}" --timeout "{{system_maintenance_timeout_backup_services}}"' +ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | join(' ') }}" --ignore "{{system_maintenance_backup_services| join(' ') }}" --timeout "{{system_maintenance_timeout_backup_services}}"' ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file diff --git a/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 b/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 index e9b04441..f7400e00 100644 --- a/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 +++ b/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 @@ -4,5 +4,5 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service [Service] Type=oneshot -ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services }}" --ignore "{{system_maintenance_backup_services}}" --timeout "{{system_maintenance_timeout_backup_services}}"' +ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | join(' ') }}" --ignore "{{system_maintenance_backup_services| join(' ') }}" --timeout "{{system_maintenance_timeout_backup_services}}"' ExecStart=/bin/sh -c '/usr/bin/bash {{docker_backup_remote_to_local_folder}}backups-remote-to-local.sh && systemctl start system-maintenance-service-defrost.service' diff --git a/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 b/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 index b7b8bfa5..5d29e634 100644 --- a/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 +++ b/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 @@ -4,5 +4,5 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services }}" --ignore "{{system_maintenance_cleanup_services}}" --timeout "{{system_maintenance_timeout_backup_services}}"' +ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | join(' ') }}" --ignore "{{system_maintenance_cleanup_services| join(' ') }}" --timeout "{{system_maintenance_timeout_backup_services}}"' ExecStart=/bin/sh -c '/usr/bin/python {{docker_cleanup_backups}}cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file diff --git a/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 b/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 index 8279a549..4445bbb3 100644 --- a/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 +++ b/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 @@ -4,5 +4,5 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services }}" --ignore "{{system_maintenance_cleanup_services}}" --timeout "{{system_maintenance_timeout_backup_services}}"' +ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | join(' ') }}" --ignore "{{system_maintenance_cleanup_services| join(' ') }}" --timeout "{{system_maintenance_timeout_backup_services}}"' ExecStart=/bin/sh -c '/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}} && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file diff --git a/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 b/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 index 841ea056..8c7245d8 100644 --- a/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 +++ b/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 @@ -4,5 +4,5 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services }}" --ignore "{{system_maintenance_cleanup_services}}" --timeout "{{system_maintenance_timeout_backup_services}}"' +ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | join(' ') }}" --ignore "{{system_maintenance_cleanup_services| join(' ') }}" --timeout "{{system_maintenance_timeout_backup_services}}"' ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bash {{backup_docker_to_local_cleanup_folder}}cleanup.sh {{backup_docker_to_local_cleanup_machine_id}} {{backup_docker_to_local_cleanup_trigger_directory}} && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file diff --git a/roles/heal-docker/handlers/main.yml b/roles/heal-docker/handlers/main.yml index 16bbe03f..5de34822 100644 --- a/roles/heal-docker/handlers/main.yml +++ b/roles/heal-docker/handlers/main.yml @@ -1,7 +1,6 @@ - name: "reload heal-docker.service" systemd: name: heal-docker.service - enabled: yes daemon_reload: yes - name: "restart heal-docker.timer" systemd: diff --git a/roles/heal-docker/templates/heal-docker.service.j2 b/roles/heal-docker/templates/heal-docker.service.j2 index 830334bd..447ccf90 100644 --- a/roles/heal-docker/templates/heal-docker.service.j2 +++ b/roles/heal-docker/templates/heal-docker.service.j2 @@ -4,5 +4,5 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services }}" --ignore "{{system_maintenance_cleanup_services}}" --timeout "{{system_maintenance_timeout_heal_docker}}"' +ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | join(' ') }}" --ignore "{{system_maintenance_cleanup_services| join(' ') }}" --timeout "{{system_maintenance_timeout_heal_docker}}"' ExecStart=/bin/sh -c '/bin/python {{heal_docker}}heal-docker.py && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file diff --git a/roles/system-maintenance-service-freezer/templates/system-maintenance-service-freezer.service.j2 b/roles/system-maintenance-service-freezer/templates/system-maintenance-service-freezer.service.j2 index 10ba2953..38b668d7 100644 --- a/roles/system-maintenance-service-freezer/templates/system-maintenance-service-freezer.service.j2 +++ b/roles/system-maintenance-service-freezer/templates/system-maintenance-service-freezer.service.j2 @@ -4,5 +4,5 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecPreStart=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} {{item}} "{{ system_maintenance_services + [item] }}" --timeout "{{system_maintenance_timeout_defroster}}"' +ExecPreStart=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} {{item}} "{{ system_maintenance_services + [item] | join(' ') }}" --ignore "{{item}}" --timeout "{{system_maintenance_timeout_defroster}}"' ExecStart=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} {{item}} "{{ system_maintenance_services }}"' \ No newline at end of file diff --git a/roles/update-docker/templates/update-docker.service.j2 b/roles/update-docker/templates/update-docker.service.j2 index de802adc..c3b7a8c6 100644 --- a/roles/update-docker/templates/update-docker.service.j2 +++ b/roles/update-docker/templates/update-docker.service.j2 @@ -5,5 +5,5 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot {% if force_backup_before_update | bool %}ExecStartPre=/bin/sh -c 'systemctl start backup-docker-to-local.service'{% endif %} -ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services }}" --ignore "{{system_maintenance_cleanup_services + ['update-docker'] }}" --timeout "{{system_maintenance_timeout_heal_docker}}"' +ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze "{{ system_maintenance_services | join(' ') }}" --ignore "{{system_maintenance_cleanup_services + ['update-docker'] | join(' ') }}" --timeout "{{system_maintenance_timeout_heal_docker}}"' ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{path_docker_compose_instances}} && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file