snap
¶
Manage snaps, plugs and snap services statefully.
- exception saltext.snap.states.snap_mod.NoServices(message='', info=None)[source]¶
Raised when no services to manage can be found
- saltext.snap.states.snap_mod.connected(name, connector, target=None)[source]¶
Ensure a snap’s plug is connected.
- name
The name of the snap to connect.
- connector
The name of the snap’s plug to connect.
- target
A specification for the slot to connect to. Optional. Full spec:
<snap_name>:<slot_name>
. If left unspecified, connects the plug to a slot of the core snap with a name matchingplug
. If specified as a snap name only, connects the plug to the only slot in the provided snap that matches the connection interface, but fails if multiple potential slots exist.
- saltext.snap.states.snap_mod.disconnected(name, connector, target=None)[source]¶
Ensure a snap’s plug(s)/slot(s) is/are connected.
- name
The name of the snap.
- connector
The name of the snap’s plug/slot to disconnect.
- target
A specification for the slot/plug to disconnect from in the format <snap_name>:<slot_or_plug_name>`. Optional. If left unspecified, disconnects all connections of the plug/slot.
- saltext.snap.states.snap_mod.enabled(name)[source]¶
Ensure a snap is enabled.
- name
The name of the snap.
- saltext.snap.states.snap_mod.disabled(name)[source]¶
Ensure a snap is disabled.
- name
The name of the snap.
- saltext.snap.states.snap_mod.installed(name, channel='latest/stable', revision=None, classic=False, held=None, assertions=None)[source]¶
Ensure a snap is installed.
- name
The name of the snap or a path to a local
.snap
file. In the latter case, ensure you also possess the accompanying assertions and specify theassertions
parameter or import them in some other way before this state runs.- channel
Follow this channel instead of
latest/stable
.- revision
Install this revision instead of the latest one available in the channel. Optional. If unset, will not upgrade after installation. Set this to
latest
to ensure this snap is kept up to date.- classic
Enable classic mode and disable security confinement. Defaults to false.
- held
Whether the snap should be excluded from general refreshes. Optional. If unset, leaves the setting unmanaged.
- assertions
When installing a snap from a file, import accompanying assertions from this file. Optional (if the assertions are imported otherwise).
- saltext.snap.states.snap_mod.option_managed(name, option=None, value=<Constant.NOT_SET>, options=None)[source]¶
Ensure a snap’s options are set as specified.
- name
The name of the snap.
- option
The name of the option. Either this and
value
oroptions
is required.- value
The value to set.. Either this and
option
oroptions
is required. If the value is specified as None/null
(YAML), the value will be unset.- options
A mapping of option names to their values to set. If an option’s value is None, it will be unset.
- saltext.snap.states.snap_mod.removed(name, purge=False)[source]¶
Ensure a snap is removed.
- name
The name of the snap.
- purge
Don’t save a snapshot of its data. Defaults to false.
- saltext.snap.states.snap_mod.service_running(name, service=None, enabled=None, timeout=10)[source]¶
Ensure a snap service is running. This state supports the
watch
requisite.- name
The name of the snap.
- service
Restrict this state to one of its services. Optional. If unset, will manage all services of the snap.
- enabled
Ensure the service is enabled to start at boot time. Optional. Can only be set to true.
- timeout
This state waits for each service. If it is still not at the desired state after this amount of seconds, it will fail. Defaults to 10.
- reload
When the
watch
requisite causes a restart, attempt to reload the service instead. Defaults to false.
- saltext.snap.states.snap_mod.service_dead(name, service=None, disabled=None, timeout=10)[source]¶
Ensure a snap service is dead. This state supports the
watch
requisite.- name
The name of the snap.
- service
Restrict this state to one of its services. Optional. If unset, will manage all services of the snap.
- disabled
Ensure the service is disabled (does not start at boot time). Optional. Can only be set to true.
- timeout
This state waits for each service. If it is still not at the desired state after this amount of seconds, it will fail. Defaults to 10.