]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
roles: ceph-defaults: Check if 'rgw' attribute exists for rgw_hostname
authorMarkos Chandras <mchandras@suse.de>
Wed, 15 Aug 2018 06:55:49 +0000 (09:55 +0300)
committerSébastien Han <seb@redhat.com>
Mon, 20 Aug 2018 09:37:45 +0000 (11:37 +0200)
If there are no services on the cluster, then the 'rgw' could be missing
and the task is failing with the following problem:

msg": "The task includes an option with an undefined variable.
The error was: 'dict object' has no attribute 'rgw'

We fix this by checking the existence of the 'rgw' attribute. If it's
missing, we skip the task since the role already contains code to set
a good default rgw_hostname.

Signed-off-by: Markos Chandras <mchandras@suse.de>
roles/ceph-defaults/tasks/facts.yml

index ee674278281e9e4ef20a51f189ee6f1cba5989c0..9ec3dad3443e94430d88d3b6c3bb020ad2165efd 100644 (file)
     - name: set_fact rgw_hostname
       set_fact:
         rgw_hostname: "{% for key in ceph_current_status['servicemap']['services']['rgw']['daemons'].keys() %}{% if key == ansible_fqdn %}{{ key }}{% endif %}{% endfor %}"
+      when: ceph_current_status['servicemap']['services']['rgw'] is defined
   when:
     - ceph_current_fsid.get('rc', 1) == 0
     - inventory_hostname in groups.get(rgw_group_name, [])