mirror of
https://gitlab.com/manzerbredes/clusterman.git
synced 2025-04-07 04:26:25 +02:00
Minor changes
This commit is contained in:
parent
c23a43fb31
commit
c217ff5e7b
2 changed files with 5 additions and 4 deletions
|
@ -21,6 +21,7 @@ def main():
|
||||||
# Exec
|
# Exec
|
||||||
node_cmd_list=node_subparsers.add_parser("exec")
|
node_cmd_list=node_subparsers.add_parser("exec")
|
||||||
node_cmd_list.add_argument("-g", "--group" ,help="Group to run the command on")
|
node_cmd_list.add_argument("-g", "--group" ,help="Group to run the command on")
|
||||||
|
node_cmd_list.add_argument("-l", "--login" ,help="Use ssh username and password")
|
||||||
node_cmd_list.add_argument("cmd",help="Command to run",nargs=argparse.REMAINDER)
|
node_cmd_list.add_argument("cmd",help="Command to run",nargs=argparse.REMAINDER)
|
||||||
|
|
||||||
##### Frontend commands #####
|
##### Frontend commands #####
|
||||||
|
@ -60,9 +61,9 @@ def main():
|
||||||
node.ls()
|
node.ls()
|
||||||
elif args.command == "exec":
|
elif args.command == "exec":
|
||||||
if args.group:
|
if args.group:
|
||||||
node.exec(args.cmd,args.group)
|
node.exec(args.cmd,args.group,args.login)
|
||||||
else:
|
else:
|
||||||
node.exec(args.cmd)
|
node.exec(args.cmd,args.login)
|
||||||
else:
|
else:
|
||||||
target_node.print_help(sys.stderr)
|
target_node.print_help(sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -60,9 +60,9 @@ def check(timeout):
|
||||||
else:
|
else:
|
||||||
print("Error: Some of your nodes are not reachable")
|
print("Error: Some of your nodes are not reachable")
|
||||||
|
|
||||||
def exec(command, group=None):
|
def exec(command, group=None, use_key=False):
|
||||||
nodes=utils.get_node_list() if group is None else utils.get_node_in_group(group)
|
nodes=utils.get_node_list() if group is None else utils.get_node_in_group(group)
|
||||||
for ip in nodes:
|
for ip in nodes:
|
||||||
print("----- Node {} -----".format(ip))
|
print("----- Node {} -----".format(ip))
|
||||||
print(utils.ssh_exec(ip," ".join(command)))
|
print(utils.ssh_exec(ip," ".join(command),use_key))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue