1
0
Fork 0
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:
patchback[bot] 2025-11-25 06:43:06 +01:00 committed by GitHub
parent 9c57bb4f60
commit 8da2ff61d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View 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).

View file

@ -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]))