jubilant.statustypes

Dataclasses that contain parsed output from juju status --format=json.

These dataclasses were originally generated from the Go structs in the Juju codebase, to ensure they are correct. Class names come from the Go struct name, whereas attribute names come from the JSON field names. The one exception is that “Application” has been renamed to “App” throughout, for brevity (and “application” to “app”).

class jubilant.statustypes.AppStatus(
charm: str,
charm_origin: str,
charm_name: str,
charm_rev: int,
exposed: bool,
base: ~jubilant.statustypes.FormattedBase | None = None,
charm_channel: str = '',
charm_version: str = '',
charm_profile: str = '',
can_upgrade_to: str = '',
scale: int = 0,
provider_id: str = '',
address: str = '',
life: str = '',
app_status: ~jubilant.statustypes.StatusInfo = <factory>,
relations: dict[str,
list[~jubilant.statustypes.AppStatusRelation]] = <factory>,
subordinate_to: list[str] = <factory>,
units: dict[str,
~jubilant.statustypes.UnitStatus] = <factory>,
version: str = '',
endpoint_bindings: dict[str,
str] = <factory>,
)

Bases: object

Status of a single application.

address: str = ''
app_status: StatusInfo
base: FormattedBase | None = None
can_upgrade_to: str = ''
charm: str
charm_channel: str = ''
charm_name: str
charm_origin: str
charm_profile: str = ''
charm_rev: int
charm_version: str = ''
endpoint_bindings: dict[str, str]
exposed: bool
property is_active: bool

Report whether the application status for this app is “active”.

property is_blocked: bool

Report whether the application status for this app is “blocked”.

property is_error: bool

Report whether the application status for this app is “error”.

property is_maintenance: bool

Report whether the application status for this app is “maintenance”.

property is_waiting: bool

Report whether the application status for this app is “waiting”.

life: str = ''
provider_id: str = ''
relations: dict[str, list[AppStatusRelation]]
scale: int = 0
subordinate_to: list[str]
units: dict[str, UnitStatus]
version: str = ''
class jubilant.statustypes.AppStatusRelation(
related_app: 'str' = '',
interface: 'str' = '',
scope: 'str' = '',
)

Bases: object

interface: str = ''
related_app: str = ''
scope: str = ''
class jubilant.statustypes.CombinedStorage(
storage: dict[str,
~jubilant.statustypes.StorageInfo] = <factory>,
filesystems: dict[str,
~jubilant.statustypes.FilesystemInfo] = <factory>,
volumes: dict[str,
~jubilant.statustypes.VolumeInfo] = <factory>,
)

Bases: object

Storage information.

filesystems: dict[str, FilesystemInfo]
storage: dict[str, StorageInfo]
volumes: dict[str, VolumeInfo]
class jubilant.statustypes.ControllerStatus(timestamp: str = '')

Bases: object

Basic controller information.

timestamp: str = ''
class jubilant.statustypes.EntityStatus(current: str = '', message: str = '', since: str = '')

Bases: object

Status class used for storage status. See StatusInfo for the main status class.

current: str = ''
message: str = ''
since: str = ''
class jubilant.statustypes.FilesystemAttachment(mount_point: 'str', read_only: 'bool', life: 'str' = '')

Bases: object

life: str = ''
mount_point: str
read_only: bool
class jubilant.statustypes.FilesystemAttachments(
machines: 'dict[str,
FilesystemAttachment]' = <factory>,
containers: 'dict[str,
FilesystemAttachment]' = <factory>,
units: 'dict[str,
UnitStorageAttachment]' = <factory>,
)

Bases: object

containers: dict[str, FilesystemAttachment]
machines: dict[str, FilesystemAttachment]
units: dict[str, UnitStorageAttachment]
class jubilant.statustypes.FilesystemInfo(
size: 'int',
provider_id: 'str' = '',
volume: 'str' = '',
storage: 'str' = '',
attachments: 'FilesystemAttachments' = <factory>,
pool: 'str' = '',
life: 'str' = '',
status: 'EntityStatus' = <factory>,
)

Bases: object

attachments: FilesystemAttachments
life: str = ''
pool: str = ''
provider_id: str = ''
size: int
status: EntityStatus
storage: str = ''
volume: str = ''
class jubilant.statustypes.FormattedBase(name: 'str', channel: 'str')

Bases: object

