From: int32bit Date: Mon, 5 Mar 2018 15:02:17 +0000 (+0800) Subject: [RM-23218] fix UnboundLocalError when create mgr with bad hosts X-Git-Tag: v2.0.1~4^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9e1f6c6fb785862a6c8db38cc1beacdc91b2ab7b;p=ceph-deploy.git [RM-23218] fix UnboundLocalError when create mgr with bad hosts --- diff --git a/ceph_deploy/mgr.py b/ceph_deploy/mgr.py index a44e576..6d5ad13 100644 --- a/ceph_deploy/mgr.py +++ b/ceph_deploy/mgr.py @@ -139,6 +139,7 @@ def mgr_create(args): for hostname, name in args.mgr: try: + distro = None distro = hosts.get(hostname, username=args.username) rlogger = distro.conn.logger LOG.info( @@ -170,7 +171,7 @@ def mgr_create(args): create_mgr(distro, name, args.cluster, distro.init) distro.conn.exit() except RuntimeError as e: - if distro.normalized_name == 'redhat': + if distro and distro.normalized_name == 'redhat': LOG.error('this feature may not yet available for %s %s' % (distro.name, distro.release)) failed_on_rhel = True LOG.error(e)