]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: check-host: add optional --expect-hostname
authorSage Weil <sage@redhat.com>
Tue, 4 Feb 2020 13:17:30 +0000 (07:17 -0600)
committerSage Weil <sage@redhat.com>
Tue, 4 Feb 2020 16:30:53 +0000 (10:30 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/cephadm/cephadm

index 0c53578d9e9e1377497943374a68644d581d3655..5571db7e6d1617e6b7f8cd8dcc2491ac8a39f90e 100755 (executable)
@@ -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