Bug #6998
closed
Cannot rename host by API due to DHCP conflict - cannot set 'overwrite' flag
Added by Aaron Stone over 10 years ago.
Updated over 6 years ago.
Description
Steps in UI:
In the Foreman UI, rename a host.
Foreman shows a DHCP conflict for the MAC Address to the old name.
Click the Overwrite button.
Steps in API:
Submit form to /api/hosts/hostid with content {"name": "newname"} and an APIv2 header version
Receive error message {"error"=>{"full_messages"=>["Conflict DHCP records spare-12345-macaddr/ipaddr and spare-12345-macaddr/ipaddr already exists"] ... }
Try again with {"name": "newname", "overwrite": true}
Receive same error.
Expected:
I should be able to overwrite from the API.
This is with Foreman 1.5.1.
That commit will help if you're using an unwrapped set of JSON, i.e. it'll make {"overwrite":true, ...}
work. Before it, only the wrapped version {"host":{"overwrite":true, ...}}
will work.
Ah. It could be at the controller level, but it'd be much less duplication in the model - you could simply use value.to_s == "true"
instead. Generally Rails does string/bool stuff at the ActiveRecord layer, which isn't applicable for a setter.
I will submit a PR shortly!
- Status changed from New to Ready For Testing
- Target version set to 1.7.5
- Pull request https://github.com/theforeman/foreman/pull/1677 added
- Pull request deleted (
)
- Assignee set to Aaron Stone
- Translation missing: en.field_release set to 10
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Also available in: Atom
PDF