Files
test/config/openstack/objects/openstack_config.py
Sandeep Kapur 567bb957d7 Finalize Install, Uninstall, Version retrieval of openstack application
Change-Id: Iccdc2128b48ed752b0ca12ea9887b81cfbbc1509
Signed-off-by: Sandeep Kapur <sandeep.kapur@windriver.com>
2025-05-15 10:11:54 -04:00

62 lines
1.5 KiB
Python

from typing import List
import json5
from config.openstack.objects.custom_installer import CustomInstaller
from config.openstack.objects.remote_installer import RemoteInstaller
class OpenstackConfig:
"""
Class to hold configuration of the openstack
"""
def __init__(self, config):
try:
json_data = open(config)
except FileNotFoundError:
print(f"Could not find the openstack config file: {config}")
raise
openstack_dict = json5.load(json_data)
self.app_name = openstack_dict['app_name']
self.version_cmd = openstack_dict['version_cmd']
self.custom_config = CustomInstaller(openstack_dict["custom"])
self.remote_config = RemoteInstaller(openstack_dict["remote"])
def get_app_name(self) :
"""
Getter for the application name.
Returns: the application name.
"""
return self.app_name
def get_version_cmd(self) :
"""
Getter for the application version command with file path.
Returns: the command for retrieving application version.
"""
return self.version_cmd
def get_custom_config(self) -> CustomInstaller:
"""
Getter for the custom config object.
Returns: the custom config object.
"""
return self.custom_config
def get_remote_config(self) -> RemoteInstaller:
"""
Getter for the remote config object.
Returns: the custom config object.
"""
return self.remote_config