4d75484ccf639fb54ba592b6cca4a47d49e3ae99
4 class Unit(model
.ModelEntity
):
5 def add_storage(self
, name
, constraints
=None):
6 """Add unit storage dynamically.
8 :param str name: Storage name, as specified by the charm
9 :param str constraints: Comma-separated list of constraints in the
10 form 'POOL,COUNT,SIZE'
15 def collect_metrics(self
):
16 """Collect metrics on this unit.
28 def get_resources(self
, details
=False):
29 """Return resources for this unit.
31 :param bool details: Include detailed info about resources used by each
37 def resolved(self
, retry
=False):
38 """Mark unit errors resolved.
40 :param bool retry: Re-execute failed hooks
45 def run(self
, command
, timeout
=None):
46 """Run command on this unit.
48 :param str command: The command to run
49 :param int timeout: Time to wait before command is considered failed
54 def run_action(self
, action_name
, **params
):
55 """Run action on this unit.
57 :param str action_name: Name of action to run
58 :param \*\*params: Action parameters
64 self
, source_path
, user
=None, destination_path
=None, proxy
=False,
66 """Transfer files to this unit.
68 :param str source_path: Path of file(s) to transfer
69 :param str user: Remote username
70 :param str destination_path: Destination of transferred files on
72 :param bool proxy: Proxy through the Juju API server
73 :param str scp_opts: Additional options to the `scp` command
78 def set_meter_status(self
):
79 """Set the meter status on this unit.
85 self
, command
, user
=None, proxy
=False, ssh_opts
=None):
86 """Execute a command over SSH on this unit.
88 :param str command: Command to execute
89 :param str user: Remote username
90 :param bool proxy: Proxy through the Juju API server
91 :param str ssh_opts: Additional options to the `ssh` command
96 def status_history(self
, num
=20, utc
=False):
97 """Get status history for this unit.
99 :param int num: Size of history backlog
100 :param bool utc: Display time as UTC in RFC3339 format