def provision_machine(self):
        """Perform the initial provisioning of the target machine.

        :return: bool: The client.AddMachineParams
        :raises: :class:`paramiko.ssh_exception.AuthenticationException`
            if the upload fails
        """
        params = client.AddMachineParams()

        if self._init_ubuntu_user():
            try:

                ssh = self._get_ssh_client(
                    self.host,
                    self.user,
                    self.private_key_path
                )

                hw = self._detect_hardware_and_os(ssh)
                params.series = hw['series']
                params.instance_id = "manual:{}".format(self.host)
                params.nonce = "manual:{}:{}".format(
                    self.host,
                    str(uuid.uuid4()),  # a nop for Juju w/manual machines
                )
                params.hardware_characteristics = {
                    'arch': hw['arch'],
                    'mem': int(hw['mem']),
                    'cpu-cores': int(hw['cpu-cores']),
                }
                params.addresses = [{
                    'value': self.host,
                    'type': 'ipv4',
                    'scope': 'public',
                }]

            except paramiko.ssh_exception.AuthenticationException as e:
                raise e
            finally:
                ssh.close()

        return params
def provision_machine ( self ) : params = client . AddMachineParams ( ) if self . _init_ubuntu_user ( ) : try : ssh = self . _get_ssh_client ( self . host , self . user , self . private_key_path ) hw = self . _detect_hardware_and_os ( ssh ) params . series = hw [ 'series' ] params . instance_id = "manual:{}" . format ( self . host ) params . nonce = "manual:{}:{}" . format ( self . host , str ( uuid . uuid4 ( ) ) , ) params . hardware_characteristics = { 'arch' : hw [ 'arch' ] , 'mem' : int ( hw [ 'mem' ] ) , 'cpu-cores' : int ( hw [ 'cpu-cores' ] ) , } params . addresses = [ { 'value' : self . host , 'type' : 'ipv4' , 'scope' : 'public' , } ] except paramiko . ssh_exception . AuthenticationException as e : raise e finally : ssh . close ( ) return params
Perform the initial provisioning of the target machine.

        :return: bool: The client.AddMachineParams
        :raises: :class:`paramiko.ssh_exception.AuthenticationException`
            if the upload fails