Bug #1800
Not possible to create unmanaged host via API
| Status: | Closed | Start: | 08/01/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 0% |
||
| Category: | Host creation | |||
| Target version: | 1.1 | |||
| Backlog: | No | Difficulity: | trivial | |
| Votes: | 1 (View) |
Description
even though I send
'{"host": {"operatingsystem_id": 21, "managed": false, "name": "ip188000.domain.ch", "ip": "188.142.144.17", "hostgroup_id": 53, "mac": "00:17:3e:00:4e:4b", "architecture_id": 1, "build": "0", "ptable_id": 1}}'
host is created as managed
Would be cool if the logic reflected the managed:false item.
Associated revisions
Revision d076d5731d733bbc6210c81d3b11ed7d2ba8b9d7
This commit adds most of the functionality required for API v1
The overall goal was to extract the existing JSON response
overall controllers, and to move them to a seperate name space.
- documentation was added to all requests (available under /apidoc)
this include same request and response generated using
APIPIE_RECORD=examples rake test:api - Also Fixes #1800, fixes #1419, fixes #981 and fixes #1774
whats missing:
1. Permissions checks for all new controllers
2. Nested routes (e.g. /hosts/id/reports)
3. running tests with oauth/basic_auth (instead of as_admin {get /})
History
Updated by Steve Traylen 11 months ago
With the proposed patch from mailing list this is good and you can add hosts specifying the hostname and group only.
Updated by Tomas Karasek 11 months ago
the patch from the mailing list by Ohad
diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb
index 2de8015..7fe9852 100644
--- a/app/controllers/hosts_controller.rb
+++ b/app/controllers/hosts_controller.rb
@@ -84,7 +84,7 @@ class HostsController < ApplicationController
def create
@host = Host.new(params[:host])
- @host.managed = true
+ @host.managed = true if params[:host][:managed].nil?
forward_request_url
if @host.save
Updated by Greg Sutcliffe 7 months ago
- Target version changed from 1.1 to Bug scrub
Updated by Joseph Magen 7 months ago
- Assigned to set to Joseph Magen
Updated by Joseph Magen 7 months ago
- Status changed from New to Assigned
Fixed as part of pull request https://github.com/theforeman/foreman/pull/239
Updated by Joseph Magen 7 months ago
- Status changed from Assigned to Closed
Updated by Joseph Magen 7 months ago
- Status changed from Closed to Ready For Testing
Updated by Sam Kottler 7 months ago
I'm going to mark this issue closed so we can get accurate numbers for how many issues got closed. Is this fix now included in the API v1 branch?
Updated by Sam Kottler 7 months ago
- Status changed from Ready For Testing to Closed
