Skip to content
Snippets Groups Projects
Commit 85b5863e authored by sguazt's avatar sguazt
Browse files

Openstack: code refactoring to avoid duplication. Chameleon: code refactoring to avoid duplication.

parent 331cb864
No related branches found
No related tags found
No related merge requests found
"""
Openstack configuration manager
"""
from easycloud.common.openstack import OpenStackBaseConfManager
from easycloud.core.metaconfmanager import MetaConfManager
import logging
__author__ = "Davide Monfrecola, Stefano Garione, Giorgio Gambino, Luca Banzato"
__copyright__ = "Copyright (C) 2019"
__credits__ = ["Andrea Lombardo", "Irene Lovotti"]
__license__ = "GPL v3"
__version__ = "0.10.0"
__maintainer__ = "Luca Banzato"
__email__ = "20005492@studenti.uniupo.it"
__status__ = "Prototype"
class ChameleonCloudConfManager(MetaConfManager):
class ChameleonCloudConfManager(OpenStackBaseConfManager):
"""
Chamaleon Cloud configuration manager.
"""
def __init__(self, config_file=None):
"""
Init method (object initialization)
"""
super().__init__("chameleon_libcloud", config_file)
def read_login_data(self):
"""
Read login data from settings.cfg
"""
# URL Regex took from http://www.noah.org/wiki/RegEx_Python#URL_regex_pattern
self.os_auth_url = self.get_parameter("openstack", "os_auth_url",
return_type=str,
regex="http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+")
self.os_username = self.get_parameter("openstack", "os_username", return_type=str)
self.os_password = self.get_parameter("openstack", "os_password", return_type=str)
self.os_project_name = self.get_parameter("openstack", "os_project_name", return_type=str)
self.os_project_id = self.get_parameter("openstack", "os_project_id", return_type=str)
self.os_region = self.get_parameter("openstack", "os_region", return_type=str)
logging.debug("OpenStack login data read")
def read_platform_options(self):
self.demo_reservation_id = self.get_parameter("re_demo", "demo_reservation_id", return_type=str)
"""
Read platform-specific options from settings.cfg
"""
# Nothing to do here
pass
"""
Openstack configuration manager
"""
from easycloud.common.openstack import OpenStackBaseConfManager
from easycloud.core.metaconfmanager import MetaConfManager
import logging
__author__ = "Davide Monfrecola, Stefano Garione, Giorgio Gambino, Luca Banzato"
__copyright__ = "Copyright (C) 2019"
__credits__ = ["Andrea Lombardo", "Irene Lovotti"]
__license__ = "GPL v3"
__version__ = "0.10.0"
__maintainer__ = "Luca Banzato"
__email__ = "20005492@studenti.uniupo.it"
__status__ = "Prototype"
class ChameleonCloudConfManager(MetaConfManager):
class ChameleonCloudConfManager(OpenStackBaseConfManager):
"""
Chamaleon Cloud configuration manager.
"""
def __init__(self, config_file=None):
"""
Init method (object initialization)
"""
super().__init__("chameleon_openstacksdk", config_file)
def read_login_data(self):
"""
Read login data from settings.cfg
"""
# URL Regex took from http://www.noah.org/wiki/RegEx_Python#URL_regex_pattern
self.os_auth_url = self.get_parameter("openstack", "os_auth_url",
return_type=str,
regex="http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+")
self.os_username = self.get_parameter("openstack", "os_username", return_type=str)
self.os_password = self.get_parameter("openstack", "os_password", return_type=str)
self.os_project_name = self.get_parameter("openstack", "os_project_name", return_type=str)
self.os_project_id = self.get_parameter("openstack", "os_project_id", return_type=str)
self.os_region = self.get_parameter("openstack", "os_region", return_type=str)
#logging.debug("OpenStack login data read")
def read_platform_options(self):
self.demo_reservation_id = self.get_parameter("re_demo", "demo_reservation_id", return_type=str)
"""
Read platform-specific options from settings.cfg
"""
# Nothing to do here
pass
"""
OpenStack configuration manager
"""
from easycloud.common.openstack import OpenStackBaseConfManager
__author__ = "Davide Monfrecola, Stefano Garione, Giorgio Gambino, Luca Banzato"
__copyright__ = "Copyright (C) 2019"
__credits__ = ["Andrea Lombardo", "Irene Lovotti"]
__license__ = "GPL v3"
__version__ = "0.10.0"
__maintainer__ = "Luca Banzato"
__email__ = "20005492@studenti.uniupo.it"
__status__ = "Prototype"
class OpenStackConfManager(OpenStackBaseConfManager):
"""
OpenStack configuration manager
"""
from easycloud.core.metaconfmanager import MetaConfManager
import logging
class OpenStackConfManager(MetaConfManager):
def __init__(self):
def __init__(self, config_file=None):
"""
Init method (object initialization)
"""
super().__init__("openstack_libcloud")
def read_login_data(self):
"""
Read login data from settings.cfg
"""
# URL Regex took from http://www.noah.org/wiki/RegEx_Python#URL_regex_pattern
self.os_auth_url = self.get_parameter("openstack", "os_auth_url",
return_type=str,
regex="http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+")
self.os_username = self.get_parameter("openstack", "os_username", return_type=str)
self.os_password = self.get_parameter("openstack", "os_password", return_type=str)
self.os_project_name = self.get_parameter("openstack", "os_project_name", return_type=str)
self.os_project_id = self.get_parameter("openstack", "os_project_id", return_type=str)
self.os_region = self.get_parameter("openstack", "os_region", return_type=str)
self.os_telemetry_metering = self.get_parameter("openstack", "os_telemetry_metering", return_type=str)
logging.debug("OpenStack login data read")
def read_platform_options(self):
self.demo_reservation_id = self.get_parameter("re_demo", "demo_reservation_id", return_type=str)
"""
Read platform-specific options from settings.cfg
"""
# Nothing to do here
pass
super().__init__("openstack_libcloud", config_file)
#def read_login_data(self):
# """
# Read login data from settings.cfg
# """
# super().read_login_data();
# self.os_telemetry_metering = self.get_parameter("openstack", "os_telemetry_metering", return_type=str)
"""
OpenStack configuration manager
"""
from easycloud.common.openstack import OpenStackBaseConfManager
__author__ = "Davide Monfrecola, Stefano Garione, Giorgio Gambino, Luca Banzato"
__copyright__ = "Copyright (C) 2019"
__credits__ = ["Andrea Lombardo", "Irene Lovotti"]
__license__ = "GPL v3"
__version__ = "0.10.0"
__maintainer__ = "Luca Banzato"
__email__ = "20005492@studenti.uniupo.it"
__status__ = "Prototype"
from easycloud.core.metaconfmanager import MetaConfManager
import logging
class OpenStackConfManager(MetaConfManager):
class OpenStackConfManager(OpenStackBaseConfManager):
"""
OpenStack configuration manager
"""
def __init__(self):
"""
......@@ -24,26 +11,9 @@ class OpenStackConfManager(MetaConfManager):
"""
super().__init__("openstack_openstacksdk")
def read_login_data(self):
"""
Read login data from settings.cfg
"""
# URL Regex took from http://www.noah.org/wiki/RegEx_Python#URL_regex_pattern
self.os_auth_url = self.get_parameter("openstack", "os_auth_url",
return_type=str,
regex="http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+")
self.os_username = self.get_parameter("openstack", "os_username", return_type=str)
self.os_password = self.get_parameter("openstack", "os_password", return_type=str)
self.os_project_name = self.get_parameter("openstack", "os_project_name", return_type=str)
self.os_project_id = self.get_parameter("openstack", "os_project_id", return_type=str)
self.os_region = self.get_parameter("openstack", "os_region", return_type=str)
self.os_telemetry_metering = self.get_parameter("openstack", "os_telemetry_metering", return_type=str)
logging.debug("OpenStack login data read")
def read_platform_options(self):
self.demo_reservation_id = self.get_parameter("re_demo", "demo_reservation_id", return_type=str)
"""
Read platform-specific options from settings.cfg
"""
# Nothing to do here
pass
#def read_login_data(self):
# """
# Read login data from settings.cfg
# """
# super().read_login_data();
# self.os_telemetry_metering = self.get_parameter("openstack", "os_telemetry_metering", return_type=str)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment