Browse Source

Merge pull request #6969 from mjudeikis/gluster-dynamic-invetory-bug

Automatic merge from submit-queue.

dynamic inventory bug when group exists but its empty

@jarrpa output from my test for the gluster block

I use dynamic inventory. And the result of this is that ansible see all possible groups available, but some of them are empty [1]. Because group exists, fist condition is evaluated as true and it fails with the array is an empty error...  
```
...
'all': [u'54.144.5.175',                                                                                                                                                                                          
         u'52.200.175.54',                                                                                                                                                                                         
         u'54.237.208.252',                                                                                                                                                                                        
         u'52.55.224.72',                                                                                                                                                                                          
         u'52.207.103.246',                                                                                                                                                                                        
         u'34.227.95.191',                                                                                                                                                                                         
         u'34.238.127.160'],                                                                                                                                                                                       
 u'bastion': [u'34.227.95.191'],                                                                                                                                                                                   
 u'bastion.0': [u'34.227.95.191'],                                                                                                                                                                                 
 u'etcd': [u'34.238.127.160'],                                                                                                                                                                                     
 u'glusterfs': [u'52.200.175.54', u'52.207.103.246', u'54.144.5.175'],                                                                                                                                             
 u'glusterfs.0': [u'52.200.175.54'],                                                                                                                                                                               
 u'glusterfs.1': [u'52.207.103.246'],                                                                                                                                                                              
 u'glusterfs.2': [u'54.144.5.175'],                                                                                                                                                                                
 u'glusterfs_registry': [],                                                                                                                                                                                        
 u'infra': [u'52.55.224.72'],                                                                                                                                                                                      
 u'infra.0': [u'52.55.224.72'],
 u'masters': [u'34.238.127.160'],
 u'masters.0': [u'34.238.127.160'],
...
```
OpenShift Merge Robot 7 years ago
parent
commit
26caf813c5

File diff suppressed because it is too large
+ 1 - 1
roles/openshift_hosted/tasks/storage/glusterfs.yml


+ 1 - 1
roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml

@@ -48,7 +48,7 @@
     glusterfs_heketi_ssh_sudo: "{{ openshift_storage_glusterfs_registry_heketi_ssh_sudo | bool }}"
     glusterfs_heketi_ssh_keyfile: "{{ openshift_storage_glusterfs_registry_heketi_ssh_keyfile }}"
     glusterfs_heketi_fstab: "{{ openshift_storage_glusterfs_registry_heketi_fstab }}"
-    glusterfs_nodes: "{% if groups.glusterfs_registry is defined %}{% set nodes = groups.glusterfs_registry %}{% elif 'groups.glusterfs' is defined %}{% set nodes = groups.glusterfs %}{% else %}{% set nodes = '[]' %}{% endif %}{{ nodes }}"
+    glusterfs_nodes: "{% if groups.glusterfs_registry is defined and groups['glusterfs_registry'] | length > 0 %}{% set nodes = groups.glusterfs_registry %}{% elif 'groups.glusterfs' is defined and groups['glusterfs'] | length > 0 %}{% set nodes = groups.glusterfs %}{% else %}{% set nodes = '[]' %}{% endif %}{{ nodes }}"
 
 - include_tasks: glusterfs_common.yml
   when: