Check if the user is root.

Before try to create the symlink check if the user is root.

Change-Id: I869c3e6a3eadaf33bdab2745635e9db23dfc8cbb
Partial-Bug: #1816446
This commit is contained in:
Natal Ngétal 2019-02-18 16:08:12 +01:00
parent 828cfe02bb
commit 03df1ffe75
1 changed files with 12 additions and 10 deletions

View File

@ -107,16 +107,18 @@ class Deploy(command.Command):
python_cmd = "python{}".format(python_version)
# https://bugs.launchpad.net/tripleo/+bug/1812837
if not os.path.exists('/usr/bin/ansible-playbook'):
if os.path.exists('/usr/bin/' + ansible_playbook_cmd):
if not os.path.exists('/usr/local/bin/ansible-playbook'):
os.symlink('/usr/bin/' + ansible_playbook_cmd,
'/usr/local/bin/ansible-playbook')
else:
if not os.path.exists('/usr/bin/' + ansible_playbook_cmd):
if not os.path.exists('/usr/local/bin/' + ansible_playbook_cmd):
os.symlink('/usr/bin/ansible-playbook',
'/usr/local/bin/' + ansible_playbook_cmd)
if os.getuid() == 0:
if not os.path.exists('/usr/bin/ansible-playbook'):
if os.path.exists('/usr/bin/' + ansible_playbook_cmd):
if not os.path.exists('/usr/local/bin/ansible-playbook'):
os.symlink('/usr/bin/' + ansible_playbook_cmd,
'/usr/local/bin/ansible-playbook')
else:
if not os.path.exists('/usr/bin/' + ansible_playbook_cmd):
if not os.path.exists(
'/usr/local/bin/' + ansible_playbook_cmd):
os.symlink('/usr/bin/ansible-playbook',
'/usr/local/bin/' + ansible_playbook_cmd)
def _is_undercloud_deploy(self, parsed_args):
return parsed_args.standalone_role == 'Undercloud' and \