aboutsummaryrefslogtreecommitdiff
path: root/kolla
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-01-03 12:50:58 +0000
committerGerrit Code Review <review@openstack.org>2017-01-03 12:50:58 +0000
commit52d8a71d485e5991997f93792513efe9c0083f53 (patch)
treea2fd3fad63229afdcd01faee92067a5d8bf68eda /kolla
parentcb7dec77349107ac0fa1988e08df91b59453e809 (diff)
parentc07d95e1afa690d8b4f28072f4d09aa760da91d8 (diff)
downloadkolla-52d8a71d485e5991997f93792513efe9c0083f53.tar.gz
kolla-52d8a71d485e5991997f93792513efe9c0083f53.zip
Merge "Clean up kolla-ansible related files from Kolla"
Diffstat (limited to 'kolla')
-rwxr-xr-xkolla/cmd/genpwd.py96
1 files changed, 0 insertions, 96 deletions
diff --git a/kolla/cmd/genpwd.py b/kolla/cmd/genpwd.py
deleted file mode 100755
index 3cc013ee3..000000000
--- a/kolla/cmd/genpwd.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import argparse
-import os
-import random
-import string
-import sys
-import yaml
-
-from Crypto.PublicKey import RSA
-from oslo_utils import uuidutils
-
-# NOTE(SamYaple): Update the search path to prefer PROJECT_ROOT as the source
-# of packages to import if we are using local tools instead of
-# pip installed kolla tools
-PROJECT_ROOT = os.path.abspath(os.path.join(
- os.path.dirname(os.path.realpath(__file__)), '../..'))
-if PROJECT_ROOT not in sys.path:
- sys.path.insert(0, PROJECT_ROOT)
-
-
-def generate_RSA(bits=4096):
- new_key = RSA.generate(bits, os.urandom)
- private_key = new_key.exportKey("PEM")
- public_key = new_key.publickey().exportKey("OpenSSH")
- return private_key, public_key
-
-
-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',
- 'gnocchi_project_id', 'gnocchi_resource_id',
- 'gnocchi_user_id']
-
- # SSH key pair
- ssh_keys = ['kolla_ssh_key', 'nova_ssh_key',
- 'keystone_ssh_key', 'bifrost_ssh_key']
-
- # If these keys are None, leave them as None
- blank_keys = ['docker_registry_password']
-
- # length of password
- length = 40
-
- with open(passwords_file, 'r') as f:
- passwords = yaml.safe_load(f.read())
-
- for k, v in passwords.items():
- if (k in ssh_keys and
- (v is None
- or v.get('public_key') is None
- and v.get('private_key') is None)):
- private_key, public_key = generate_RSA()
- passwords[k] = {
- 'private_key': private_key,
- 'public_key': public_key
- }
- continue
- if v is None:
- if k in blank_keys and v is None:
- continue
- if k in uuid_keys:
- passwords[k] = uuidutils.generate_uuid()
- else:
- passwords[k] = ''.join([
- random.SystemRandom().choice(
- string.ascii_letters + string.digits)
- for n in range(length)
- ])
-
- with open(passwords_file, 'w') as f:
- f.write(yaml.dump(passwords, default_flow_style=False))
-
-if __name__ == '__main__':
- main()