Rename process_args to config in processors.py
The process_args variable name in functions found in processors.py is a leftover from previous versions. config is a more appropriate variable name. Change-Id: I38bc821877ac95c84b0d728a8d40681a993d6aa1
This commit is contained in:
parent
4316fc4675
commit
3c91baba29
@ -12,7 +12,7 @@ __all__ = ('ParamProcessingError', 'process_cidr', 'process_host',
|
||||
'process_ssh_key')
|
||||
|
||||
|
||||
def process_cidr(param, param_name, process_args=None):
|
||||
def process_cidr(param, param_name, config=None):
|
||||
"""
|
||||
Corrects given CIDR if necessary.
|
||||
"""
|
||||
@ -25,20 +25,18 @@ def process_cidr(param, param_name, process_args=None):
|
||||
raise ParamProcessingError(str(ex))
|
||||
|
||||
|
||||
def process_host(param, param_name, process_args=None):
|
||||
def process_host(param, param_name, config=None):
|
||||
"""
|
||||
Tries to change given parameter to IP address, if it is in hostname
|
||||
format
|
||||
"""
|
||||
localhost = process_args and \
|
||||
process_args.get('allow_localhost', False)
|
||||
try:
|
||||
return force_ip(param, allow_localhost=localhost)
|
||||
return force_ip(param, allow_localhost=True)
|
||||
except NetworkError as ex:
|
||||
raise ParamProcessingError(str(ex))
|
||||
|
||||
|
||||
def process_ssh_key(param, param_name, process_args=None):
|
||||
def process_ssh_key(param, param_name, config=None):
|
||||
"""
|
||||
Generates SSH key if given key in param doesn't exist. In case param
|
||||
is an empty string it generates default SSH key ($HOME/.ssh/id_rsa).
|
||||
@ -64,7 +62,7 @@ def process_ssh_key(param, param_name, process_args=None):
|
||||
return param
|
||||
|
||||
|
||||
def process_add_quotes_around_values(param, param_name, process_args=None):
|
||||
def process_add_quotes_around_values(param, param_name, config=None):
|
||||
"""
|
||||
Add a single quote character around each element of a comma
|
||||
separated list of values
|
||||
@ -79,7 +77,7 @@ def process_add_quotes_around_values(param, param_name, process_args=None):
|
||||
param = ','.join(params_list)
|
||||
return param
|
||||
|
||||
def process_password(param, param_name, process_args=None):
|
||||
def process_password(param, param_name, config=None):
|
||||
"""
|
||||
Process passwords, checking the following:
|
||||
1- If there is a user-entered password, use it
|
||||
@ -90,8 +88,8 @@ def process_password(param, param_name, process_args=None):
|
||||
process_password.pw_dict = {}
|
||||
|
||||
if param == "PW_PLACEHOLDER":
|
||||
if process_args["CONFIG_DEFAULT_PASSWORD"] != "":
|
||||
param = process_args["CONFIG_DEFAULT_PASSWORD"]
|
||||
if config["CONFIG_DEFAULT_PASSWORD"] != "":
|
||||
param = config["CONFIG_DEFAULT_PASSWORD"]
|
||||
else:
|
||||
# We need to make sure we store the random password we provide
|
||||
# and return it once we are asked for it again
|
||||
|
@ -27,8 +27,7 @@ from ..test_base import PackstackTestCaseMixin
|
||||
class ProcessorsTestCase(PackstackTestCaseMixin, TestCase):
|
||||
def test_process_host(self):
|
||||
"""Test packstack.installer.processors.process_host"""
|
||||
proc_local = process_host('localhost', 'HOSTNAME',
|
||||
process_args={'allow_localhost': True})
|
||||
proc_local = process_host('localhost', 'HOSTNAME')
|
||||
self.assertIn(proc_local, ['127.0.0.1', '::1'])
|
||||
|
||||
def test_process_ssh_key(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user