aboutsummaryrefslogtreecommitdiff
path: root/kolla/cmd
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-05-25 03:59:26 +0000
committerGerrit Code Review <review@openstack.org>2016-05-25 03:59:26 +0000
commit8d7920fafeb784d983baf8b5a0858844b457aff1 (patch)
treebe65f5f466ec5a4ed9e81edde5cc56ffd39dbb15 /kolla/cmd
parentcac8b397956329df59b8bd0d7cecdbc429781baa (diff)
parente1b5b149f26df2028f65652ac0d4a9509b23fe4c (diff)
downloadkolla-8d7920fafeb784d983baf8b5a0858844b457aff1.tar.gz
kolla-8d7920fafeb784d983baf8b5a0858844b457aff1.zip
Merge "Make passwords.yml file generation configurable"
Diffstat (limited to 'kolla/cmd')
-rwxr-xr-xkolla/cmd/genpwd.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/kolla/cmd/genpwd.py b/kolla/cmd/genpwd.py
index 70dbc0357..ad77a77c0 100755
--- a/kolla/cmd/genpwd.py
+++ b/kolla/cmd/genpwd.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import argparse
import os
import random
import string
@@ -29,6 +30,15 @@ def generate_RSA(bits=2048):
def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ '-p', '--passwords', type=str,
+ default=os.path.abspath('/etc/kolla/passwords.yml'),
+ help=('Path to the passwords yml file'))
+
+ args = parser.parse_args()
+ passwords_file = os.path.expanduser(args.passwords)
+
# These keys should be random uuids
uuid_keys = ['ceph_cluster_fsid', 'rbd_secret_uuid']
@@ -41,7 +51,7 @@ def main():
# length of password
length = 40
- with open('/etc/kolla/passwords.yml', 'r') as f:
+ with open(passwords_file, 'r') as f:
passwords = yaml.load(f.read())
for k, v in passwords.items():
@@ -67,7 +77,7 @@ def main():
for n in range(length)
])
- with open('/etc/kolla/passwords.yml', 'w') as f:
+ with open(passwords_file, 'w') as f:
f.write(yaml.dump(passwords, default_flow_style=False))
if __name__ == '__main__':