From 1f434661b154ee64714ec9d9bb4cd1691329917b Mon Sep 17 00:00:00 2001 From: Cameron Loader Date: Wed, 19 Feb 2020 10:53:52 -0600 Subject: [PATCH] Ironic fixes from inspector addition 1. There was an issue with pip packages not being installed when inspector_hosts is not defined. 2. The db_setup task failed when inspector_hosts not defined because of the condition. Change-Id: I0ccd782ffd54322896559e5a6218ff532f3cae03 --- defaults/main.yml | 6 ++++-- tasks/ironic_db_setup.yml | 4 +++- tasks/main.yml | 2 +- vars/main.yml | 10 ++++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index fa472929..d3c4eec1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -184,7 +184,6 @@ ironic_tftp_server_address: "{{ ansible_host }}" ironic_pip_packages: - cryptography - ironic - - "{{ (ironic_services['ironic-inspector']['group'] in group_names) | ternary('ironic-inspector', '') }}" - osprofiler - proliantutils - PyMySQL @@ -192,7 +191,6 @@ ironic_pip_packages: - python-dracclient - python-ilorest-library - python-ironicclient - - python-ironic-inspector-client - python-memcached - python-scciclient - python-swiftclient @@ -200,6 +198,10 @@ ironic_pip_packages: - sushy - systemd-python +ironic_inspector_pip_packages: + - ironic-inspector + - python-ironic-inspector-client + ## Oslo Messaging Info # RPC ironic_oslomsg_rpc_host_group: "{{ oslomsg_rpc_host_group | default('rabbitmq_all') }}" diff --git a/tasks/ironic_db_setup.yml b/tasks/ironic_db_setup.yml index c4f40c14..76ed089b 100644 --- a/tasks/ironic_db_setup.yml +++ b/tasks/ironic_db_setup.yml @@ -26,6 +26,8 @@ command: "{{ ironic_bin }}/ironic-inspector-dbsync --config-file /etc/ironic-inspector/ironic-inspector.conf upgrade" become: yes changed_when: false - when: "'ironic_inspector' in groups and inventory_hostname == groups['ironic_inspector'][0]" + when: + - ironic_services['ironic-inspector']['group'] in group_names + - inventory_hostname == groups[ironic_services['ironic-inspector']['group']][0] notify: - Restart ironic services diff --git a/tasks/main.yml b/tasks/main.yml index a949dab6..c7c58f1e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -87,7 +87,7 @@ venv_install_destination_path: "{{ ironic_bin | dirname }}" venv_install_distro_package_list: "{{ ironic_packages_list }}" venv_pip_install_args: "{{ ironic_pip_install_args }}" - venv_pip_packages: "{{ (ironic_oslomsg_amqp1_enabled | bool) | ternary(ironic_pip_packages + ironic_optional_oslomsg_amqp1_pip_packages, ironic_pip_packages) }}" + venv_pip_packages: "{{ ironic_venv_packages }}" venv_facts_when_changed: - section: "ironic" option: "venv_tag" diff --git a/vars/main.yml b/vars/main.yml index 21db4509..3f58b9cc 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -318,3 +318,13 @@ filtered_ironic_drivers: |- {% endif %} {% endfor %} {{ concat_drivers }} + +ironic_venv_packages: |- + {%- set pkg_list = ironic_pip_packages %} + {%- if (ironic_oslomsg_amqp1_enabled | bool) %} + {%- set _ = pkg_list.extend(ironic_optional_oslomsg_amqp1_pip_packages) %} + {%- endif %} + {%- if (ironic_services['ironic-inspector']['group'] in group_names) %} + {%- set _ = pkg_list.extend(ironic_inspector_pip_packages) %} + {%- endif %} + {{- pkg_list | unique }}