channel: str
name: str
class jubilant.statustypes.LxdProfileContents(
config: 'dict[str, str]',
description: 'str',
devices: 'dict[str, dict[str, str]]',
)

Bases: object

config: dict[str, str]
description: str
devices: dict[str, dict[str, str]]
class jubilant.statustypes.MachineStatus(
juju_status: ~jubilant.statustypes.StatusInfo = <factory>,
hostname: str = '',
dns_name: str = '',
ip_addresses: list[str] = <factory>,
instance_id: str = '',
display_name: str = '',
machine_status: ~jubilant.statustypes.StatusInfo = <factory>,
modification_status: ~jubilant.statustypes.StatusInfo = <factory>,
base: ~jubilant.statustypes.FormattedBase | None = None,
network_interfaces: dict[str,
~jubilant.statustypes.NetworkInterface] = <factory>,
containers: dict[str,
~jubilant.statustypes.MachineStatus] = <factory>,
constraints: str = '',
hardware: str = '',
controller_member_status: str = '',
ha_primary: bool = False,
lxd_profiles: dict[str,
~jubilant.statustypes.LxdProfileContents] = <factory>,
)

Bases: object

Status of a single machine.

base: FormattedBase | None = None
constraints: str = ''
containers: dict[str, MachineStatus]
controller_member_status: str = ''
display_name: str = ''
dns_name: str = ''
ha_primary: bool = False
hardware: str = ''
hostname: str = ''
instance_id: str = ''
ip_addresses: list[str]
juju_status: StatusInfo
lxd_profiles: dict[str, LxdProfileContents]
machine_status: StatusInfo
modification_status: StatusInfo
network_interfaces: dict[str, NetworkInterface]
class jubilant.statustypes.ModelStatus(
name: str,
type: str,
controller: str,
cloud: str,
version: str,
region: str = '',
upgrade_available: str = '',
model_status: ~jubilant.statustypes.StatusInfo = <factory>,
)

Bases: object

Status and basic information about the model.

cloud: str

Name of cloud, for example aws or microk8s.

controller: str

Name of controller.

model_status: StatusInfo

Status of the model. Normally the current field is available.

name: str

Name of model.

region: str = ''

Cloud region.

type: str

Type of model, for example, caas for a Kubernetes model.

upgrade_available: str = ''

Version number if a new Juju agent is available.

version: str

Juju agent version.

class jubilant.statustypes.NetworkInterface(
ip_addresses: 'list[str]',
mac_address: 'str',
is_up: 'bool',
gateway: 'str' = '',
dns_nameservers: 'list[str]' = <factory>,
space: 'str' = '',
)

Bases: object

dns_nameservers: list[str]
gateway: str = ''
ip_addresses: list[str]
is_up: bool
mac_address: str
space: str = ''
class jubilant.statustypes.OfferStatus(
app: 'str',
endpoints: 'dict[str, RemoteEndpoint]',
charm: 'str' = '',
total_connected_count: 'int' = 0,
active_connected_count: 'int' = 0,
)

Bases: object

active_connected_count: int = 0
app: str
charm: str = ''
endpoints: dict[str, RemoteEndpoint]
total_connected_count: int = 0
class jubilant.statustypes.RemoteAppStatus(
url: 'str',
endpoints: 'dict[str,
RemoteEndpoint]' = <factory>,
life: 'str' = '',
app_status: 'StatusInfo' = <factory>,
relations: 'dict[str,
list[str]]' = <factory>,
)

Bases: object

app_status: StatusInfo
endpoints: dict[str, RemoteEndpoint]
life: str = ''
relations: dict[str, list[str]]
url: str
class jubilant.statustypes.RemoteEndpoint(interface: 'str', role: 'str')

Bases: object

interface: str
role: str
class jubilant.statustypes.Status(model: ~jubilant.statustypes.ModelStatus, machines: dict[str, ~jubilant.statustypes.MachineStatus], apps: dict[str, ~jubilant.statustypes.AppStatus], app_endpoints: dict[str, ~jubilant.statustypes.RemoteAppStatus] = <factory>, offers: dict[str, ~jubilant.statustypes.OfferStatus] = <factory>, storage: ~jubilant.statustypes.CombinedStorage = <factory>, controller: ~jubilant.statustypes.ControllerStatus = <factory>)

Bases: object

Parsed version of the status object returned by juju status --format=json.

