]> 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 12:18:07 +0000 (14:18 +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>
(cherry picked from commit 126e2e3f92475a17f9a04e1e792ee6eb69fbfab0)

roles/ceph-defaults/tasks/facts.yml

index c49264589ce442bb6c2d51b5747360a0a4ec8a2d..a8f11b47b5b7914e2edab02977e801d50be24138 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, [])