class juju.utils.Addrs(*args, **kwargs)[source]

Bases: pyasn1.type.univ.SequenceOf

componentType = <PrintableString schema object, tagSet <TagSet object, tags 0:0:19>, encoding us-ascii>
class juju.utils.IdQueue(maxsize=0, *, loop=None)[source]

Bases: object

Wrapper around asyncio.Queue that maintains a separate queue for each ID.

coroutine get(id)[source]
coroutine put(id, value)[source]
coroutine put_all(value)[source]
class juju.utils.RegistrationInfo(**kwargs)[source]

Bases: pyasn1.type.univ.Sequence

ASN.1 representation of:

type RegistrationInfo struct { User string

Addrs []string

SecretKey []byte

ControllerName string


coroutine juju.utils.block_until(*conditions, timeout=None, wait_period=0.5, loop=None)[source]

Return only after all conditions are true.

coroutine juju.utils.execute_process(*cmd, log=None, loop=None)[source]

Wrapper around asyncio.create_subprocess_exec.

juju.utils.generate_user_controller_access_token(username, controller_endpoints, secret_key, controller_name)[source]

” Implement in python what is currently done in GO https://github.com/juju/juju/blob/a5ab92ec9b7f5da3678d9ac603fe52d45af24412/cmd/juju/user/utils.go#L16

  • username – name of the user to register
  • controller_endpoints – juju controller endpoints list in the format <ip>:<port>
  • secret_key – base64 encoded string of the secret-key generated by juju
  • controller_name – name of the controller to register to.
coroutine juju.utils.read_ssh_key(loop)[source]

Attempt to read the local juju admin’s public ssh key, so that it can be passed on to a model.

coroutine juju.utils.run_with_interrupt(task, *events, loop=None)[source]

Awaits a task while allowing it to be interrupted by one or more `asyncio.Event`s.

If the task finishes without the events becoming set, the results of the task will be returned. If the event become set, the task will be cancelled None will be returned.

  • task – Task to run
  • events – One or more asyncio.Event`s which, if set, will interrupt `task and cause it to be cancelled.
  • loop – Optional event loop to use other than the default.