The function `get_local_osd_ids` crashes when the /var/lib/ceph/osd/
directory contains a file whose name doesn't contain a `-`.
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed Traceback (most recent call last):
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed File "/var/lib/juju/agents/unit-ceph-osd-0/charm/hooks/mon-relation-changed", line 904, in <module>
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed hooks.execute(sys.argv)
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed File "/var/lib/juju/agents/unit-ceph-osd-0/charm/hooks/charmhelpers/core/hookenv.py", line 963, in execute
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed self._hooks[hook_name]()
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed File "/var/lib/juju/agents/unit-ceph-osd-0/charm/hooks/mon-relation-changed", line 668, in mon_relation
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed ceph.apply_osd_settings(settings)
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed File "/var/lib/juju/agents/unit-ceph-osd-0/charm/lib/charms_ceph/utils.py", line 3420, in apply_osd_settings
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed for osd_id in get_local_osd_ids():
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed File "/var/lib/juju/agents/unit-ceph-osd-0/charm/lib/charms_ceph/utils.py", line 698, in get_local_osd_ids
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed osd_id = osd_dir.split('-')[1]
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed IndexError: list index out of range
Fix the issue by setting a fallback in this case.
Change-Id: I0fec65c9b88e6484905a76140d0921cf3dd843c0
Helper functions for the ceph charms. This library has shared functionality that is used in the ceph-mon, ceph-osd and ceph
charms. Anything that needs to be shared across the ceph charms should live here.