From 6341bbe74392d70a2f8002194cad85d754d8afe1 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Fri, 23 Feb 2018 19:04:58 +0000 Subject: [PATCH] neutron_needs_openvswitch should be jinja, not a string In I4ec4fc2c2124a941f24478cbdf39ed34c0dce56f the long conditional set was broken out into its own variable to make it easier to grok, but the new variable was not wrapped in jinja braces, so it's evaluated as a string instead of jinja to interpret. Also, all conditionals that use the variable should be checking for a boolean value. Right now it might just consider the result true because the variable exists, rather than the value of the variable. Change-Id: Ic5210d62412ccf08e7d71860159aaaf37be9ddfd --- tasks/neutron_install.yml | 2 +- vars/main.yml | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tasks/neutron_install.yml b/tasks/neutron_install.yml index 922a0527..a42ebf0e 100644 --- a/tasks/neutron_install.yml +++ b/tasks/neutron_install.yml @@ -185,4 +185,4 @@ name: "{{ neutron_ovs_service_name }}" state: started enabled: yes - when: neutron_needs_openvswitch + when: neutron_needs_openvswitch | bool diff --git a/vars/main.yml b/vars/main.yml index d2c69526..32814dc5 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -16,10 +16,11 @@ ### ### Open vSwitch ### -neutron_needs_openvswitch: (neutron_services['neutron-openvswitch-agent']['group'] in group_names and neutron_services['neutron-openvswitch-agent'].service_en | bool) - or (neutron_services['dragonflow-controller-agent']['group'] in group_names and neutron_services['dragonflow-controller-agent'].service_en | bool) - or (neutron_services['dragonflow-l3-agent']['group'] in group_names and neutron_services['dragonflow-l3-agent'].service_en | bool) - or ((neutron_services['neutron-server']['group'] not in group_names) and neutron_plugin_type == 'ml2.opendaylight') +neutron_needs_openvswitch: >- + {{ (neutron_services['neutron-openvswitch-agent']['group'] in group_names and neutron_services['neutron-openvswitch-agent'].service_en | bool) + or (neutron_services['dragonflow-controller-agent']['group'] in group_names and neutron_services['dragonflow-controller-agent'].service_en | bool) + or (neutron_services['dragonflow-l3-agent']['group'] in group_names and neutron_services['dragonflow-l3-agent'].service_en | bool) + or ((neutron_services['neutron-server']['group'] not in group_names) and neutron_plugin_type == 'ml2.opendaylight') }} ### ### Packages @@ -32,7 +33,7 @@ neutron_needs_openvswitch: (neutron_services['neutron-openvswitch-agent']['group # neutron_package_list: |- {% set packages = neutron_distro_packages %} - {% if neutron_needs_openvswitch %} + {% if neutron_needs_openvswitch | bool %} {% if (ovs_nsh_support and ansible_pkg_mgr in ['apt', 'zypper']) %} {% set _ = packages.extend(neutron_ovs_nsh_required_packages) %} {% else %}