import pytz
# Own modules
+
+from fb_tools.obj import FbBaseObject
+
from fb_tools.config import ConfigError, BaseConfiguration
from fb_tools.common import to_bool, RE_FQDN
from .xlate import XLATOR
-__version__ = '1.1.5'
+__version__ = '1.2.1'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
pass
+# =============================================================================
+class VsphereConfig(FbBaseObject):
+ """Class for encapsulation of config data of a connection to a VSPhere center."""
+
+ default_port = 443
+ default_user = 'Administrator@vsphere.local'
+ default_dc = 'vmcc'
+ default_cluster = 'vmcc-l105-01'
+
+ default_template_name = 'oracle-linux-7-template'
+
+ # -------------------------------------------------------------------------
+ def __init__(
+ self, appname=None, verbose=0, version=__version__, base_dir=None, name=None,
+ host=None, port=None, user=None, password=None, dc=None, cluster=None,
+ template_name=None, initialized=False):
+
+ self._name = None
+ self._host = None
+ self._port = self.default_port
+ self._user = self.default_user
+ self._password = None
+ self._dc = self.default_dc
+ self._cluster = self.default_cluster
+ self._template_name = self.default_template_name
+
+ super(VsphereConfig, self).__init__(
+ appname=appname, verbose=verbose, version=version,
+ base_dir=base_dir, initialized=False,
+ )
+
+ if name is not None:
+ self.name = name
+ if host is not None:
+ self.host = host
+ if port is not None:
+ self.port = port
+ if user is not None:
+ self.user = user
+ if password is not None:
+ self.password = password
+ if dc is not None:
+ self.dc = dc
+ if cluster is not None:
+ self.cluster = cluster
+ if template_name is not None:
+ self.template_name = template_name
+
+ if initialized:
+ self.initialized = True
+
+
# =============================================================================
class CrTfConfiguration(BaseConfiguration):
"""
and methods to read it from configuration files.
"""
- default_vsphere_host = 'vcs01.ppbrln.internal'
default_vsphere_port = 443
default_vsphere_user = 'Administrator@vsphere.local'
default_vsphere_dc = 'vmcc'
default_vsphere_cluster = 'vmcc-l105-01'
+
default_template_name = 'oracle-linux-7-template'
+
default_pdns_master_server = 'master.pp-dns.com'
default_pdns_api_port = DEFAULT_PDNS_API_PORT
default_pdns_api_use_https = bool(DEFAULT_PDNS_API_USE_HTTPS)