New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V2V] Don't run Ansible playbook if conversion host resource is absent or archived #20133
Conversation
@miq-bot add-label v2v, bug, jansa/yes?, ivanchuk/yes |
Checked commits fabiendupont/manageiq@9f67239~...0ee08d4 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint |
@fdupont-redhat when will the conversion_host resource be nil? I thought there was verification on this when creating the host and both VmOrTemplate and Host have dependent destroy on the belongs_to so if the host is deleted so too should the conversion host. No issue with this change, just want to make sure we're not putting a band-aid on a bigger issue |
@agrare it can be nil if the resource is removed from inventory. There's no cascading to conversion host object. It happened to QE to remove it before removing the conversion host, so I guess it could happen to users. |
@fdupont-redhat but there is cascade deletion from the vm and host to the conversion host, vm and host Also tested out real quick on the console:
|
I'll merge this to get this fixed but think we should look at how this was able to happen, maybe QE was doing |
[V2V] Don't run Ansible playbook if conversion host resource is absent or archived (cherry picked from commit 5916d54) https://bugzilla.redhat.com/show_bug.cgi?id=1810406
Ivanchuk backport details:
|
[V2V] Don't run Ansible playbook if conversion host resource is absent or archived (cherry picked from commit 5916d54) https://bugzilla.redhat.com/show_bug.cgi?id=1810406
Jansa backport details:
|
When the resource associated to a conversion host is nil, running the conversion host playbooks (check, disable, enable) will fail, because the
tag_resource_as_*
method will try to tag a nil object and raise. For the disable method, it has a side effect that the conversion host is not destroyed.And before trying to tag the resource, it will also try to run the associated Ansible playbook that will also fail and be rescued for nothing.
This pull request checks that the resource is present and returns early if it not, avoiding unneeded load and failure, and allowing conversion host destruction. It also returns if the resource is archived as it means the VM / Host doesn't exist in the provider and the playbook will also fail.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1810406