fix: update actions method
This commit is contained in:
parent
b378aa73ec
commit
4f035b6d53
@ -74,8 +74,9 @@ class ClusterCommunicationModule():
|
||||
if not status:
|
||||
print("Some Errors!")
|
||||
|
||||
# remove 'add node'
|
||||
self.node_manager.actions = self.node_manager.actions[1:]
|
||||
self.node_manager.actions = [
|
||||
{'explanation': 'Exit', 'function': 'exit'},
|
||||
]
|
||||
|
||||
self.node_manager.status = 'worker'
|
||||
print(f'You are in {addr} cluster now.\nPlease type in Enter to continue')
|
||||
|
||||
@ -56,12 +56,12 @@ class NodeManager():
|
||||
choose = int(choose)-1
|
||||
accept = self.cluster_communication_module.request(hosts[choose])
|
||||
if accept:
|
||||
exit_func = self.actions[-1]
|
||||
self.actions = self.actions[:-1]
|
||||
info_func = {'explanation': 'cluster info', 'function': 'cluster_info'}
|
||||
if info_func not in self.actions:
|
||||
self.actions.append(info_func)
|
||||
self.actions.append(exit_func)
|
||||
self.actions = [
|
||||
{'explanation': 'Add another node into our cluster', 'function': 'add_node'},
|
||||
{'explanation': 'Cluster info', 'function': 'cluster_info'},
|
||||
{'explanation': 'Start working', 'function': 'start_work'},
|
||||
{'explanation': 'Exit', 'function': 'exit'},
|
||||
]
|
||||
except:
|
||||
print("=== FAIL ===")
|
||||
else:
|
||||
@ -79,4 +79,3 @@ class NodeManager():
|
||||
self.cluster_communication_module.exit()
|
||||
self.service_exploration_module.exit()
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user