mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 09:32:21 +00:00
Merge pull request #84 from erderial/patch-2
Adding wcons functionality for nodeconsole
This commit is contained in:
commit
76491785db
@ -38,6 +38,8 @@ argparser.add_option('-t', '--tile', action='store_true', default=False,
|
||||
help='Tile console windows in the terminal')
|
||||
argparser.add_option('-l', '--log', action='store_true', default=False,
|
||||
help='Enter log replay mode instead of showing a live console')
|
||||
argparser.add_option('-w','--wcons', action='store_true', default=False,
|
||||
help='Enter wcons mode, opening xterm windows for every node')
|
||||
(options, args) = argparser.parse_args()
|
||||
if len(args) != 1:
|
||||
argparser.print_help()
|
||||
@ -51,6 +53,19 @@ if options.log:
|
||||
sys.exit(1)
|
||||
logreader.replay_to_console(logname)
|
||||
sys.exit(0)
|
||||
#added functionality for wcons
|
||||
if options.wcons:
|
||||
nodes = []
|
||||
sess = client.Command()
|
||||
for res in sess.read('/noderange/{0}/nodes/'.format(args[0])):
|
||||
node = res.get('item', {}).get('href', '/').replace('/', '')
|
||||
if not node:
|
||||
sys.stderr.write(res.get('error', repr(res)) + '\n')
|
||||
sys.exit(1)
|
||||
nodes.append(node)
|
||||
for node in sortutil.natural_sort(nodes):
|
||||
subprocess.call(['xterm', '-e', 'nodeconsole', node])
|
||||
#end of wcons
|
||||
if options.tile:
|
||||
null = open('/dev/null', 'w')
|
||||
nodes = []
|
||||
|
Loading…
Reference in New Issue
Block a user