Check if env.d folder exists for upgrades

If an env.d folder does not exist then no actions
should be done relating to the contents of the
folder.

Change-Id: I3ea94aa2882cba6dd8cc9550bac68fedcc4658b7
This commit is contained in:
Jesse Pretorius 2017-03-08 12:49:17 +00:00 committed by Jean-Philippe Evrard
parent f514e11f42
commit e2f62f93bd

View File

@ -22,26 +22,35 @@
- name: Create an old copy of openstack_deploy
copy:
src: "/etc/openstack_deploy/"
dest: "/etc/openstack_deploy.NEWTON/"
dest: "/etc/openstack_deploy.OCATA/"
force: no
- name: Retrieve differences
shell: rsync -avun "{{ repo_root_dir }}/playbooks/inventory/env.d/" "/etc/openstack_deploy/env.d/" | grep "yml$"
failed_when: false
register: diff_result
- name: Check if there is a user-space env.d directory
stat:
path: "/etc/openstack_deploy/env.d"
register: _envd_dir
- name: Copy new env.d files into place
copy:
src: "{{ repo_root_dir }}/playbooks/inventory/env.d/{{ item }}"
dest: "/etc/openstack_deploy/env.d/{{ item }}"
force: no
with_items:
- "{{ diff_result.stdout_lines }}"
when: diff_result.stdout != ""
- block:
- name: Check result for emptiness
debug: msg="All new env.d files are placed in the stock repo. No new changes"
when: diff_result.stdout == ""
- name: Retrieve differences
shell: rsync -avun "{{ repo_root_dir }}/playbooks/inventory/env.d/" "/etc/openstack_deploy/env.d/" | grep "yml$"
failed_when: false
register: diff_result
- name: Copy new env.d files into place
copy:
src: "{{ repo_root_dir }}/playbooks/inventory/env.d/{{ item }}"
dest: "/etc/openstack_deploy/env.d/{{ item }}"
force: no
with_items:
- "{{ diff_result.stdout_lines }}"
when: diff_result.stdout != ""
- name: Check result for emptiness
debug: msg="All new env.d files are placed in the stock repo. No new changes"
when: diff_result.stdout == ""
when: _envd_dir.stat.exists | bool
- name: Update OpenStack variable names
command: "{{ upgrade_scripts }}/migrate_openstack_vars.py {{ item }} {{ (item | basename)[:-4] }}"
@ -50,7 +59,7 @@
with_fileglob:
- "/etc/openstack_deploy/user_*.yml"
- name: Write vars required for upgrade from Mitaka
- name: Write vars required for upgrade
lineinfile:
dest: /etc/openstack_deploy/user_variables.yml
regexp: "^{{ item.key }}"