Merge "Enable upgrade script to create platform certs"
This commit is contained in:
commit
613cdfd931
|
@ -6,15 +6,9 @@
|
||||||
# This script creates required platform certificates for DX systems.
|
# This script creates required platform certificates for DX systems.
|
||||||
# SX systems leverage the execution ansible upgrade playbook for this.
|
# SX systems leverage the execution ansible upgrade playbook for this.
|
||||||
#
|
#
|
||||||
# Note: A file is used as temporary feature flag for
|
|
||||||
# https://storyboard.openstack.org/#!/story/2009811
|
|
||||||
# to avoid interfering with current behavior before the feature is
|
|
||||||
# completed (see variable 'feature_flag').
|
|
||||||
#
|
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
|
||||||
from controllerconfig.common import log
|
from controllerconfig.common import log
|
||||||
LOG = log.get_logger(__name__)
|
LOG = log.get_logger(__name__)
|
||||||
|
|
||||||
|
@ -30,12 +24,13 @@ def get_system_mode():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def create_platform_certificates():
|
def create_platform_certificates(to_release):
|
||||||
"""Run ansible playbook to create platform certificates
|
"""Run ansible playbook to create platform certificates
|
||||||
"""
|
"""
|
||||||
playbooks_root = '/usr/share/ansible/stx-ansible/playbooks'
|
playbooks_root = '/usr/share/ansible/stx-ansible/playbooks'
|
||||||
upgrade_script = 'create-platform-certificates-in-upgrade.yml'
|
upgrade_script = 'create-platform-certificates-in-upgrade.yml'
|
||||||
cmd = 'ansible-playbook {}/{}'.format(playbooks_root, upgrade_script)
|
cmd = 'ansible-playbook {}/{} -e "software_version={}"'.format(
|
||||||
|
playbooks_root, upgrade_script, to_release)
|
||||||
sub = subprocess.Popen(cmd, shell=True,
|
sub = subprocess.Popen(cmd, shell=True,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
stdout, stderr = sub.communicate()
|
stdout, stderr = sub.communicate()
|
||||||
|
@ -67,13 +62,7 @@ def main():
|
||||||
arg += 1
|
arg += 1
|
||||||
log.configure()
|
log.configure()
|
||||||
|
|
||||||
# Temporary feature flag file
|
if (action == 'activate' and from_release == '22.12'):
|
||||||
config_dir = '/opt/platform/config/' + to_release
|
|
||||||
feature_flag = config_dir + '/.create_platform_certificates'
|
|
||||||
|
|
||||||
if (action == 'activate' and
|
|
||||||
from_release == '22.12' and
|
|
||||||
os.path.exists(feature_flag)):
|
|
||||||
LOG.info("%s invoked with from_release = %s to_release = %s "
|
LOG.info("%s invoked with from_release = %s to_release = %s "
|
||||||
"action = %s"
|
"action = %s"
|
||||||
% (sys.argv[0], from_release, to_release, action))
|
% (sys.argv[0], from_release, to_release, action))
|
||||||
|
@ -85,7 +74,7 @@ def main():
|
||||||
% (sys.argv[0], mode))
|
% (sys.argv[0], mode))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
create_platform_certificates()
|
create_platform_certificates(to_release)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue