diff --git a/confluent_client/bin/nodeattrib b/confluent_client/bin/nodeattrib index 4ed96406..8c6f078d 100755 --- a/confluent_client/bin/nodeattrib +++ b/confluent_client/bin/nodeattrib @@ -53,6 +53,8 @@ argparser.add_option('-p', '--prompt', action='store_true', argparser.add_option('-m', '--maxnodes', type='int', help='Prompt if trying to set attributes on more ' 'than specified number of nodes') +argparser.add_option('-s', '--set', dest='set', metavar='settings.batch', + default=False, help='set attributes using a batch file') (options, args) = argparser.parse_args() @@ -109,6 +111,23 @@ elif options.clear or options.environment or options.prompt: sys.stderr.write('Attribute names required with specified options\n') argparser.print_help() exitcode = 400 + +elif options.set: + arglist = [noderange] + showtype='current' + argfile = open(options.set, 'r') + argset = argfile.readline() + while argset: + try: + argset = argset[:argset.index('#')] + except ValueError: + pass + argset = argset.strip() + if argset: + arglist += shlex.split(argset) + argset = argfile.readline() + session.stop_if_noderange_over(noderange, options.maxnodes) + exitcode=client.updateattrib(session,arglist,nodetype, noderange, options, None) if exitcode != 0: sys.exit(exitcode) diff --git a/confluent_client/doc/man/nodeattrib.ronn.tmpl b/confluent_client/doc/man/nodeattrib.ronn.tmpl index 6684fce0..b1330198 100644 --- a/confluent_client/doc/man/nodeattrib.ronn.tmpl +++ b/confluent_client/doc/man/nodeattrib.ronn.tmpl @@ -7,7 +7,8 @@ nodeattrib(8) -- List or change confluent nodes attributes `nodeattrib [ ...]` `nodeattrib -c ...` `nodeattrib -e ...` -`nodeattrib -p ...` +`nodeattrib -p ...` +`nodeattrib -s ` ## DESCRIPTION @@ -58,7 +59,10 @@ to a blank value will allow masking a group defined attribute with an empty valu * `-p`, `--prompt`: Request interactive prompting to provide values rather than the command line or environment variables. - + +* `-s`, `--set`: + Set attributes using a batch file + * `-m MAXNODES`, `--maxnodes=MAXNODES`: Prompt if trying to set attributes on more than specified number of nodes.