app_endpoints: dict[str, RemoteAppStatus]

Mapping of offer name to remote application information.

apps: dict[str, AppStatus]

Mapping of application name to application information.

controller: ControllerStatus

Controller information.

get_units(app: str) dict[str, UnitStatus]

Get all units of the given app, including units of subordinate apps.

For subordinate apps, this finds and returns the subordinate units using the app’s subordinate_to list. For principal (non-subordinate) apps, this is equivalent to status.apps[app].units.

Returns:

Dict of units where the key is the unit name and the value is the UnitStatus. If app is not found, return an empty dict.

machines: dict[str, MachineStatus]

Mapping of machine ID string (for example, "0") to machine information.

model: ModelStatus

Model information.

offers: dict[str, OfferStatus]

Mapping of offer name to offer information.

storage: CombinedStorage

Storage information.

class jubilant.statustypes.StatusInfo(
current: str = '',
message: str = '',
reason: str = '',
since: str = '',
version: str = '',
life: str = '',
)

Bases: object

The main status class used for application, unit, and machine status.

current: str = ''
life: str = ''
message: str = ''
reason: str = ''
since: str = ''
version: str = ''
class jubilant.statustypes.StorageAttachments(units: 'dict[str, UnitStorageAttachment]')

Bases: object

units: dict[str, UnitStorageAttachment]
class jubilant.statustypes.StorageInfo(
kind: 'str',
status: 'EntityStatus',
persistent: 'bool',
life: 'str' = '',
attachments: 'StorageAttachments | None' = None,
)

Bases: object

attachments: StorageAttachments | None = None
kind: str
life: str = ''
persistent: bool
status: EntityStatus
class jubilant.statustypes.UnitStatus(
workload_status: ~jubilant.statustypes.StatusInfo = <factory>,
juju_status: ~jubilant.statustypes.StatusInfo = <factory>,
leader: bool = False,
upgrading_from: str = '',
machine: str = '',
open_ports: list[str] = <factory>,
public_address: str = '',
address: str = '',
provider_id: str = '',
subordinates: dict[str,
~jubilant.statustypes.UnitStatus] = <factory>,
)

Bases: object

Status of a single unit.

address: str = ''
property is_active: bool

Report whether the workload status for this unit status is “active”.

property is_blocked: bool

Report whether the workload status for this unit status is “blocked”.

property is_error: bool

Report whether the workload status for this unit status is “error”.

property is_maintenance: bool

Report whether the workload status for this unit status is “maintenance”.

property is_waiting: bool

Report whether the workload status for this unit status is “waiting”.

juju_status: StatusInfo
leader: bool = False
machine: str = ''
open_ports: list[str]
provider_id: str = ''
public_address: str = ''
subordinates: dict[str, UnitStatus]
upgrading_from: str = ''
workload_status: StatusInfo
class jubilant.statustypes.UnitStorageAttachment(
machine: 'str' = '',
location: 'str' = '',
life: 'str' = '',
)

Bases: object

life: str = ''
location: str = ''
machine: str = ''
class jubilant.statustypes.VolumeAttachment(
read_only: 'bool',
device: 'str' = '',
device_link: 'str' = '',
bus_address: 'str' = '',
life: 'str' = '',
)

Bases: object

bus_address: str = ''
device: str = ''
life: str = ''
read_only: bool
class jubilant.statustypes.VolumeAttachments(
machines: 'dict[str,
VolumeAttachment]' = <factory>,
containers: 'dict[str,
VolumeAttachment]' = <factory>,
units: 'dict[str,
UnitStorageAttachment]' = <factory>,
)

Bases: object

containers: dict[str, VolumeAttachment]
machines: dict[str, VolumeAttachment]
units: dict[str, UnitStorageAttachment]
class jubilant.statustypes.VolumeInfo(
size: 'int',
persistent: 'bool',
provider_id: 'str' = '',
storage: 'str' = '',
attachments: 'VolumeAttachments' = <factory>,
pool: 'str' = '',
hardware_id: 'str' = '',
wwn: 'str' = '',
life: 'str' = '',
status: 'EntityStatus' = <factory>,
)

Bases: object

attachments: VolumeAttachments
hardware_id: str = ''
life: str = ''
persistent: bool
pool: str = ''
provider_id: str = ''
size: int
status: EntityStatus
storage: str = ''
wwn: str = ''