Browse code

Save interactive passwords to separate file

The interactive password prompt currently saves to .localrc.auto

However, this is removed when you re-run stack; that is required as it
is how we source the localrc bits of local.conf, and we want the
users' changes to be picked up.

The passwords, however, should remain constant, because everything has
already been setup with them. So write them to a separate file. Note
we source before localrc so it can still overwrite them.

Some minor flow-changes too

Change-Id: I9871c8b8c7569626faf552628de69b811ba4dac0
Closes-Bug: #1505872

Ian Wienand authored on 2015/10/14 13:12:32
Showing 3 changed files
... ...
@@ -134,7 +134,9 @@ rm -rf $DIRS_TO_CLEAN
134 134
 
135 135
 # Clean up files
136 136
 
137
-FILES_TO_CLEAN=".localrc.auto docs/files docs/html shocco/ stack-screenrc test*.conf* test.ini*"
137
+FILES_TO_CLEAN=".localrc.auto .localrc.password "
138
+FILES_TO_CLEAN+="docs/files docs/html shocco/ "
139
+FILES_TO_CLEAN+="stack-screenrc test*.conf* test.ini* "
138 140
 FILES_TO_CLEAN+=".stackenv .prereqs"
139 141
 
140 142
 for file in $FILES_TO_CLEAN; do
... ...
@@ -569,7 +569,7 @@ function read_password {
569 569
     if [[ -f $RC_DIR/localrc ]]; then
570 570
         localrc=$TOP_DIR/localrc
571 571
     else
572
-        localrc=$TOP_DIR/.localrc.auto
572
+        localrc=$TOP_DIR/.localrc.password
573 573
     fi
574 574
 
575 575
     # If the password is not defined yet, proceed to prompt user for a password.
... ...
@@ -579,13 +579,15 @@ function read_password {
579 579
             touch $localrc
580 580
         fi
581 581
 
582
-        # Presumably if we got this far it can only be that our localrc is missing
583
-        # the required password.  Prompt user for a password and write to localrc.
582
+        # Presumably if we got this far it can only be that our
583
+        # localrc is missing the required password.  Prompt user for a
584
+        # password and write to localrc.
585
+
584 586
         echo ''
585 587
         echo '################################################################################'
586 588
         echo $msg
587 589
         echo '################################################################################'
588
-        echo "This value will be written to your localrc file so you don't have to enter it "
590
+        echo "This value will be written to ${localrc} file so you don't have to enter it "
589 591
         echo "again.  Use only alphanumeric characters."
590 592
         echo "If you leave this blank, a random default value will be used."
591 593
         pw=" "
... ...
@@ -103,6 +103,11 @@ HORIZON_APACHE_ROOT="/dashboard"
103 103
 # be disabled for automated testing by setting this value to False.
104 104
 USE_SCREEN=True
105 105
 
106
+# Passwords generated by interactive devstack runs
107
+if [[ -r $RC_DIR/.localrc.password ]]; then
108
+    source $RC_DIR/.localrc.password
109
+fi
110
+
106 111
 # allow local overrides of env variables, including repo config
107 112
 if [[ -f $RC_DIR/localrc ]]; then
108 113
     # Old-style user-supplied config