From b80854ff503d01a47246402d520274acbb81a8a7 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Matsumoto Date: Fri, 4 Dec 2020 09:17:42 +0100 Subject: [PATCH] Fix #1435: mas : Fix "invalid literal" when no app (#1436) * Fix #1435: mas : Fix "invalid literal" when no app * Add changelog fragment * Update changelogs/fragments/1436-mas-fix-no-app-installed.yml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/1436-mas-fix-no-app-installed.yml | 3 +++ plugins/modules/packaging/os/mas.py | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/fragments/1436-mas-fix-no-app-installed.yml diff --git a/changelogs/fragments/1436-mas-fix-no-app-installed.yml b/changelogs/fragments/1436-mas-fix-no-app-installed.yml new file mode 100644 index 0000000000..4db32a1a91 --- /dev/null +++ b/changelogs/fragments/1436-mas-fix-no-app-installed.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - "mas - fix ``invalid literal`` when no app can be found (https://github.com/ansible-collections/community.general/pull/1436)." diff --git a/plugins/modules/packaging/os/mas.py b/plugins/modules/packaging/os/mas.py index 289c10385f..bc3e6dfd66 100644 --- a/plugins/modules/packaging/os/mas.py +++ b/plugins/modules/packaging/os/mas.py @@ -183,6 +183,8 @@ class Mas(object): rc, raw_apps, err = self.run([command]) rows = raw_apps.split("\n") + if rows[0] == "No installed apps found": + rows = [] apps = [] for r in rows: # Format: "123456789 App Name"