Skip to content

Commit

Permalink
Fix container_runtime openshift_containerized_host_groups
Browse files Browse the repository at this point in the history
openshift_containerized_host_groups needs to be referenced via
hostvars.

This commit also updates tox ansible syntax checks to account
for unavailability of hostsvars during syntax checks.

Fixes: openshift#6540
  • Loading branch information
michaelgugino committed Dec 21, 2017
1 parent cbcfd8a commit 3a14ee6
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 16 deletions.
2 changes: 1 addition & 1 deletion playbooks/container-runtime/private/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- hosts: "{{ l_containerized_host_groups }}"
vars:
l_chg_temp: "{{ openshift_containerized_host_groups | default([]) }}"
l_chg_temp: "{{ hostvars[groups['oo_first_master'][0]]['openshift_containerized_host_groups'] | default([]) }}"
l_containerized_host_groups: "{{ (['oo_nodes_to_config'] | union(l_chg_temp)) | join(':') }}"
# role: container_runtime is necessary here to bring role default variables
# into the play scope.
Expand Down
2 changes: 1 addition & 1 deletion playbooks/container-runtime/private/setup_storage.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- hosts: "{{ l_containerized_host_groups }}"
vars:
l_chg_temp: "{{ openshift_containerized_host_groups | default([]) }}"
l_chg_temp: "{{ hostvars[groups['oo_first_master'][0]]['openshift_containerized_host_groups'] | default([]) }}"
l_containerized_host_groups: "{{ (['oo_nodes_to_config'] | union(l_chg_temp)) | join(':') }}"
# role: container_runtime is necessary here to bring role default variables
# into the play scope.
Expand Down
17 changes: 3 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,21 +348,10 @@ def run(self):
# --syntax-check each entry point playbook
try:
# Create a host group list to avoid WARNING on unmatched host patterns
host_group_list = [
'etcd,masters,nodes,OSEv3',
'oo_all_hosts',
'oo_etcd_to_config,oo_new_etcd_to_config,oo_first_etcd,oo_etcd_hosts_to_backup,'
'oo_etcd_hosts_to_upgrade,oo_etcd_to_migrate',
'oo_masters,oo_masters_to_config,oo_first_master,oo_containerized_master_nodes',
'oo_nodes_to_config,oo_nodes_to_upgrade',
'oo_nodes_use_kuryr,oo_nodes_use_flannel',
'oo_nodes_use_calico,oo_nodes_use_nuage,oo_nodes_use_contiv',
'oo_lb_to_config',
'oo_nfs_to_config',
'glusterfs,glusterfs_registry,']
tox_ansible_inv = os.environ['TOX_ANSIBLE_INV_PATH']
subprocess.check_output(
['ansible-playbook', '-i ' + ','.join(host_group_list),
'--syntax-check', playbook]
['ansible-playbook', '-i', tox_ansible_inv,
'--syntax-check', playbook, '-e', '@{}_extras'.format(tox_ansible_inv)]
)
except subprocess.CalledProcessError as cpe:
print('{}Execution failed: {}{}'.format(
Expand Down
105 changes: 105 additions & 0 deletions test/tox-inventory.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[OSEv3]
localhost


[OSEv3:children]
etcd
masters
nodes
oo_all_hosts
oo_etcd_to_config
oo_new_etcd_to_config
oo_first_etcd
oo_etcd_hosts_to_backup
oo_etcd_hosts_to_upgrade
oo_etcd_to_migrate
oo_masters
oo_masters_to_config
oo_first_master
oo_containerized_master_nodes
oo_nodes_to_config
oo_nodes_to_upgrade
oo_nodes_use_kuryr
oo_nodes_use_flannel
oo_nodes_use_calico
oo_nodes_use_nuage
oo_nodes_use_contiv
oo_lb_to_config
oo_nfs_to_config
glusterfs
glusterfs_registry

[etcd]
localhost

[masters]
localhost

[nodes]
localhost

[oo_all_hosts]
localhost

[oo_etcd_to_config]
localhost

[oo_new_etcd_to_config]
localhost

[oo_first_etcd]
localhost

[oo_etcd_hosts_to_backup]
localhost

[oo_etcd_hosts_to_upgrade]
localhost

[oo_etcd_to_migrate]
localhost

[oo_masters]
localhost

[oo_masters_to_config]
localhost

[oo_first_master]
localhost

[oo_containerized_master_nodes]
localhost

[oo_nodes_to_config]
localhost

[oo_nodes_to_upgrade]
localhost

[oo_nodes_use_kuryr]
localhost

[oo_nodes_use_flannel]
localhost

[oo_nodes_use_calico]
localhost

[oo_nodes_use_nuage]
localhost

[oo_nodes_use_contiv]
localhost

[oo_lb_to_config]
localhost

[oo_nfs_to_config]
localhost

[glusterfs]
localhost

[glusterfs_registry]
localhost
3 changes: 3 additions & 0 deletions test/tox-inventory.txt_extras
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
hostvars:
localhost: {}
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ skip_missing_interpreters=True

[testenv]
skip_install=True
setenv = TOX_ANSIBLE_INV_PATH = {toxinidir}/test/tox-inventory.txt
deps =
-rrequirements.txt
-rtest-requirements.txt
Expand Down

0 comments on commit 3a14ee6

Please sign in to comment.