Project

General

Profile

Bug #4510

Updated by Dominic Cleal over 10 years ago

Foreman 1.4.1 

 Can't create auth_source_ldap with api 

 POSTING: 

 <pre>  
 
 
 { 
  "auth_source_ldap": { 
    "type": "AuthSourceLdap", 
    "name": "ldap1", 
    "host": "ldap.example.com", 
  } 
 } 
 </pre> 

 With the following url's 

 foreman.localdomain/api/auth_source_ldaps 
 foreman.localdomain/api/v1/auth_source_ldaps 
 foreman.localdomain/api/v2/auth_source_ldaps 

 Alway's results in the following error: (doesn't matter how many parameters I specify) 

 <pre> 
 { 
     "auth_source_ldap": { 
         "id": null, 
         "errors": { 
             "name": [ 
                 "can't be blank" 
             ], 
             "host": [ 
                 "can't be blank" 
             ] 
         }, 
         "full_messages": [ 
             "Name can't be blank", 
             "Server can't be blank" 
         ] 
     } 
 } 
 </pre> 

 In production.log only the following error is shown. 

 <pre> 
 


 Started POST "/api/auth_source_ldaps" for 192.168.88.1 at 2014-03-01 01:12:46 -0800 
 Processing by Api::V1::AuthSourceLdapsController#create as JSON 
   Parameters: {"apiv"=>"v1"} 
   User Load (0.8ms)    SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1    [["id", 1]] 
 Setting current user thread-local variable to admin 
    (0.3ms)    BEGIN 
   AuthSource Exists (0.5ms)    SELECT 1 AS one FROM "auth_sources" WHERE "auth_sources"."name" = '' LIMIT 1 
    (0.1ms)    ROLLBACK 
 Unprocessable entity AuthSourceLdap (id: new): 
   Name can't be blank 
   Server can't be blank 

   Rendered api/v1/errors/unprocessable_entity.json.rabl (1.5ms) 
 Body: {"auth_source_ldap":{"id":null,"errors":{"name":["can't be blank"],"host":["can't be blank"]},"full_messages":["Name can't be blank","Server can't be blank"]}} 
 Completed 422 Unprocessable Entity in 303ms (Views: 2.6ms | ActiveRecord: 1.8ms) 
 </pre> 

 


 Also updating an auth_source_ldap doesn't work, no error occurs but changing port from 389 to 3890 resuls in the following loggin and no change. 

 <pre> 
 Started GET "/api/v1/auth_source_ldaps/4" for 192.168.88.1 at 2014-03-01 02:06:06 -0800 
 Processing by Api::V1::AuthSourceLdapsController#show as JSON 
   Parameters: {"apiv"=>"v1", "id"=>"4"} 
   ^[[1m^[[35mUser Load (0.5ms)^[[0m    SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1    [["id", 1]] 
 Setting current user thread-local variable to admin 
   ^[[1m^[[36mAuthSourceLdap Load (0.5ms)^[[0m    ^[[1mSELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."type" IN ('AuthSourceLdap') AND "auth_sources"."id" = 4 LIMIT 1^[[0m 
   Rendered api/v1/auth_source_ldaps/show.json.rabl (90.0ms) 
 Body: {"auth_source_ldap":{"id":4,"type":"AuthSourceLdap","name":"ldap","host":"ldap.example.com","port":389,"account":"","base_dn":"","ldap_filter":"","attr_login":"","attr_firstname":"","attr_lastname":"","attr_mail":"","onthefly_register":false,"tls":false,"created_at":"2014-03-01T09:31:06Z","updated_at":"2014-03-01T09:31:06Z"}} 
 Completed 200 OK in 95ms (Views: 90.8ms | ActiveRecord: 1.0ms) 


 Started PUT "/api/v1/auth_source_ldaps/4" for 192.168.88.1 at 2014-03-01 02:06:20 -0800 
 Processing by Api::V1::AuthSourceLdapsController#update as JSON 
   Parameters: {"apiv"=>"v1", "id"=>"4"} 
   ^[[1m^[[35mUser Load (0.5ms)^[[0m    SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1    [["id", 1]] 
 Setting current user thread-local variable to admin 
   ^[[1m^[[36mAuthSourceLdap Load (0.7ms)^[[0m    ^[[1mSELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."type" IN ('AuthSourceLdap') AND "auth_sources"."id" = 4 LIMIT 1^[[0m 
   ^[[1m^[[35m (0.3ms)^[[0m    BEGIN 
   ^[[1m^[[36mAuthSource Exists (0.5ms)^[[0m    ^[[1mSELECT 1 AS one FROM "auth_sources" WHERE ("auth_sources"."name" = 'ldap' AND "auth_sources"."id" != 4) LIMIT 1^[[0m 
   ^[[1m^[[35m (0.3ms)^[[0m    COMMIT 
 Body: {"auth_source_ldap":{"account":"","account_password":"","attr_firstname":"","attr_lastname":"","attr_login":"","attr_mail":"","base_dn":"","created_at":"2014-03-01T09:31:06Z","host":"ldap.example.com","id":4,"ldap_filter":"","name":"ldap","onthefly_register":false,"port":389,"tls":false,"updated_at":"2014-03-01T09:31:06Z"}} 
 Completed 200 OK in 12ms (Views: 0.8ms | ActiveRecord: 0.0ms) 
 </pre> 



 




Back