Project

General

Profile

Actions

Bug #24662

closed

"Provision method can't be updated after host is provisioned" error when provision method is changed from implicit to explicit 'build'

Added by Alexander Olofsson about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Web Interface
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

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.

Actions

Also available in: Atom PDF