Allow specifying of a global --password option
This fixes bz#1108742 by providing a new global parameter "--default-password", that will be the default for all other password parameters if set. Each individual password parameter can override the default global, and if none are set, a random password will be used as before. As part of the change, process_param_value() has been updated, to avoid leaking passwords when they are modified by a processor function. Change-Id: Ic5947567599c8b221b7a9e60acb4708429507741
This commit is contained in:
parent
a45eaf6128
commit
512bdce979
|
@ -43,7 +43,10 @@ Global Options
|
|||
Set to 'y' if you would like Packstack to install the OpenStack Client packages. An admin "rc" file will also be installed ['y', 'n'].
|
||||
|
||||
**CONFIG_NTP_SERVERS**
|
||||
Comma separated list of NTP servers. Leave plain if Packstack should not install ntpd on instances..
|
||||
Comma separated list of NTP servers. Leave plain if Packstack should not install ntpd on instances.
|
||||
|
||||
**CONFIG_DEFAULT_PASSWORD**
|
||||
A default password to be used on all services, databases, keys, etc. It will be overriden by any explicitly set password. Leave plain to not set a default password.
|
||||
|
||||
**CONFIG_NAGIOS_INSTALL**
|
||||
Set to 'y' if you would like Packstack to install Nagios to monitor openstack hosts ['y', 'n'].
|
||||
|
|
|
@ -85,5 +85,5 @@ ERR_FAILURE="General failure"
|
|||
ERR_NO_ANSWER_FILE="Error: Could not find file %s"
|
||||
ERR_ONLY_1_FLAG="Error: The %s flag is mutually exclusive to all other command line options"
|
||||
ERR_REMOVE_REMOTE_VAR="Error: Failed to remove directory %s on %s, it contains sensitive data and should be removed"
|
||||
|
||||
ERR_REMOVE_TMP_FILE="Error: Failed to remove temporary file %s, it contains sensitive data and should be removed"
|
||||
#
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import netaddr
|
||||
import os
|
||||
import uuid
|
||||
|
||||
from .utils import ScriptRunner, force_ip
|
||||
from .exceptions import ParamProcessingError, NetworkError
|
||||
|
@ -11,7 +12,7 @@ __all__ = ('ParamProcessingError', 'process_cidr', 'process_host',
|
|||
'process_ssh_key')
|
||||
|
||||
|
||||
def process_cidr(param, process_args=None):
|
||||
def process_cidr(param, param_name, process_args=None):
|
||||
"""
|
||||
Corrects given CIDR if necessary.
|
||||
"""
|
||||
|
@ -24,7 +25,7 @@ def process_cidr(param, process_args=None):
|
|||
raise ParamProcessingError(str(ex))
|
||||
|
||||
|
||||
def process_host(param, process_args=None):
|
||||
def process_host(param, param_name, process_args=None):
|
||||
"""
|
||||
Tries to change given parameter to IP address, if it is in hostname
|
||||
format
|
||||
|
@ -37,7 +38,7 @@ def process_host(param, process_args=None):
|
|||
raise ParamProcessingError(str(ex))
|
||||
|
||||
|
||||
def process_ssh_key(param, process_args=None):
|
||||
def process_ssh_key(param, param_name, process_args=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).
|
||||
|
@ -63,7 +64,7 @@ def process_ssh_key(param, process_args=None):
|
|||
return param
|
||||
|
||||
|
||||
def process_add_quotes_around_values(param, process_args=None):
|
||||
def process_add_quotes_around_values(param, param_name, process_args=None):
|
||||
"""
|
||||
Add a single quote character around each element of a comma
|
||||
separated list of values
|
||||
|
@ -77,3 +78,33 @@ def process_add_quotes_around_values(param, process_args=None):
|
|||
params_list[index] = elem
|
||||
param = ','.join(params_list)
|
||||
return param
|
||||
|
||||
def process_password(param, param_name, process_args=None):
|
||||
"""
|
||||
Process passwords, checking the following:
|
||||
1- If there is a user-entered password, use it
|
||||
2- Otherwise, check for a global default password, and use it if available
|
||||
3- As a last resort, generate a random password
|
||||
"""
|
||||
if not hasattr(process_password,"pw_dict"):
|
||||
process_password.pw_dict = {}
|
||||
|
||||
if param == "PW_PLACEHOLDER":
|
||||
if process_args["CONFIG_DEFAULT_PASSWORD"] != "":
|
||||
param = process_args["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
|
||||
if param_name.endswith("_CONFIRMED"):
|
||||
unconfirmed_param = param_name[:-10]
|
||||
if unconfirmed_param in process_password.pw_dict:
|
||||
param = process_password.pw_dict[unconfirmed_param]
|
||||
else:
|
||||
param = uuid.uuid4().hex[:16]
|
||||
process_password.pw_dict[unconfirmed_param] = param
|
||||
elif not param_name in process_password.pw_dict:
|
||||
param = uuid.uuid4().hex[:16]
|
||||
process_password.pw_dict[param_name] = param
|
||||
else:
|
||||
param = process_password.pw_dict[param_name]
|
||||
return param
|
||||
|
|
|
@ -30,7 +30,7 @@ commandLineValues = {}
|
|||
# List to hold all values to be masked in logging (i.e. passwords and sensitive data)
|
||||
#TODO: read default values from conf_param?
|
||||
masked_value_set = set()
|
||||
|
||||
tmpfiles = []
|
||||
|
||||
def initLogging (debug):
|
||||
global logFile
|
||||
|
@ -147,8 +147,7 @@ def input_param(param):
|
|||
confirmedParamName = param.CONF_NAME + "_CONFIRMED"
|
||||
confirmedParam.CONF_NAME = confirmedParamName
|
||||
confirmedParam.PROMPT = output_messages.INFO_CONF_PARAMS_PASSWD_CONFIRM_PROMPT
|
||||
confirmedParam.VALIDATORS = [validators.validate_not_empty]
|
||||
# Now get both values from user (with existing validations
|
||||
# Now get both values from user (with existing validations)
|
||||
while True:
|
||||
_getInputFromUser(param)
|
||||
_getInputFromUser(confirmedParam)
|
||||
|
@ -274,10 +273,11 @@ def process_param_value(param, value):
|
|||
logging.debug("Processing value of parameter "
|
||||
"%s." % param.CONF_NAME)
|
||||
try:
|
||||
new_value = proc_func(_value, controller.CONF)
|
||||
new_value = proc_func(_value, param.CONF_NAME, controller.CONF)
|
||||
if new_value != _value:
|
||||
msg = output_messages.INFO_CHANGED_VALUE
|
||||
print msg % (_value, new_value)
|
||||
if param.MASK_INPUT == False:
|
||||
msg = output_messages.INFO_CHANGED_VALUE
|
||||
print msg % (_value, new_value)
|
||||
_value = new_value
|
||||
else:
|
||||
logging.debug("Processor returned the original "
|
||||
|
@ -429,6 +429,19 @@ def _getanswerfilepath():
|
|||
controller.MESSAGES.append(msg)
|
||||
return path
|
||||
|
||||
def _gettmpanswerfilepath():
|
||||
path = None
|
||||
msg = "Could not find a suitable path on which to create the temporary answerfile"
|
||||
|
||||
ts = datetime.datetime.now().strftime('%Y%m%d-%H%M%S')
|
||||
|
||||
p = os.path.expanduser("~/")
|
||||
if os.access(p, os.W_OK):
|
||||
path = os.path.abspath(os.path.join(p, "tmp-packstack-answers-%s.txt"%ts))
|
||||
tmpfiles.append(path)
|
||||
|
||||
return path
|
||||
|
||||
def _handleInteractiveParams():
|
||||
try:
|
||||
logging.debug("Groups: %s" % ', '.join([x.GROUP_NAME for x in controller.getAllGroups()]))
|
||||
|
@ -474,13 +487,8 @@ def _handleInteractiveParams():
|
|||
else:
|
||||
logging.debug("no post condition check for group %s" % group.GROUP_NAME)
|
||||
|
||||
path = _getanswerfilepath()
|
||||
|
||||
_displaySummary()
|
||||
|
||||
if path:
|
||||
generateAnswerFile(path)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
logging.error("keyboard interrupt caught")
|
||||
raise Exception(output_messages.ERR_EXP_KEYBOARD_INTERRUPT)
|
||||
|
@ -589,6 +597,11 @@ def _main(configFile=None):
|
|||
# Get parameters
|
||||
_handleParams(configFile)
|
||||
|
||||
# Generate answer file
|
||||
path = _getanswerfilepath()
|
||||
if path:
|
||||
generateAnswerFile(path)
|
||||
|
||||
# Update masked_value_list with user input values
|
||||
_updateMaskedValueSet()
|
||||
|
||||
|
@ -634,6 +647,20 @@ def remove_remote_var_dirs():
|
|||
logging.exception(e)
|
||||
controller.MESSAGES.append(utils.color_text(msg, 'red'))
|
||||
|
||||
def remove_temp_files():
|
||||
"""
|
||||
Removes any temporary files generated during
|
||||
configuration
|
||||
"""
|
||||
for myfile in tmpfiles:
|
||||
try:
|
||||
os.unlink(myfile)
|
||||
except Exception as e:
|
||||
msg = output_messages.ERR_REMOVE_TMP_FILE % (myfile)
|
||||
logging.error(msg)
|
||||
logging.exception(e)
|
||||
controller.MESSAGES.append(utils.color_text(msg, 'red'))
|
||||
|
||||
|
||||
def generateAnswerFile(outputFile, overrides={}):
|
||||
sep = os.linesep
|
||||
|
@ -688,7 +715,7 @@ def single_step_aio_install(options):
|
|||
single_step_install(options)
|
||||
|
||||
def single_step_install(options):
|
||||
answerfilepath = _getanswerfilepath()
|
||||
answerfilepath = _gettmpanswerfilepath()
|
||||
if not answerfilepath:
|
||||
_printAdditionalMessages()
|
||||
return
|
||||
|
@ -892,6 +919,12 @@ def main():
|
|||
if options.gen_answer_file:
|
||||
# Make sure only --gen-answer-file was supplied
|
||||
validateSingleFlag(options, "gen_answer_file")
|
||||
answerfilepath = _gettmpanswerfilepath()
|
||||
if not answerfilepath:
|
||||
_printAdditionalMessages()
|
||||
return
|
||||
generateAnswerFile(answerfilepath)
|
||||
_handleParams(answerfilepath)
|
||||
generateAnswerFile(options.gen_answer_file)
|
||||
# Are we installing an all in one
|
||||
elif options.allinone:
|
||||
|
@ -926,6 +959,7 @@ def main():
|
|||
|
||||
finally:
|
||||
remove_remote_var_dirs()
|
||||
remove_temp_files()
|
||||
|
||||
# Always print user params to log
|
||||
_printAdditionalMessages()
|
||||
|
|
|
@ -9,6 +9,7 @@ import uuid
|
|||
import os
|
||||
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer import utils
|
||||
|
||||
|
@ -95,12 +96,13 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for NSS certificate database",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:32],
|
||||
"MASK_INPUT": False,
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME": "CONFIG_AMQP_NSS_CERTDB_PW",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "amqp-ssl-port",
|
||||
|
@ -186,12 +188,13 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for user authentication",
|
||||
"OPTION_LIST": ["y", "n"],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"MASK_INPUT": False,
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME": "CONFIG_AMQP_AUTH_PASSWORD",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
]
|
||||
group = {"GROUP_NAME": "AMQPAUTH",
|
||||
|
|
|
@ -10,6 +10,7 @@ import uuid
|
|||
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
appendManifestFile)
|
||||
|
@ -44,10 +45,11 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Ceilometer Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
],
|
||||
|
|
|
@ -43,11 +43,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Cinder DB access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_CINDER_DB_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
@ -57,11 +58,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Cinder Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_CINDER_KS_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import uuid
|
|||
import logging
|
||||
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer import utils
|
||||
from packstack.installer.utils import split_hosts
|
||||
|
@ -29,11 +30,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Glance DB access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_GLANCE_DB_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
@ -43,11 +45,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Glance Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_GLANCE_KS_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
]
|
||||
|
|
|
@ -10,6 +10,7 @@ import os
|
|||
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
|
||||
from packstack.modules.shortcuts import get_mq
|
||||
from packstack.modules.ospluginutils import (getManifestTemplate,
|
||||
|
@ -31,11 +32,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Heat MySQL user",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_HEAT_DB_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
@ -60,11 +62,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Heat Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_HEAT_KS_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
@ -142,12 +145,13 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter password for Keystone domain admin user for Heat",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"MASK_INPUT": False,
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_HEAT_DOMAIN_PASSWORD",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
]
|
||||
group = {"GROUP_NAME": "Heat",
|
||||
|
|
|
@ -8,6 +8,7 @@ import logging
|
|||
import uuid
|
||||
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer import utils
|
||||
|
||||
|
@ -28,11 +29,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Keystone DB access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_KEYSTONE_DB_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
@ -54,7 +56,8 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Keystone admin user",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_KEYSTONE_ADMIN_PW",
|
||||
|
@ -67,7 +70,8 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Keystone demo user",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_KEYSTONE_DEMO_PW",
|
||||
|
|
|
@ -8,6 +8,7 @@ import uuid
|
|||
import logging
|
||||
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.installer import utils
|
||||
from packstack.installer.utils import split_hosts
|
||||
from packstack.modules.common import filtered_hosts
|
||||
|
@ -59,7 +60,8 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the MariaDB admin user",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME": "CONFIG_MARIADB_PW",
|
||||
|
|
|
@ -8,6 +8,7 @@ import uuid
|
|||
import logging
|
||||
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.installer import basedefs, output_messages
|
||||
from packstack.installer import utils
|
||||
|
||||
|
@ -29,7 +30,8 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the nagiosadmin user",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME": "CONFIG_NAGIOS_PW",
|
||||
|
|
|
@ -12,6 +12,7 @@ import uuid
|
|||
from packstack.installer import utils
|
||||
from packstack.installer import exceptions
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.installer import output_messages
|
||||
from packstack.installer.utils import split_hosts
|
||||
|
||||
|
@ -36,11 +37,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for Neutron Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_NEUTRON_KS_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
@ -49,11 +51,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for Neutron DB access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_NEUTRON_DB_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
@ -93,11 +96,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter Neutron metadata agent password",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_NEUTRON_METADATA_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
|
|
@ -39,11 +39,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Nova DB access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_NOVA_DB_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
@ -53,11 +54,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Nova Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_NOVA_KS_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
|
|
@ -53,6 +53,25 @@ def initConfig(controller):
|
|||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "default-password",
|
||||
"USAGE": (
|
||||
"Set a default password everywhere. The default password "
|
||||
"will be overriden by whatever password is set for each "
|
||||
"individual service or user."
|
||||
),
|
||||
"PROMPT": (
|
||||
"Enter a default password to be used. Leave blank for a "
|
||||
"randomly generated one."
|
||||
),
|
||||
"OPTION_LIST": [],
|
||||
"DEFAULT_VALUE": '',
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_DEFAULT_PASSWORD",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "mariadb-install",
|
||||
"USAGE": (
|
||||
"Set to 'y' if you would like Packstack to install MariaDB"
|
||||
|
|
|
@ -9,6 +9,7 @@ import uuid
|
|||
|
||||
from packstack.installer import utils
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
|
||||
from packstack.modules.common import is_all_in_one
|
||||
from packstack.modules.ospluginutils import (appendManifestFile,
|
||||
|
@ -81,7 +82,8 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Tempest Provisioning user",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_PROVISION_TEMPEST_USER_PW",
|
||||
|
|
|
@ -11,6 +11,7 @@ import logging
|
|||
import netaddr
|
||||
|
||||
from packstack.installer import validators
|
||||
from packstack.installer import processors
|
||||
from packstack.installer.exceptions import ParamValidationError
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer import utils
|
||||
|
@ -34,11 +35,12 @@ def initConfig(controller):
|
|||
"PROMPT": "Enter the password for the Swift Keystone access",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [validators.validate_not_empty],
|
||||
"DEFAULT_VALUE": uuid.uuid4().hex[:16],
|
||||
"DEFAULT_VALUE": "PW_PLACEHOLDER",
|
||||
"PROCESSORS": [processors.process_password],
|
||||
"MASK_INPUT": True,
|
||||
"LOOSE_VALIDATION": False,
|
||||
"CONF_NAME": "CONFIG_SWIFT_KS_PW",
|
||||
"USE_DEFAULT": True,
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": True,
|
||||
"CONDITION": False},
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@ 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',
|
||||
proc_local = process_host('localhost', 'HOSTNAME',
|
||||
process_args={'allow_localhost': True})
|
||||
self.assertIn(proc_local, ['127.0.0.1', '::1'])
|
||||
|
||||
def test_process_ssh_key(self):
|
||||
"""Test packstack.installer.processors.process_ssh_key"""
|
||||
path = process_ssh_key(os.path.join(self.tempdir, 'id_rsa'))
|
||||
path = process_ssh_key(os.path.join(self.tempdir, 'id_rsa'), 'SSH_KEY')
|
||||
# test if key was created
|
||||
self.assertEquals(True, bool(path))
|
||||
# test if key exists
|
||||
|
|
Loading…
Reference in New Issue