diff options
| author | Vladislav Belogrudov <vladislav.belogrudov@oracle.com> | 2016-11-25 15:52:03 +0300 |
|---|---|---|
| committer | Vladislav Belogrudov <vladislav.belogrudov@oracle.com> | 2016-11-28 12:22:55 +0300 |
| commit | 14f9246fcdcd7c9428d3e837eeb66a06adb68bce (patch) | |
| tree | ad7672332257ae099f31cde4ccf68930cedda33b | |
| parent | 4aa693f2fd4c445fb4b63a40533c0bc2462bd653 (diff) | |
| download | kolla-ansible-14f9246fcdcd7c9428d3e837eeb66a06adb68bce.tar.gz kolla-ansible-14f9246fcdcd7c9428d3e837eeb66a06adb68bce.zip | |
Add tool to merge passwords during release upgrade
Typical usage:
cp /etc/kolla/passwords.yml /etc/kolla/passwords.yml.old
kolla-genpwd
kolla-mergepwd --old /etc/kolla/passwords.yml.old \
--new /etc/kolla/passwords.yml \
--final /etc/kolla/passwords.yml
Change-Id: Ibbc598909e28e096145841aec929d0cfcf8f7cab
Implements: blueprint kolla-merge-passwords
| -rwxr-xr-x | kolla/cmd/mergepwd.py | 39 | ||||
| -rw-r--r-- | setup.cfg | 1 | ||||
| l--------- | tools/merge_passwords.py | 1 |
3 files changed, 41 insertions, 0 deletions
diff --git a/kolla/cmd/mergepwd.py b/kolla/cmd/mergepwd.py new file mode 100755 index 000000000..b8fde1c77 --- /dev/null +++ b/kolla/cmd/mergepwd.py @@ -0,0 +1,39 @@ +#!/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 yaml + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--old", help="old password file", required=True) + parser.add_argument("--new", help="new password file", required=True) + parser.add_argument("--final", help="merged password file", required=True) + args = parser.parse_args() + + with open(args.old, "r") as old_file: + old_passwords = yaml.safe_load(old_file) + + with open(args.new, "r") as new_file: + new_passwords = yaml.safe_load(new_file) + + new_passwords.update(old_passwords) + + with open(args.final, "w") as destination: + yaml.dump(new_passwords, destination) + + +if __name__ == '__main__': + main() @@ -43,6 +43,7 @@ scripts = console_scripts = kolla-build = kolla.cmd.build:main kolla-genpwd = kolla.cmd.genpwd:main + kolla-mergepwd = kolla.cmd.mergepwd:main oslo.config.opts = kolla = kolla.opts:list_opts diff --git a/tools/merge_passwords.py b/tools/merge_passwords.py new file mode 120000 index 000000000..ce2431d00 --- /dev/null +++ b/tools/merge_passwords.py @@ -0,0 +1 @@ +../kolla/cmd/mergepwd.py
\ No newline at end of file |
