"Provision method can't be updated after host is provisioned" error when provision method is changed from implicit to explicit 'build'
As shown by a small Rails console example;
irb(main):001:0> h = Host::Managed.find_by(name: 'example-machine') => #<Host::Managed id: 4512 ... irb(main):002:0> h.attributes['provision_method'] => nil irb(main):003:0> h.provision_method => "build" irb(main):004:0> h.provision_method = 'build' => "build" irb(main):005:0> h.validate! ActiveRecord::RecordInvalid: Validation failed: Provision method can't be updated after host is provisioned from (irb):5 from lib/tasks/console.rake:5:in `block in <top (required)>'
This error has started occuring for us when combining our own WDS plugin - which seems to cause Foreman to always send the provision method as a parameter when saving hosts, and discovery - which creates discovered host entries that use the implicit 'build' provision method.