mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
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.
This commit is contained in:
parent
f2731e1dac
commit
ebb534166e
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 = []
|
rows = []
|
||||||
apps = []
|
apps = []
|
||||||
for r in rows:
|
for r in rows:
|
||||||
# Format: "123456789 App Name"
|
# mas 2.3.0 and older:
|
||||||
r = r.split(" ", 1)
|
# 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:
|
if len(r) == 2:
|
||||||
apps.append(int(r[0]))
|
apps.append(int(r[0]))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue