ceph / ceph-medic

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

RFE: please support ranges in inventory #156

Open pcfe opened 4 years ago

pcfe commented 4 years ago

Description of problem: it would seem that ranges in the inventory are not supported.

Version-Release number of selected component (if applicable): ceph-medic-1.0.5-2.el8cp.noarch (apologies, will re-test with a git checkout now)

How reproducible: always

Steps to Reproduce:

  1. have valid entries with ranges in inventory (e.g. f5-422-0[1:3])
  2. ceph-medic --inventory /etc/ansible/hosts check

Actual results:

[ansible@ceph-ansible ceph-medic]$ ceph-medic --inventory /etc/ansible/hosts check
Host: f5-422-0[1                                connection: [connecting ]          ssh: Could not resolve hostname f5-422-0[1: Name or service not known
Host: f5-422-0[1                                connection: [failed     ]          
Host: f5-422-0[1                                connection: [connecting ]          ssh: Could not resolve hostname f5-422-0[1: Name or service not known
Host: f5-422-0[1                                connection: [failed     ]          
Host: f5-422-0[1                                connection: [connecting ]          ssh: Could not resolve hostname f5-422-0[1: Name or service not known
Host: f5-422-0[1                                connection: [failed     ]          
Host: f5-422-01                                 connection: [connecting ]          bash: python3: command not found
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/execnet/gateway_base.py", line 984, in _send
    message.to_io(self._io)
  File "/usr/lib/python3.6/site-packages/execnet/gateway_base.py", line 430, in to_io
    io.write(header+self.data)
  File "/usr/lib/python3.6/site-packages/execnet/gateway_base.py", line 397, in write
    self.outfile.flush()
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/ceph-medic", line 6, in <module>
    main.Medic()
  File "/usr/lib/python3.6/site-packages/ceph_medic/main.py", line 45, in __init__
    self.main(argv)
  File "/usr/lib/python3.6/site-packages/ceph_medic/decorators.py", line 46, in newfunc
    return f(*a, **kw)
  File "/usr/lib/python3.6/site-packages/ceph_medic/main.py", line 145, in main
    parser.dispatch()
  File "/usr/lib/python3.6/site-packages/tambo/dispatcher.py", line 21, in dispatch
    result = instance.main()
  File "/usr/lib/python3.6/site-packages/ceph_medic/check.py", line 82, in main
    collector.collect()
  File "/usr/lib/python3.6/site-packages/ceph_medic/collector.py", line 178, in collect
    conn = get_connection(node['host'])
  File "/usr/lib/python3.6/site-packages/ceph_medic/connection.py", line 64, in get_connection
    raise error
  File "/usr/lib/python3.6/site-packages/ceph_medic/connection.py", line 40, in get_connection
    detect_sudo=detect_sudo,
  File "/usr/lib/python3.6/site-packages/remoto/backends/__init__.py", line 33, in __init__
    self.sudo = self._detect_sudo()
  File "/usr/lib/python3.6/site-packages/remoto/backends/__init__.py", line 64, in _detect_sudo
    'import getpass; channel.send(getpass.getuser())'
  File "/usr/lib/python3.6/site-packages/execnet/gateway.py", line 129, in remote_exec
    gateway_base.dumps_internal((source, call_name, kwargs)))
  File "/usr/lib/python3.6/site-packages/execnet/gateway_base.py", line 990, in _send
    raise IOError("cannot send (already closed?)")
OSError: cannot send (already closed?)

Expected results: handle ranges in ansible inventory

Additional info: cat /etc/ansible/hosts

[mons]
f5-422-0[1:3]

# MGRs are typically collocated with MONs
[mgrs]
f5-422-0[1:3]

[osds]
f5-422-0[1:4]

[grafana-server]
f5-422-04

[mdss]
f5-422-01
f5-422-03

# [rgws]
# f5-422-02

# [nfss]
# ganesha
pcfe commented 4 years ago

same issue with master @ commit 744820bd22d1756e7ecc68229bec1042117595f5 and ceph-medic-1.0.5-2.el8cp.noarch

pcfe commented 4 years ago

for completeness;

cat ~/.cephmedic.conf


#
# ceph-medic configuration file
#

[global]
# Overrides for some of ceph-medic's global flags, like verbosity or cluster
# name Cluster Name. Ceph defaults this to 'ceph' when not specified, and
# ceph-medic will try to infer this if the configuration is not found on the
# first '.conf' file in /etc/ceph/
--cluster = ceph
# Use a specific location for the Ansible inventory file, it defaults to look
# into the current working directory and /etc/ansible (in that order) unless
# specified here or directly at the command line
#--inventory
#
# The logging verbosity, this will affect both the terminal and file logging
# levels
--verbosity = info
#
# Should always be an absolute path, although '.' is allowed to log from
# wherever the CLI is executed from (current working directory)
--log-path = .
# What type of deployment is the cluster using? Valid values are:
# baremetal, container, openshift, kubernetes
# deployment_type = baremetal
deployment_type = podman

[check]
# Overrides for some of ceph-medic's check flags, like what errors or warnings
# to ignore. By default nothing is ignored (everything is reported). Ignores
# should be comma separated into their respective codes.
# --ignore = ECOMM101,ECOMM102

[baremetal]
# baremetal options

[kubernetes]
namespace = rook-ceph