diff --git a/changelogs/fragments/11179-mas-list-parsing.yml b/changelogs/fragments/11179-mas-list-parsing.yml new file mode 100644 index 0000000000..c5ee448792 --- /dev/null +++ b/changelogs/fragments/11179-mas-list-parsing.yml @@ -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). diff --git a/plugins/modules/mas.py b/plugins/modules/mas.py index 8ecf032609..c4dd224cd8 100644 --- a/plugins/modules/mas.py +++ b/plugins/modules/mas.py @@ -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]))