コード例 #1
0
    def __init__(self) -> None:
        """Initialize a MultipassCommand instance.

        :raises errors.ProviderCommandNotFound:
            if the multipass command is not found.
        """
        provider_cmd = "multipass"
        if not shutil.which(provider_cmd):
            raise errors.ProviderCommandNotFound(command=provider_cmd)
        self.provider_cmd = provider_cmd
コード例 #2
0
    def __init__(self) -> None:
        """Initialize a MultipassCommand instance.

        :raises errors.ProviderCommandNotFound:
            if the multipass command is not found.
        """
        provider_cmd = "multipass"
        if not shutil.which(provider_cmd):
            raise errors.ProviderCommandNotFound(command=provider_cmd)
        self.provider_cmd = provider_cmd
        # Workaround for https://github.com/CanonicalLtd/multipass/issues/221
        signal.signal(signal.SIGUSR1, _ignore_signal)
コード例 #3
0
ファイル: _qemu_driver.py プロジェクト: touilleMan/snapcraft
    def __init__(self, *, ssh_username: str, ssh_key_file: str) -> None:
        """Initialize a QemuDriver instance.

        :raises errors.ProviderCommandNotFound:
            if the relevant qemu command is not found.
        """
        provider_cmd = _get_qemu_command()
        if not shutil.which(provider_cmd):
            raise errors.ProviderCommandNotFound(command=provider_cmd)
        self.provider_cmd = provider_cmd
        # TODO detect collisions and make dynamic
        self._telnet_port = 64444
        # TODO detect collisions and make dynamic
        self._ssh_port = 5555
        self._ssh_username = ssh_username
        self._ssh_key_file = ssh_key_file
        self._qemu_proc = None  # type: subprocess.Popen
        self._ssh_client = paramiko.SSHClient()
        self._ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())