mirror of
https://github.com/xcat2/confluent.git
synced 2026-06-02 09:19:39 +00:00
Add support for passing a parameterfile in updates
This commit is contained in:
@@ -59,6 +59,8 @@ argparser = optparse.OptionParser(
|
||||
"%prog <noderange> [list][updatestatus][update [--backup <file>]]|[<components>]")
|
||||
argparser.add_option('-b', '--backup', action='store_true',
|
||||
help='Target a backup bank rather than primary')
|
||||
argparser.add_option('-p', '--parameterfile', type='string',
|
||||
help='When updating, use the specified parameter file')
|
||||
argparser.add_option('-m', '--maxnodes', type='int',
|
||||
help='When updating, prompt if more than the specified '
|
||||
'number of servers will be affected')
|
||||
@@ -112,6 +114,10 @@ def update_firmware(session, filename):
|
||||
upargs = {'filename': filename}
|
||||
if options.backup:
|
||||
upargs['bank'] = 'backup'
|
||||
if options.parameterfile:
|
||||
with open(options.parameterfile, 'rb') as pf:
|
||||
pfdata = pf.read()
|
||||
upargs['parameterdata'] = pfdata
|
||||
noderrs = {}
|
||||
if session.unixdomain:
|
||||
filesbynode = {}
|
||||
|
||||
@@ -35,7 +35,10 @@ the out of band facilities. Firmware updates can end in one of three states:
|
||||
* `-m MAXNODES`, `--maxnodes=MAXNODES`:
|
||||
When updating, prompt if more than the specified number of servers will
|
||||
be affected
|
||||
|
||||
|
||||
* `-p PARAMETERFILE`, `--paramaterfile=PARAMETERFILE`:
|
||||
For updating, a parameter file to provife along with the update payload
|
||||
|
||||
* `-h`, `--help`:
|
||||
Show help message and exit
|
||||
|
||||
|
||||
@@ -595,6 +595,7 @@ class InputFirmwareUpdate(ConfluentMessage):
|
||||
def __init__(self, path, nodes, inputdata, configmanager):
|
||||
self._filename = inputdata.get('filename', inputdata.get('url', inputdata.get('dirname', None)))
|
||||
self.bank = inputdata.get('bank', None)
|
||||
self.parameterdata = inputdata.get('parameterdata', None)
|
||||
self.nodes = nodes
|
||||
self.filebynode = {}
|
||||
self._complexname = False
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import asyncio
|
||||
import confluent.vinzmanager as vinzmanager
|
||||
import confluent.exceptions as exc
|
||||
@@ -466,6 +467,14 @@ class IpmiHandler:
|
||||
else:
|
||||
raise Exception('Not Implemented')
|
||||
|
||||
async def update_firmware(self, filename, progress, data, bank):
|
||||
params=()
|
||||
if self.inputdata.parameterdata:
|
||||
params = self.inputdata.parameterdata
|
||||
if params and isinstance(params, str):
|
||||
params = json.loads(params)
|
||||
return await self.ipmicmd.update_firmware(filename, progress=progress, data=data, bank=bank, otherfields=params)
|
||||
|
||||
async def handle_update(self):
|
||||
u = firmwaremanager.Updater(self.node, self.ipmicmd.update_firmware,
|
||||
self.inputdata.nodefile(self.node), self.tenant,
|
||||
|
||||
Reference in New Issue
Block a user