4 from .client
import client
6 log
= logging
.getLogger(__name__
)
9 class Machine(model
.ModelEntity
):
10 async def destroy(self
, force
=False):
11 """Remove this machine from the model.
14 facade
= client
.ClientFacade()
15 facade
.connect(self
.connection
)
18 'Destroying machine %s', self
.id)
20 return await facade
.DestroyMachines(force
, [self
.id])
23 def run(self
, command
, timeout
=None):
24 """Run command on this machine.
26 :param str command: The command to run
27 :param int timeout: Time to wait before command is considered failed
33 self
, source_path
, user
=None, destination_path
=None, proxy
=False,
35 """Transfer files to this machine.
37 :param str source_path: Path of file(s) to transfer
38 :param str user: Remote username
39 :param str destination_path: Destination of transferred files on
41 :param bool proxy: Proxy through the Juju API server
42 :param str scp_opts: Additional options to the `scp` command
48 self
, command
, user
=None, proxy
=False, ssh_opts
=None):
49 """Execute a command over SSH on this machine.
51 :param str command: Command to execute
52 :param str user: Remote username
53 :param bool proxy: Proxy through the Juju API server
54 :param str ssh_opts: Additional options to the `ssh` command
59 def status_history(self
, num
=20, utc
=False):
60 """Get status history for this machine.
62 :param int num: Size of history backlog
63 :param bool utc: Display time as UTC in RFC3339 format