Skip to content

Commit

Permalink
Fix call of mariadb backup role (#767)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt authored Jan 17, 2024
1 parent 76e5064 commit d37bd82
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
2 changes: 2 additions & 0 deletions osism/core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"refstack": {"environment": "openstack", "runtime": "osism-ansible"},
"system-encoding": {"environment": "generic", "runtime": "osism-ansible"},
"ulimits": {"environment": "generic", "runtime": "osism-ansible"},
"mariadb-backup": {"environment": "kolla", "runtime": "kolla-ansible"},
"mariadb-recovery": {"environment": "kolla", "runtime": "kolla-ansible"},
}

MAP_ROLE2ROLE = {
Expand Down
41 changes: 22 additions & 19 deletions osism/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
from pathlib import Path
import re
import subprocess
import time

Expand Down Expand Up @@ -108,26 +109,28 @@ def run_ansible_in_environment(
if locking:
lock.acquire()

if role == "mariadb_backup":
command = f"/run.sh backup {role} {joined_arguments}"
logger.info(f"RUN {command}")
p = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True,
env=env,
)
if role in ["mariadb-backup", "mariadb_backup"]:
action = "backup"
role = "mariadb"
# Hacky workaround. The handling of kolla_action will be revised in the future.
joined_arguments = re.sub(joined_arguments, "", "-e kolla_action=deploy")
elif role in ["mariadb-recovery", "mariadb_recovery"]:
action = "recovery"
role = "mariadb"
# Hacky workaround. The handling of kolla_action will be revised in the future.
joined_arguments = re.sub(joined_arguments, "", "-e kolla_action=deploy")
else:
command = f"/run.sh deploy {role} {joined_arguments}"
logger.info(f"RUN {command}")
p = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True,
env=env,
)
action = "deploy"

command = f"/run.sh {action} {role} {joined_arguments}"
logger.info(f"RUN {command}")
p = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True,
env=env,
)

# execute roles from ceph-ansible
elif worker == "ceph-ansible":
Expand Down

0 comments on commit d37bd82

Please sign in to comment.