Skip to content

Commit

Permalink
Remove is defined check
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeevDmitry committed Feb 6, 2025
1 parent 33fa205 commit f6ec3e2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions controls/roles/update-services/tasks/update-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@
set_fact:
service_docker_image: "{{ service_configuration.image.split(':') | first }}"
service_docker_image_tag: "{{ service_configuration.image.split(':') | last }}"
when: service_exists is defined and service_configuration.autoupdate
when: service_exists and service_configuration.autoupdate

- name: Get latest version for this service
set_fact:
new_service_docker_image_tag: "{{ update_data[service_configuration.network][service_configuration.service] | default(update_data['stratis'][service_configuration.service]) | last }}"
when: service_exists is defined and service_configuration.autoupdate and service_configuration.service != 'CustomService'
when: service_exists and service_configuration.autoupdate and service_configuration.service != 'CustomService'

- name: Build new image tag
set_fact:
new_service_configuration_fraction:
image: "{{ service_docker_image }}:{{ new_service_docker_image_tag }}"
when: service_exists is defined and service_configuration.autoupdate
when: service_exists and service_configuration.autoupdate

- name: Update configuration
set_fact:
new_service_configuration: "{{ service_configuration | combine(new_service_configuration_fraction) }}"
when: service_exists is defined and service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest')
when: service_exists and service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest')

- name: Write configuration
copy:
Expand All @@ -42,14 +42,14 @@
owner: "root"
group: "root"
mode: 0644
when: service_exists is defined and service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest')
when: service_exists and service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest')
become: yes

- name: Update configuration file modification time
file:
path: "/etc/stereum/services/{{ item }}.yaml"
state: touch
when: service_exists is defined and service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest')
when: service_exists and service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest')
become: yes

# EOF

0 comments on commit f6ec3e2

Please sign in to comment.