juju.machine

Summary

Machine

Methods:

Reference

class juju.machine.Machine(*args, **kwargs)[source]

Bases: ModelEntity

property addresses: List[str]

Returns the machine addresses.

property agent_status

Returns the current Juju agent status string.

property agent_status_since

Get the time when the agent_status was last updated.

property agent_version

Get the version of the Juju machine agent.

May return None if the agent is not yet available.

coroutine destroy(force=False)[source]

Remove this machine from the model.

Blocks until the machine is actually removed.

property dns_name

Get the DNS name for this machine. This is a best guess based on the addresses available in current data.

May return None if no suitable address is found.

coroutine get_annotations()[source]

Get annotations on this machine.

Return dict:

The annotations for this application

property hostname

Get the hostname for this machine as reported by the machine agent running on it. This is only supported on 2.8.10+ controllers.

May return None if no hostname information is available.

coroutine remove(force=False)

Remove this machine from the model.

Blocks until the machine is actually removed.

coroutine scp_from(source, destination, user='ubuntu', proxy=False, scp_opts='', wait_for_active=False, timeout=None)[source]

Transfer files from this machine.

Parameters:
  • source (str) – Remote path of file(s) to transfer

  • destination (str) – Local destination of transferred files

  • user (str) – Remote username

  • proxy (bool) – Proxy through the Juju API server

  • scp_opts (str or list) – Additional options to the scp command

  • wait_for_active (bool) – Wait until the machine is ready to take in ssh commands.

  • timeout (int) – Time in seconds to wait until the machine becomes ready.

coroutine scp_to(source, destination, user='ubuntu', proxy=False, scp_opts='', wait_for_active=False, timeout=None)[source]

Transfer files to this machine.

Parameters:
  • source (str) – Local path of file(s) to transfer

  • destination (str) – Remote destination of transferred files

  • user (str) – Remote username

  • proxy (bool) – Proxy through the Juju API server

  • scp_opts (str or list) – Additional options to the scp command

  • wait_for_active (bool) – Wait until the machine is ready to take in ssh commands.

  • timeout (int) – Time in seconds to wait until the machine becomes ready.

property series

Returns the series of the current machine

coroutine set_annotations(annotations)[source]

Set annotations on this machine.

Parameters:

map[string]string (annotations) – the annotations as key/value pairs.

coroutine ssh(command, user='ubuntu', proxy=False, ssh_opts=None, wait_for_active=False, timeout=None)[source]

Execute a command over SSH on this machine.

Parameters:
  • command (str) – Command to execute

  • user (str) – Remote username

  • proxy (bool) – Proxy through the Juju API server

  • ssh_opts (str) – Additional options to the ssh command

  • wait_for_active (bool) – Wait until the machine is ready to take in ssh commands.

  • timeout (int) – Time in seconds to wait until the machine becomes ready.

property status

Returns the current machine provisioning status string.

property status_message

Returns the current machine provisioning status message.

property status_since

Get the time when the status was last updated.

property tag