From 29e99290d82bc7b442cdfdecb4048c61d5b07b43 Mon Sep 17 00:00:00 2001 From: "cao.yuan" Date: Mon, 22 Jul 2019 23:28:22 +0800 Subject: [PATCH] Move the password check into precheck action to keep consistence with kolla-ansible and kolla-ansible check the password in prechecks role. Change-Id: I07a9fbd6a82b9997a8224a2899adf267d92811bc --- kolla_cli/common/ansible/actions.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/kolla_cli/common/ansible/actions.py b/kolla_cli/common/ansible/actions.py index d739a0e..be83199 100644 --- a/kolla_cli/common/ansible/actions.py +++ b/kolla_cli/common/ansible/actions.py @@ -98,6 +98,17 @@ class KollaAction(object): def precheck(self, hostnames): '''run check playbooks on a set of hosts''' + # check that password file has no empty password values + empty_keys = get_empty_password_values() + if empty_keys: + raise InvalidConfiguration( + u._('Deploy failed. There are empty password values ' + 'in {etc}passwords.yml. ' + 'Please run kolla-cli password init or ' + 'kolla-cli password set(key) to correct them. ' + '\nEmpty passwords: ' + '{keys}').format(etc=get_kolla_etc(), keys=empty_keys)) + # define 'hosts' to be all, but inventory filtering will subset # that down to the hosts in playbook.hosts. self.playbook.hosts = hostnames @@ -170,17 +181,6 @@ def _run_deploy_rules(playbook): properties = AnsibleProperties() inventory = Inventory.load() - # check that password file has no empty password values - empty_keys = get_empty_password_values() - if empty_keys: - raise InvalidConfiguration( - u._('Deploy failed. There are empty password values ' - 'in {etc}passwords.yml. ' - 'Please run kolla-cli password init or ' - 'kolla-cli password set(key) to correct them. ' - '\nEmpty passwords: ' - '{keys}').format(etc=get_kolla_etc(), keys=empty_keys)) - # cannot have both groups and hosts if playbook.hosts and playbook.groups: raise InvalidArgument(