From 621fb6a619fce1d45a72dc2b46bdbc3fb64d86d5 Mon Sep 17 00:00:00 2001 From: wh1t3 r4bb1t <16529603+d34d5p4rr0w@users.noreply.github.com> Date: Wed, 9 Nov 2022 00:00:05 +0200 Subject: [PATCH] one_vm: fix for 'NoneType' object has no attribute 'split' in get_vm_labels_and_attributes_dict (#5489) * Fix for 'NoneType' object has no attribute 'split' * Added changelog to fix * Update changelogs/fragments/5489-nonetype-in-get-vm-by-label.yml Co-authored-by: Felix Fontein * Fix line ending in changelog Co-authored-by: Felix Fontein --- changelogs/fragments/5489-nonetype-in-get-vm-by-label.yml | 2 ++ plugins/modules/one_vm.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/5489-nonetype-in-get-vm-by-label.yml diff --git a/changelogs/fragments/5489-nonetype-in-get-vm-by-label.yml b/changelogs/fragments/5489-nonetype-in-get-vm-by-label.yml new file mode 100644 index 0000000000..8b0d92ec40 --- /dev/null +++ b/changelogs/fragments/5489-nonetype-in-get-vm-by-label.yml @@ -0,0 +1,2 @@ +bugfixes: + - one_vm - avoid splitting labels that are ``None`` (https://github.com/ansible-collections/community.general/pull/5489). \ No newline at end of file diff --git a/plugins/modules/one_vm.py b/plugins/modules/one_vm.py index 6bfc793603..7122907d38 100644 --- a/plugins/modules/one_vm.py +++ b/plugins/modules/one_vm.py @@ -970,7 +970,7 @@ def get_vm_labels_and_attributes_dict(client, vm_id): if key != 'LABELS': attrs_dict[key] = value else: - if key is not None: + if key is not None and value is not None: labels_list = value.split(',') return labels_list, attrs_dict