ceph / ceph-medic

find common issues in ceph clusters
MIT License
22 stars 18 forks source link

KeyError on non-ceph ansible group #9

Closed haklein closed 7 years ago

haklein commented 7 years ago

When having other groups in ansible.cfg which do not match the usual Ceph pattern (mons, osds, rgws), a KeyError is thrown:

# ./ceph-medic check
Host: rdh-hw20              connection: [connected  ]
Host: rdh-hw20              collecting: [paths]Traceback (most recent call last):
  File "./ceph-medic", line 6, in <module>
    main.Medic()
  File "/root/ceph-medic/bin/ceph_medic/main.py", line 44, in __init__
    self.main(argv)
  File "/root/ceph-medic/bin/ceph_medic/decorators.py", line 45, in newfunc
    return f(*a, **kw)
  File "/root/ceph-medic/bin/ceph_medic/main.py", line 131, in main
    parser.dispatch()
  File "/usr/lib/python2.7/site-packages/tambo/dispatcher.py", line 21, in dispatch
    return instance.main()
  File "/root/ceph-medic/bin/ceph_medic/check.py", line 91, in main
    collector.collect()
  File "/root/ceph-medic/bin/ceph_medic/collector.py", line 172, in collect
    metadata[node_type][node['host']] = node_metadata
KeyError: 'test'

Ansible cfg snippet:

[test]
rdh-hw20
rdh-hw21

[mons]
rdh-cu-8
rdh-hw16
rdh-hw19

[osds]
rdh-cu-8
rdh-hw16
rdh-hw19
alfredodeza commented 7 years ago

Thanks for reporting this!