3 self
, spec
=None, constraints
=None, disks
=None, series
=None,
5 """Start a new, empty machine and optionally a container, or add a
6 container to a machine.
8 :param str spec: Machine specification
10 (None) - starts a new machine
11 'lxc' - starts a new machine with on lxc container
12 'lxc:4' - starts a new lxc container on machine 4
13 'ssh:user@10.10.0.3' - manually provisions a machine with ssh
14 'zone=us-east-1a' - starts a machine in zone us-east-1s on AWS
15 'maas2.name' - acquire machine maas2.name on MAAS
16 :param :class:`juju.Constraints` constraints: Machine constraints
17 :param list disks: List of disk :class:`constraints <juju.Constraints>`
18 :param str series: Series
19 :param int count: Number of machines to deploy
21 Supported container types are: lxc, lxd, kvm
23 When deploying a container to an existing machine, constraints cannot
28 add_machines
= add_machine
30 def add_relation(self
, relation1
, relation2
):
31 """Add a relation between two services.
33 :param str relation1: '<service>[:<relation_name>]'
34 :param str relation2: '<service>[:<relation_name>]'
39 def add_space(self
, name
, *cidrs
):
40 """Add a new network space.
42 Adds a new space with the given name and associates the given
43 (optional) list of existing subnet CIDRs with it.
45 :param str name: Name of the space
46 :param \*cidrs: Optional list of existing subnet CIDRs
51 def add_ssh_key(self
, key
):
52 """Add a public SSH key to this model.
54 :param str key: The public ssh key
58 add_ssh_keys
= add_ssh_key
60 def add_subnet(self
, cidr_or_id
, space
, *zones
):
61 """Add an existing subnet to this model.
63 :param str cidr_or_id: CIDR or provider ID of the existing subnet
64 :param str space: Network space with which to associate
65 :param str \*zones: Zone(s) in which the subnet resides
70 def get_backups(self
):
71 """Retrieve metadata for backups in this model.
76 def block(self
, *commands
):
77 """Add a new block to this model.
79 :param str \*commands: The commands to block. Valid values are
80 'all-changes', 'destroy-model', 'remove-object'
86 """List blocks for this model.
91 def get_cached_images(self
, arch
=None, kind
=None, series
=None):
92 """Return a list of cached OS images.
94 :param str arch: Filter by image architecture
95 :param str kind: Filter by image kind, e.g. 'lxd'
96 :param str series: Filter by image series, e.g. 'xenial'
101 def create_backup(self
, note
=None, no_download
=False):
102 """Create a backup of this model.
104 :param str note: A note to store with the backup
105 :param bool no_download: Do not download the backup archive
106 :return str: Path to downloaded archive
111 def create_storage_pool(self
, name
, provider_type
, **pool_config
):
112 """Create or define a storage pool.
114 :param str name: Name to give the storage pool
115 :param str provider_type: Pool provider type
116 :param \*\*pool_config: key/value pool configuration pairs
122 self
, no_tail
=False, exclude_module
=None, include_module
=None,
123 include
=None, level
=None, limit
=0, lines
=10, replay
=False,
125 """Get log messages for this model.
127 :param bool no_tail: Stop after returning existing log messages
128 :param list exclude_module: Do not show log messages for these logging
130 :param list include_module: Only show log messages for these logging
132 :param list include: Only show log messages for these entities
133 :param str level: Log level to show, valid options are 'TRACE',
134 'DEBUG', 'INFO', 'WARNING', 'ERROR,
135 :param int limit: Return this many of the most recent (possibly
136 filtered) lines are shown
137 :param int lines: Yield this many of the most recent lines, and keep
139 :param bool replay: Yield the entire log, and keep yielding
140 :param list exclude: Do not show log messages for these entities
146 self
, entity_url
, service_name
=None, bind
=None, budget
=None,
147 channel
=None, config
=None, constraints
=None, force
=False,
148 num_units
=1, plan
=None, resource
=None, series
=None, storage
=None,
150 """Deploy a new service or bundle.
152 :param str entity_url: Charm or bundle url
153 :param str service_name: Name to give the service
154 :param dict bind: <charm endpoint>:<network space> pairs
155 :param dict budget: <budget name>:<limit> pairs
156 :param str channel: Charm store channel from which to retrieve
157 the charm or bundle, e.g. 'development'
158 :param dict config: Charm configuration dictionary
159 :param :class:`juju.Constraints` constraints: Service constraints
160 :param bool force: Allow charm to be deployed to a machine running
161 an unsupported series
162 :param int num_units: Number of units to deploy
163 :param str plan: Plan under which to deploy charm
164 :param dict resource: <resource name>:<file path> pairs
165 :param str series: Series on which to deploy
166 :param dict storage: Storage constraints TODO how do these look?
167 :param str to: Placement directive, e.g.::
169 'lxc:7' - new lxc container on machine 7
170 '24/lxc/3' - lxc container 3 or machine 24
172 If None, a new machine is provisioned.
178 """Terminate all machines and resources for this model.
183 def get_backup(self
, archive_id
):
184 """Download a backup archive file.
186 :param str archive_id: The id of the archive to download
187 :return str: Path to the archive file
193 self
, num_controllers
=0, constraints
=None, series
=None, to
=None):
194 """Ensure sufficient controllers exist to provide redundancy.
196 :param int num_controllers: Number of controllers to make available
197 :param :class:`juju.Constraints` constraints: Constraints to apply
198 to the controller machines
199 :param str series: Series of the controller machines
200 :param list to: Placement directives for controller machines, e.g.::
202 'lxc:7' - new lxc container on machine 7
203 '24/lxc/3' - lxc container 3 or machine 24
205 If None, a new machine is provisioned.
210 def get_config(self
):
211 """Return the configuration settings for this model.
216 def get_constraints(self
):
217 """Return the machine constraints for this model.
222 def grant(self
, username
, acl
='read'):
223 """Grant a user access to this model.
225 :param str username: Username
226 :param str acl: Access control ('read' or 'write')
231 def import_ssh_key(self
, identity
):
232 """Add a public SSH key from a trusted indentity source to this model.
234 :param str identity: User identity in the form <lp|gh>:<username>
238 import_ssh_keys
= import_ssh_key
240 def get_machines(self
, utc
=False):
241 """Return list of machines in this model.
243 :param bool utc: Display time as UTC in RFC3339 format
248 def get_shares(self
):
249 """Return list of all users with access to this model.
254 def get_spaces(self
):
255 """Return list of all known spaces, including associated subnets.
260 def get_ssh_key(self
):
261 """Return known SSH keys for this model.
265 get_ssh_keys
= get_ssh_key
267 def get_storage(self
, filesystem
=False, volume
=False):
268 """Return details of storage instances.
270 :param bool filesystem: Include filesystem storage
271 :param bool volume: Include volume storage
276 def get_storage_pools(self
, names
=None, providers
=None):
277 """Return list of storage pools.
279 :param list names: Only include pools with these names
280 :param list providers: Only include pools for these providers
285 def get_subnets(self
, space
=None, zone
=None):
286 """Return list of known subnets.
288 :param str space: Only include subnets in this space
289 :param str zone: Only include subnets in this zone
294 def remove_blocks(self
):
295 """Remove all blocks from this model.
300 def remove_backup(self
, backup_id
):
303 :param str backup_id: The id of the backup to remove
308 def remove_cached_images(self
, arch
=None, kind
=None, series
=None):
309 """Remove cached OS images.
311 :param str arch: Architecture of the images to remove
312 :param str kind: Image kind to remove, e.g. 'lxd'
313 :param str series: Image series to remove, e.g. 'xenial'
318 def remove_machine(self
, *machine_ids
):
319 """Remove a machine from this model.
321 :param str \*machine_ids: Ids of the machines to remove
325 remove_machines
= remove_machine
327 def remove_ssh_key(self
, *keys
):
328 """Remove a public SSH key(s) from this model.
330 :param str \*keys: Keys to remove
334 remove_ssh_keys
= remove_ssh_key
336 def restore_backup(self
):
337 """Restore a backup archive to a new controller.
342 def retry_provisioning(self
):
343 """Retry provisioning for failed machines.
349 """Revoke a user's access to this model.
355 """Run command on all machines in this model.
360 def set_config(self
):
361 """Set configuration keys on this model.
366 def set_constraints(self
):
367 """Set machine constraints on this model.
372 def get_action_output(self
, action_uuid
):
373 """Get the results of an action by ID.
378 def get_action_status(self
, uuid_or_prefix
):
379 """Get the status of all actions, filtered by ID or prefix.
384 def get_budget(self
, budget_name
):
385 """Get budget by name.
390 def get_status(self
):
391 """Return the status of the model.
397 def sync_tools(self
):
398 """Copy Juju tools into this model.
403 def unblock(self
, operation
):
404 """Unblock an operation that would alter this model.
409 def unset_config(self
):
410 """Unset configuration on this model.
415 def upgrade_gui(self
):
416 """Upgrade the Juju GUI for this model.
421 def upload_backup(self
):
422 """Store a backup archive remotely in Juju.