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-11] mas: Fix parsing on mas 3.0.0+. (#11211)

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)
This commit is contained in:
Michael Galati 2025-11-24 21:46:29 -08:00 committed by GitHub
parent 67bb94ae89
commit a2042c9b93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View file

@ -201,8 +201,14 @@ class Mas(object):
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]))