mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +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:
2
changelogs/fragments/11952-snap-devmode.yml
Normal file
2
changelogs/fragments/11952-snap-devmode.yml
Normal 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).
|
||||||
@@ -47,6 +47,7 @@ def snap_runner(module: AnsibleModule, **kwargs) -> CmdRunner:
|
|||||||
options=cmd_runner_fmt.as_list(),
|
options=cmd_runner_fmt.as_list(),
|
||||||
info=cmd_runner_fmt.as_fixed("info"),
|
info=cmd_runner_fmt.as_fixed("info"),
|
||||||
dangerous=cmd_runner_fmt.as_bool("--dangerous"),
|
dangerous=cmd_runner_fmt.as_bool("--dangerous"),
|
||||||
|
devmode=cmd_runner_fmt.as_bool("--devmode"),
|
||||||
version=cmd_runner_fmt.as_fixed("version"),
|
version=cmd_runner_fmt.as_fixed("version"),
|
||||||
_connect=cmd_runner_fmt.as_func(lambda v: ["connect", v]),
|
_connect=cmd_runner_fmt.as_func(lambda v: ["connect", v]),
|
||||||
_disconnect=cmd_runner_fmt.as_func(lambda v: ["disconnect", v]),
|
_disconnect=cmd_runner_fmt.as_func(lambda v: ["disconnect", v]),
|
||||||
|
|||||||
@@ -77,6 +77,13 @@ options:
|
|||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
version_added: 7.2.0
|
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:
|
notes:
|
||||||
- Privileged operations, such as installing and configuring snaps, require root priviledges. This is only the case if the
|
- 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.
|
user has not logged in to the Snap Store.
|
||||||
@@ -194,6 +201,7 @@ class Snap(StateModuleHelper):
|
|||||||
"channel": dict(type="str"),
|
"channel": dict(type="str"),
|
||||||
"options": dict(type="list", elements="str"),
|
"options": dict(type="list", elements="str"),
|
||||||
"dangerous": dict(type="bool", default=False),
|
"dangerous": dict(type="bool", default=False),
|
||||||
|
"devmode": dict(type="bool", default=False),
|
||||||
},
|
},
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
@@ -390,7 +398,7 @@ class Snap(StateModuleHelper):
|
|||||||
if self.check_mode:
|
if self.check_mode:
|
||||||
return
|
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_one_pkg_params = bool(self.vars.classic) or self.vars.channel != "stable"
|
||||||
has_multiple_snaps = len(actionable_snaps) > 1
|
has_multiple_snaps = len(actionable_snaps) > 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user