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/cloud/opennebula/one_vm.py b/plugins/modules/cloud/opennebula/one_vm.py index 6bfc793603..7122907d38 100644 --- a/plugins/modules/cloud/opennebula/one_vm.py +++ b/plugins/modules/cloud/opennebula/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