Open rwf14f opened 2 weeks ago
I honestly would have preferred to make the method definition:
def destroy(destroy_volumes: false, flags: ::Libvirt::Domain::UNDEFINE_NVRAM)
But I don't know if I'd break something with that.
I think your suggestion is indeed fixing the problem I wanted to address. Could you submit a PR?
The code introduced with https://github.com/fog/fog-libvirt/pull/132 doesn't work when an
options
hash is passed todestroy
that doesn't define:flags
. For example, if{ :destroy_volumes => true }
is passed todestroy
, then the if condition is false because it uses the default value of theoptions.fetch
and then passes an undefinedoptions[:flags]
to thevm_action
call in the else block. If the intention behind the patch is to useUNDEFINE_NVRAM
as the default if no flags are passed todestroy
then this should work: