2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-17 13:13:18 +00:00

Merge pull request #39 from jjohnson42/fixnodelistnoarg

Fix bad or missing noderange behavior in nodelist
This commit is contained in:
Jarrod Johnson 2015-10-14 11:10:34 -04:00
commit 7b26d2edfb

View File

@ -34,9 +34,9 @@ argparser.add_option('-b', '--blame', action='store_true',
(options, args) = argparser.parse_args()
try:
noderange = args[0]
nodelist = '/noderange/{0}/nodes/'.format(noderange)
except IndexError:
argparser.print_help()
sys.exit(1)
nodelist = '/nodes/'
session = client.Command()
exitcode = 0
if len(args) > 1:
@ -77,6 +77,10 @@ if len(args) > 1:
sys.stderr.write('Error: {0} not a valid attribute\n'.format(attr))
exitcode = 1
else:
for res in session.read('/noderange/{0}/nodes/'.format(noderange)):
print res['item']['href'].replace('/', '')
for res in session.read(nodelist):
if 'error' in res:
sys.stderr.write(res['error'] + '\n')
exitcode = 1
else:
print res['item']['href'].replace('/', '')
sys.exit(exitcode)