From 7c9089c87d77b9802e2312816336ef2436407d3a Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 30 Aug 2018 09:35:16 -0400 Subject: [PATCH] Change nodeconfig -r to take a parameter This opens up for future ability to control the restore to default. --- confluent_client/bin/nodeconfig | 17 ++++++++++++----- confluent_client/doc/man/nodeconfig.ronn | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/confluent_client/bin/nodeconfig b/confluent_client/bin/nodeconfig index bcff01ea..c35042b4 100755 --- a/confluent_client/bin/nodeconfig +++ b/confluent_client/bin/nodeconfig @@ -61,9 +61,10 @@ argparser.add_option('-a', '--advanced', dest='advanced', 'intended to be used without direction from the ' 'relevant server vendor.') argparser.add_option('-r', '--restoredefault', default=False, - action='store_true', - help='Restore the BIOS/UEFI configuration of the node ' - 'to factory default') + dest='restoredefault', metavar="COMPONENT", + help='Restore the configuration of the node ' + 'to factory default for given component. ' + 'Currently only uefi is supported') (options, args) = argparser.parse_args() cfgpaths = { @@ -174,12 +175,18 @@ for param in args[1:]: queryparms[path][attrib] = param session = client.Command() rcode = 0 -if options.restoredefault: +if options.restoredefault and options.restoredefault.lower() in ( + 'sys', 'system', 'uefi', 'bios'): for fr in session.update( '/noderange/{0}/configuration/system/clear'.format(noderange), {'clear': True}): rcode |= client.printerror(fr) sys.exit(rcode) +elif options.restoredefault: + sys.stderr.write( + 'Unrecognized component to restore defaults: {0}\n'.format( + options.restoredefault)) + sys.exit(1) if setmode: if options.exclude: sys.stderr.write('Cannot use exclude and assign at the same time\n') @@ -231,4 +238,4 @@ else: noderange) rcode = client.print_attrib_path(path, session, printsys, options) -sys.exit(rcode) \ No newline at end of file +sys.exit(rcode) diff --git a/confluent_client/doc/man/nodeconfig.ronn b/confluent_client/doc/man/nodeconfig.ronn index aacd33b9..713095b0 100644 --- a/confluent_client/doc/man/nodeconfig.ronn +++ b/confluent_client/doc/man/nodeconfig.ronn @@ -31,9 +31,9 @@ given as a node expression, as documented in the man page for nodeattribexpressi values for a setting. * `-r`, `--restoredefault`: - Request that the specified nodes be restored to default BIOS/UEFI - configuration. This excludes BMC configuration which is not supported - to be cleared at this time. + Request that the specified component of the targeted nodes will have its + configuration reset to default. Currently the only component implemented + is uefi. ## EXAMPLES