Create unmanaged host via REST API

> Hi,
> I'm trying to create not_managed host via REST api. I send following json:
>
> '{"host": {"operatingsystem_id": 21, "managed": false, "name": "
> ip188000.cern.ch", "ip": "128.142.144.17", "hostgroup_id": 53, "mac":
> "00:16:3e:00:4e:4b", "architecture_id": 1, "build": "0", "ptable_id": 1}}'
>
> But hosts created like that always appear as managed. Also, I can't drop
> any field from the set above, which is weird becaus fore exapmle partition
> table is not important for a non-managed host, right?
>
> Is there a way to create unmanaged host via REST api?
>
it seems we make the assumption that hosts created via the api are managed.
in order to fix it I would say

  1. open a new feature request on theforeman.org
  2. apply this patch :

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

Ohad

:slight_smile:

··· On Wed, Aug 1, 2012 at 4:33 PM, tomk wrote:

We are using foreman 1.0.0

Cheers,
Tomas


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/foreman-users/-/M4ebMdij55MJ.
To post to this group, send email to foreman-users@googlegroups.com.
To unsubscribe from this group, send email to
foreman-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/foreman-users?hl=en.