mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-07-07 02:58:54 +00:00
snap: support system as a configuration target (#12025)
* feat(snap): support snap system configuration via name=system Treat `system` as a virtual snap that is always considered installed, bypassing snap info lookup and install/refresh logic, while still allowing snap set/get operations via the options parameter. Fixes #11266 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(snap): note version_added for system support; add changelog fragment 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:
parent
fba7da4394
commit
862d7d7aaf
3 changed files with 120 additions and 9 deletions
|
|
@ -438,6 +438,90 @@ TEST_SPEC = dict(
|
|||
],
|
||||
),
|
||||
),
|
||||
dict(
|
||||
id="set_system_option",
|
||||
input={"name": ["system"], "options": ["proxy.http=http://proxy.example.com:3128/"]},
|
||||
output=dict(changed=True, options_changed=["system:proxy.http=http://proxy.example.com:3128/"]),
|
||||
flags={},
|
||||
mocks=dict(
|
||||
run_command=[
|
||||
dict(
|
||||
command=["/testbin/snap", "version"],
|
||||
environ=default_env,
|
||||
rc=0,
|
||||
out=default_version_out,
|
||||
err="",
|
||||
),
|
||||
# No "snap info system" — virtual snap bypasses names_from_snaps
|
||||
dict(
|
||||
command=["/testbin/snap", "list"],
|
||||
environ=default_env,
|
||||
rc=0,
|
||||
out="",
|
||||
err="",
|
||||
),
|
||||
dict(
|
||||
command=["/testbin/snap", "get", "-d", "system"],
|
||||
environ=default_env,
|
||||
rc=0,
|
||||
out="{}",
|
||||
err="",
|
||||
),
|
||||
dict(
|
||||
command=["/testbin/snap", "set", "system", "proxy.http=http://proxy.example.com:3128/"],
|
||||
environ=default_env,
|
||||
rc=0,
|
||||
out="",
|
||||
err="",
|
||||
),
|
||||
dict(
|
||||
command=["/testbin/snap", "list"],
|
||||
environ=default_env,
|
||||
rc=0,
|
||||
out="",
|
||||
err="",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
dict(
|
||||
id="set_system_option_idempotent",
|
||||
input={"name": ["system"], "options": ["proxy.http=http://proxy.example.com:3128/"]},
|
||||
output=dict(changed=False),
|
||||
flags={},
|
||||
mocks=dict(
|
||||
run_command=[
|
||||
dict(
|
||||
command=["/testbin/snap", "version"],
|
||||
environ=default_env,
|
||||
rc=0,
|
||||
out=default_version_out,
|
||||
err="",
|
||||
),
|
||||
dict(
|
||||
command=["/testbin/snap", "list"],
|
||||
environ=default_env,
|
||||
rc=0,
|
||||
out="",
|
||||
err="",
|
||||
),
|
||||
dict(
|
||||
command=["/testbin/snap", "get", "-d", "system"],
|
||||
environ=default_env,
|
||||
rc=0,
|
||||
out='{"proxy": {"http": "http://proxy.example.com:3128/"}}',
|
||||
err="",
|
||||
),
|
||||
dict(
|
||||
command=["/testbin/snap", "list"],
|
||||
environ=default_env,
|
||||
rc=0,
|
||||
out="",
|
||||
err="",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
dict(
|
||||
id="issue_6803",
|
||||
input={"name": ["microk8s", "kubectl"], "classic": True},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue