mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
[PR #11179/ebb53416 backport][stable-12] mas: Fix parsing on mas 3.0.0+. (#11210)
mas: Fix parsing on mas 3.0.0+. (#11179)
* mas: Fix parsing on mas 3.0.0+.
`mas` changed the formatting of `mas list` with version 3, which breaks
the parsing this module uses to determine which apps are installed. In
particular, app IDs may now have leading space, which causes us to split
the string too early.
* Changelog fragment.
* Better format examples and changlog fragment.
(cherry picked from commit ebb534166e)
Co-authored-by: Michael Galati <11300961+leetoburrito@users.noreply.github.com>
This commit is contained in:
parent
9c57bb4f60
commit
8da2ff61d5
2 changed files with 11 additions and 2 deletions
3
changelogs/fragments/11179-mas-list-parsing.yml
Normal file
3
changelogs/fragments/11179-mas-list-parsing.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
bugfixes:
|
||||
- mas - parse CLI output correctly when listing installed apps with mas 3.0.0+ (https://github.com/ansible-collections/community.general/pull/11179).
|
||||
|
|
@ -195,8 +195,14 @@ class Mas:
|
|||
rows = []
|
||||
apps = []
|
||||
for r in rows:
|
||||
# Format: "123456789 App Name"
|
||||
r = r.split(" ", 1)
|
||||
# mas 2.3.0 and older:
|
||||
# 123456789 App Name (version)
|
||||
# 4567890 App Name Longer (version)
|
||||
#
|
||||
# mas 3.0.0 and newer:
|
||||
# 123456789 App Name (version)
|
||||
# 4567890 App Name Longer (version)
|
||||
r = r.strip().split(" ", 1)
|
||||
if len(r) == 2:
|
||||
apps.append(int(r[0]))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue