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
This commit is contained in:
cao.yuan 2019-07-22 23:28:22 +08:00
parent 81a8a22d9a
commit 29e99290d8

View File

@ -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(