Skip to content

Commit

Permalink
Make runs reproducible when using --answer-file
Browse files Browse the repository at this point in the history
Until now, using --answer-file could lead to small changes that
made runs non-reproducible. This patch aims at fixing that with
the following changes:

- Overwrite the answer file passed as a parameter with the
  processed answers. This is useful when enabling features that are
  not there by default, and end up with PW_PLACEHOLDER value in
  some variables.
- Make sure CONFIG_HEAT_AUTH_ENC_KEY is respected if entered in
  answer file.
- Make sure nova migration keys are not regenerated if already
  present.

Change-Id: I6837a2973aed9d29d6c44ac64b510f91b80f878a
  • Loading branch information
javierpena committed Oct 9, 2015
1 parent b3b71a2 commit cbbf46e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions packstack/installer/run_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,10 @@ def _main(options, configFile=None, logFile=None):
path = _getanswerfilepath()
if path:
generateAnswerFile(path)
# If an answer file was provided, some options may have been overriden
# Overwrite answer file with updated options
else:
generateAnswerFile(options.answer_file)

# Update masked_value_list with user input values
_updateMaskedValueSet()
Expand Down
2 changes: 1 addition & 1 deletion packstack/plugins/heat_650.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def initConfig(controller):
"MASK_INPUT": True,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_HEAT_AUTH_ENC_KEY",
"USE_DEFAULT": True,
"USE_DEFAULT": False,
"NEED_CONFIRM": True,
"CONDITION": False},

Expand Down
9 changes: 5 additions & 4 deletions packstack/plugins/nova_300.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,11 @@ def dummy_interface(host):

def create_ssh_keys(config, messages):
migration_key = os.path.join(basedefs.VAR_DIR, 'nova_migration_key')
# Generate key
local = utils.ScriptRunner()
local.append('ssh-keygen -t rsa -b 2048 -f "%s" -N ""' % migration_key)
local.execute()
# Generate key if it does not exist
if not os.path.exists(migration_key):
local = utils.ScriptRunner()
local.append('ssh-keygen -t rsa -b 2048 -f "%s" -N ""' % migration_key)
local.execute()

with open(migration_key) as fp:
secret = fp.read().strip()
Expand Down

0 comments on commit cbbf46e

Please sign in to comment.