Skip to content

Commit 9b710bc

Browse files
committed
Dev: ui_cluster: Remove unused codes
1 parent 5f5f62b commit 9b710bc

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

crmsh/bootstrap.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def my_hostname_resolves():
595595
return False
596596

597597

598-
def check_prereqs(stage):
598+
def check_prereqs():
599599
warned = False
600600

601601
if not my_hostname_resolves():
@@ -2149,17 +2149,16 @@ def bootstrap_init(context):
21492149
_context.load_profiles()
21502150
_context.init_sbd_manager()
21512151

2152-
# Need hostname resolution to work, want NTP (but don't block csync2_remote)
2153-
if stage not in ('csync2_remote', 'qnetd_remote'):
2154-
check_tty()
2155-
if not check_prereqs(stage):
2156-
return
2157-
else:
2152+
if stage in ('csync2_remote', 'qnetd_remote'):
21582153
args = _context.args
2159-
logger_utils.log_only_to_file("args: {}".format(args))
2154+
logger_utils.log_only_to_file(f"args: {args}")
21602155
if len(args) != 2:
2161-
utils.fatal(f"Expected NODE argument to {stage} stage")
2156+
utils.fatal(f"Expected NODE argument for '{stage}' stage")
21622157
_context.cluster_node = args[1]
2158+
else:
2159+
check_tty()
2160+
if not check_prereqs():
2161+
return
21632162

21642163
if stage and _context.cluster_is_running and \
21652164
not ServiceManager(shell=sh.ClusterShellAdaptorForLocalShell(sh.LocalShell())).service_is_active(CSYNC2_SERVICE):
@@ -2245,7 +2244,7 @@ def bootstrap_join(context):
22452244

22462245
check_tty()
22472246

2248-
if not check_prereqs("join"):
2247+
if not check_prereqs():
22492248
return
22502249

22512250
if _context.stage != "":

crmsh/ui_cluster.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,6 @@ def do_init(self, context, *args):
329329
'''
330330
Initialize a cluster.
331331
'''
332-
def looks_like_hostnames(lst):
333-
sectionlist = bootstrap.INIT_STAGES
334-
return all(not (l.startswith('-') or l in sectionlist) for l in lst)
335-
if len(args) > 0:
336-
if '--dry-run' in args or looks_like_hostnames(args):
337-
args = ['--yes', '--nodes'] + [arg for arg in args if arg != '--dry-run']
338332
parser = ArgumentParser(description="""
339333
Initialize a cluster from scratch. This command configures
340334
a complete cluster, and can also add additional cluster

0 commit comments

Comments
 (0)