2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 19:10:10 +00:00

Change nodeconfig -r to take a parameter

This opens up for future ability to control the restore to default.
This commit is contained in:
Jarrod Johnson 2018-08-30 09:35:16 -04:00
parent ba18b9936f
commit 7c9089c87d
2 changed files with 15 additions and 8 deletions

View File

@ -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)
sys.exit(rcode)

View File

@ -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