Bug 1601445 - Role fails when vms list is empty
Summary: Role fails when vms list is empty
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-ansible-collection
Classification: oVirt
Component: vm-infra
Version: 1.1.6
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ovirt-4.2.6
: ---
Assignee: Ondra Machacek
QA Contact: Petr Kubica
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-16 12:22 UTC by Petr Kubica
Modified: 2018-09-03 15:08 UTC (History)
2 users (show)

Fixed In Version: ovirt-ansible-vm-infra-1.1.9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-03 15:08:24 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github oVirt ovirt-ansible-vm-infra pull 42 0 None None None 2018-08-14 11:59:50 UTC

Description Petr Kubica 2018-07-16 12:22:18 UTC
Description of problem:
Role fails when vms: []
It should finish successfully.

Version-Release number of selected component (if applicable):
ovirt-ansible-vm-infra-1.1.8-1.el7ev.noarch

How reproducible:
always

Steps to Reproduce:
1. run role vm-infra with 'vms: []'

Actual results:
failed

Expected results:
should success

Additional info:
TASK [ovirt-vm-infra : Create VMs] *************************************
task path: /usr/share/ansible/roles/oVirt.vm-infra/tasks/main.yml:21

TASK [ovirt-vm-infra : Wait for VMs to be added] ************************************************************************
task path: /usr/share/ansible/roles/oVirt.vm-infra/tasks/main.yml:27
fatal: [localhost]: FAILED! => {
    "msg": "'all_vms' is undefined"
}

Comment 1 Martin Perina 2018-07-31 05:35:19 UTC
Is there any reason why the role should finish successfully when there are no VMs to be created/started? Shouldn't we rather make error message more clear, that users needs to specify at least 1 VM in vms option? Or am I missing something?

Comment 2 Petr Kubica 2018-07-31 12:24:24 UTC
I'm creating vms list dynamically using this role and in some rare cases it could happen that my dynamic list is empty. I can workaround it by testing: 'when: vms is not []' when I'm including this role, but at first I expected that if there isn't any change (any VM to create) it should pass as with "ok" or "skipped" to next tasks, because 'do nothing' isn't an error state in this case. But I understand your point of view about specifying at least 1 VM in vms and clear error message to explicitly say to users that they don't create any VMs.

Comment 3 Petr Kubica 2018-08-20 12:04:03 UTC
Verified ovirt-ansible-vm-infra-1.1.10-0.1.master.20180815145127.el7.noarch


Note You need to log in before you can comment on or make changes to this bug.