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
This commit is contained in:
Jesse Pretorius 2018-02-23 19:04:58 +00:00
parent 90a567872f
commit 6341bbe743
2 changed files with 7 additions and 6 deletions

View File

@ -185,4 +185,4 @@
name: "{{ neutron_ovs_service_name }}"
state: started
enabled: yes
when: neutron_needs_openvswitch
when: neutron_needs_openvswitch | bool

View File

@ -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 %}