From: Sage Weil Date: Tue, 4 Feb 2020 13:17:30 +0000 (-0600) Subject: cephadm: check-host: add optional --expect-hostname X-Git-Tag: v15.1.1~534^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dd56bba731e2bc2be0853901d4b9dbe3f38e280b;p=ceph.git cephadm: check-host: add optional --expect-hostname Signed-off-by: Sage Weil --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 0c53578d9e9e..5571db7e6d16 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -2491,6 +2491,13 @@ def command_check_host(): if not check_time_sync(): raise Error('No time synchronization is active') + if args.expect_hostname: + if get_hostname() != args.expect_hostname: + raise Error('hostname "%s" does not match expected hostname "%s"' % ( + get_hostname(), args.expect_hostname)) + logger.info('Hostname "%s" matches what is expected.', + args.expect_hostname) + logger.info('Host looks OK') @@ -2831,6 +2838,9 @@ def _get_parser(): parser_check_host = subparsers.add_parser( 'check-host', help='check host configuration') parser_check_host.set_defaults(func=command_check_host) + parser_check_host.add_argument( + '--expect-hostname', + help='Check that hostname matches an expected value') return parser