Remove args from BlockDevice() init
The args agument was only used to find the symbol for the getval command. Have the command pass the symbol to find in directly. We can therefore remove the args paramater to the BlockDevice() creation. Change-Id: I8e357131b70a00e4a2c4792c009f6058d1d5ae9e
This commit is contained in:
parent
c74ba2fe74
commit
b9c065de28
@ -149,16 +149,14 @@ class BlockDevice(object):
|
|||||||
return json.load(fd)
|
return json.load(fd)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __init__(self, params, args):
|
def __init__(self, params):
|
||||||
"""Create BlockDevice object
|
"""Create BlockDevice object
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
:param params: YAML file from --params
|
:param params: YAML file from --params
|
||||||
:param args: arguments from cmd argparse
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logger.debug("Creating BlockDevice object")
|
logger.debug("Creating BlockDevice object")
|
||||||
self.args = args
|
|
||||||
|
|
||||||
self.params = params
|
self.params = params
|
||||||
logger.debug("Params [%s]" % self.params)
|
logger.debug("Params [%s]" % self.params)
|
||||||
@ -250,13 +248,16 @@ class BlockDevice(object):
|
|||||||
logger.info("Wrote final block device config to [%s]"
|
logger.info("Wrote final block device config to [%s]"
|
||||||
% self.config_json_file_name)
|
% self.config_json_file_name)
|
||||||
|
|
||||||
def cmd_getval(self):
|
def cmd_getval(self, symbol):
|
||||||
"""Retrieve value from block device level
|
"""Retrieve value from block device level
|
||||||
|
|
||||||
This is needed for backward compatibility (non python) access
|
The value of SYMBOL is printed to stdout. This is intended to
|
||||||
to (internal) configuration.
|
be captured into bash-variables for backward compatibility
|
||||||
|
(non python) access to internal configuration.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
:symbol: The symbol to find
|
||||||
"""
|
"""
|
||||||
symbol = self.args.symbol
|
|
||||||
logger.info("Getting value for [%s]" % symbol)
|
logger.info("Getting value for [%s]" % symbol)
|
||||||
if symbol == 'image-block-partition':
|
if symbol == 'image-block-partition':
|
||||||
# If there is no partition needed, pass back directly the
|
# If there is no partition needed, pass back directly the
|
||||||
|
@ -30,7 +30,7 @@ class BlockDeviceCmd(object):
|
|||||||
self.bd.cmd_init()
|
self.bd.cmd_init()
|
||||||
|
|
||||||
def cmd_getval(self):
|
def cmd_getval(self):
|
||||||
self.bd.cmd_getval()
|
self.bd.cmd_getval(self.args.symbol)
|
||||||
|
|
||||||
def cmd_create(self):
|
def cmd_create(self):
|
||||||
self.bd.cmd_create()
|
self.bd.cmd_create()
|
||||||
@ -110,7 +110,7 @@ class BlockDeviceCmd(object):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Setup main BlockDevice object from args
|
# Setup main BlockDevice object from args
|
||||||
self.bd = BlockDevice(self.params, self.args)
|
self.bd = BlockDevice(self.params)
|
||||||
|
|
||||||
self.args.func()
|
self.args.func()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user