From: Frank Brehm Date: Wed, 27 May 2020 16:34:51 +0000 (+0200) Subject: Bufixing X-Git-Tag: 2.1.2^2~9^2~31^2~101 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=4588813a512b9569dff8d4496ba97e9edec4b52e;p=pixelpark%2Fcreate-vmware-tpl.git Bufixing --- diff --git a/lib/cr_vmware_tpl/cobbler.py b/lib/cr_vmware_tpl/cobbler.py index 6cc2b7c..c554103 100644 --- a/lib/cr_vmware_tpl/cobbler.py +++ b/lib/cr_vmware_tpl/cobbler.py @@ -32,7 +32,7 @@ from .config import CrTplConfiguration from .xlate import XLATOR -__version__ = '0.3.0' +__version__ = '0.3.1' LOG = logging.getLogger(__name__) @@ -56,6 +56,11 @@ class Cobbler(BaseHandler): self, appname=None, verbose=0, version=__version__, base_dir=None, config=None, terminal_has_colors=False, simulate=None, force=None, initialized=False): + if not isinstance(config, CrTplConfiguration): + msg = _("{w} is not an instance of {c}, but an instance of {i} instead.").format( + w='Parameter config', c='CrTplConfiguration', i=config.__class__.__name__) + raise HandlerError(msg) + self.host = CrTplConfiguration.default_cobbler_host self.ssh_port = CrTplConfiguration.default_cobbler_ssh_port self.ssh_user = CrTplConfiguration.default_cobbler_ssh_user @@ -63,6 +68,7 @@ class Cobbler(BaseHandler): self.ssh = None self.ssh_timeout = CrTplConfiguration.default_cobbler_ssh_timeout self.root_dir = CrTplConfiguration.default_cobbler_rootdir + self.config = config super(Cobbler, self).__init__( appname=appname, verbose=verbose, version=version, base_dir=base_dir, @@ -72,13 +78,12 @@ class Cobbler(BaseHandler): self.private_ssh_key = str(self.base_dir.joinpath('keys', CrTplConfiguration.ssh_privkey)) - if config: - self.private_ssh_key = config.private_ssh_key - self.host = config.cobbler_host - self.ssh_port = config.cobbler_ssh_port - self.ssh_user = config.cobbler_ssh_user - self.ssh_timeout = config.cobbler_ssh_timeout - self.root_dir = config.cobbler_rootdir + self.private_ssh_key = config.private_ssh_key + self.host = config.cobbler_host + self.ssh_port = config.cobbler_ssh_port + self.ssh_user = config.cobbler_ssh_user + self.ssh_timeout = config.cobbler_ssh_timeout + self.root_dir = config.cobbler_rootdir if initialized: self.initialized = True