Run nova-manage as root to prevent wrong nova-manage.log permissions

To verify if the default cell is created we run a nova-manage command.
Right now this is triggered as root and not as nova like the otheres.
In case it is the first time on the node it creates the nova-manage.log
with root user and follow up call as nova user will fail.

Related-bug: 1820590

Change-Id: I56a961615c0afa748a42c25d4614637275b7c33b
(cherry picked from commit 08015d6f91)
This commit is contained in:
Martin Schuppert 2019-04-26 15:35:33 +02:00
parent 3911fe71b1
commit 4a6ba2bbaa
1 changed files with 1 additions and 1 deletions

View File

@ -310,7 +310,7 @@ outputs:
str_replace:
template: |
#!/bin/bash
DEFID=$(nova-manage cell_v2 list_cells | sed -e '1,3d' -e '$d' | awk -F ' *| *' '$2 == "default" {print $4}')
DEFID=$(su nova -s /bin/bash -c "nova-manage cell_v2 list_cells" | sed -e '1,3d' -e '$d' | awk -F ' *| *' '$2 == "default" {print $4}')
if [ "$DEFID" ]; then
echo "(cellv2) Updating default cell_v2 cell $DEFID"
su nova -s /bin/bash -c "/usr/bin/nova-manage cell_v2 update_cell --cell_uuid $DEFID --name=default --database_connection='CELLDB' --transport-url='TRANSPORTURL'"