Actions
Bug #12746
closedCompute resources can disappear in a development instance
Description
Compute resource store plugin registered resources like this: https://github.com/theforeman/foreman/blob/develop/app/models/compute_resource.rb#L13
If you notice, assignment is being done every time the class is loaded. So, let's take foreman_docker and how the 'Docker' compute resource can completely disappear in a dev environment:
(1) foreman_docker engine.r calls ComputeResource.register_provider
(2) register_provider adds Docker to supported_providers class attributes
(3) something causes the ComputeResource class to be reloaded
(4) Line #13 is re-evaluated, and the supported_providers is reset to the default (without docker)
You can try this out:
2.1.5 :008 > ComputeResource.providers => ["Libvirt", "Ovirt", "EC2", "Vmware", "Openstack", "Rackspace", "GCE", "Docker"] 2.1.5 :009 > require 'compute_resource' # simulate reload Creating scope :live_descendants. Overwriting existing method ComputeResource.live_descendants. => true 2.1.5 :010 > ComputeResource.providers => ["Libvirt", "Ovirt", "EC2", "Vmware", "Openstack", "Rackspace", "GCE"]
Actions