Skip to content

Commit

Permalink
Fix detection of all absent VMs
Browse files Browse the repository at this point in the history
`rejectattr` fails if the attribute is not set, and no default option is
available. Alter the logic to ensure that if `state` is unset, it is
treated as `present`.
  • Loading branch information
Will Miller committed Aug 23, 2018
1 parent d676ee4 commit e91af31
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
- include_tasks: autodetect.yml
# We need to know the engine and emulator if we're creating any new VMs.
when: libvirt_vms | rejectattr('state', 'eq', 'absent') | list
# We don't need to know the engine and emulator if we're not creating any new
# VMs.
when: >-
(libvirt_vms | selectattr('state', 'defined')
| selectattr('state', 'eq', 'absent') | list) != libvirt_vms
- include_tasks: volumes.yml
vars:
Expand Down

0 comments on commit e91af31

Please sign in to comment.