1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-05-04 01:13:00 +00:00

snap: add devmode parameter to support --devmode flag (#11952)

* feat(snap): add devmode parameter to support --devmode flag

Closes #8155

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(changelog): add fragment for PR 11952

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alexei Znamensky 2026-05-02 10:46:23 +12:00 committed by GitHub
parent 881f64c93b
commit e751412914
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- snap - add ``devmode`` option to support installing snaps in developer mode (https://github.com/ansible-collections/community.general/pull/11952, https://github.com/ansible-collections/community.general/issues/8155).

View file

@ -47,6 +47,7 @@ def snap_runner(module: AnsibleModule, **kwargs) -> CmdRunner:
options=cmd_runner_fmt.as_list(),
info=cmd_runner_fmt.as_fixed("info"),
dangerous=cmd_runner_fmt.as_bool("--dangerous"),
devmode=cmd_runner_fmt.as_bool("--devmode"),
version=cmd_runner_fmt.as_fixed("version"),
_connect=cmd_runner_fmt.as_func(lambda v: ["connect", v]),
_disconnect=cmd_runner_fmt.as_func(lambda v: ["disconnect", v]),

View file

@ -77,6 +77,13 @@ options:
type: bool
default: false
version_added: 7.2.0
devmode:
description:
- Install the snap in developer mode, granting the snap full system access and disabling security confinement.
- See U(https://snapcraft.io/docs/install-modes) for more details about installation modes.
type: bool
default: false
version_added: 13.0.0
notes:
- Privileged operations, such as installing and configuring snaps, require root priviledges. This is only the case if the
user has not logged in to the Snap Store.
@ -194,6 +201,7 @@ class Snap(StateModuleHelper):
"channel": dict(type="str"),
"options": dict(type="list", elements="str"),
"dangerous": dict(type="bool", default=False),
"devmode": dict(type="bool", default=False),
},
supports_check_mode=True,
)
@ -390,7 +398,7 @@ class Snap(StateModuleHelper):
if self.check_mode:
return
params = ["state", "classic", "channel", "dangerous"] # get base cmd parts
params = ["state", "classic", "channel", "dangerous", "devmode"] # get base cmd parts
has_one_pkg_params = bool(self.vars.classic) or self.vars.channel != "stable"
has_multiple_snaps = len(actionable_snaps) > 1