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"