mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-01 22:09:08 -07:00
[PR #6835/dc0d0045 backport][stable-7] snap: add track 'latest' if no track is specified (#6888)
snap: add track 'latest' if no track is specified (#6835)
* snap: add track 'latest' if no track is specified
See https://snapcraft.io/docs/channels for more details.
* snap: assume track latest if channel does not specify it
(cherry picked from commit dc0d00452f
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
b5d56463a6
commit
eccc41eadc
3 changed files with 39 additions and 1 deletions
|
@ -55,6 +55,9 @@ options:
|
|||
- Define which release of a snap is installed and tracked for updates.
|
||||
This option can only be specified if there is a single snap in the task.
|
||||
- If not passed, the C(snap) command will default to V(stable).
|
||||
- If the value passed does not contain the C(track), it will default to C(latest).
|
||||
For example, if V(edge) is passed, the module will assume the channel to be V(latest/edge).
|
||||
- See U(https://snapcraft.io/docs/channels) for more details about snap channels.
|
||||
type: str
|
||||
required: false
|
||||
options:
|
||||
|
@ -277,7 +280,7 @@ class Snap(StateModuleHelper):
|
|||
match = [c for n, c in installed if n == name]
|
||||
if not match:
|
||||
return Snap.NOT_INSTALLED
|
||||
if channel and channel != match[0]:
|
||||
if channel and match[0] not in (channel, "latest/{0}".format(channel)):
|
||||
return Snap.CHANNEL_MISMATCH
|
||||
else:
|
||||
return Snap.INSTALLED
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue