Project

General

Profile

Bug #10726

Updated by Dominic Cleal almost 9 years ago

Start with a BMC interface: 

 <pre> 
 ``` 
 # curl -sku admin:$FOREMAN_PASSWORD https://1.2.3.4/api/v2/hosts/15/interfaces/106|json_pp 
 { 
    "name" : "", 
    "provider" : "IPMI", 
    "username" : "root", 
    "subnet_id" : null, 
    "virtual" : false, 
    "identifier" : "", 
    "created_at" : "2015-06-06T22:03:50Z", 
    "mac" : "aa:aa:aa:aa:aa:aa", 
    "provision" : false, 
    "type" : "bmc", 
    "managed" : true, 
    "ip" : "1.2.3.4", 
    "primary" : false, 
    "id" : 106, 
    "updated_at" : "2015-06-06T22:03:50Z", 
    "domain_id" : null, 
    "password" : "redacted", 
    "domain_name" : null, 
    "subnet_name" : null 
 } 
 </pre> ``` 

 update the subnet_id via the API: 

 <pre> 
 ``` 
 #curl -ku admin:$FOREMAN_PASSWORD -X PUT -H "Content-type: application/json" -d '{"interface":{"managed":true,"subnet_id":77}}' https://1.2.3.4/api/v2/hosts/15/interfaces/106|json_pp 
 { 
    "managed" : true, 
    "created_at" : "2015-06-06T22:03:50Z", 
    "subnet_name" : "blah [12261]", 
    "domain_id" : null, 
    "virtual" : false, 
    "subnet_id" : 77, 
    "updated_at" : "2015-06-06T22:06:42Z", 
    "mac" : "aa:aa:aa:aa:aa:aa", 
    "domain_name" : null, 
    "provision" : false, 
    "identifier" : "", 
    "id" : 106, 
    "name" : "", 
    "type" : "bmc", 
    "primary" : false, 
    "ip" : "1.2.3.4" 
 } 
 </pre> 

 ``` 
 The result looks mostly correct, type is still bmc but username and password are missing. 

 Validate the actual result: 

 <pre> 
 ``` 
 # curl -ku admin:$FOREMAN_PASSWORD https://1.2.3.4/api/v2/hosts/15/interfaces/106|json_pp 
 { 
    "identifier" : "", 
    "mac" : "aa:aa:aa:aa:aa:aa", 
    "subnet_name" : "blah", 
    "primary" : false, 
    "managed" : true, 
    "domain_name" : null, 
    "ip" : "1.2.3.4", 
    "id" : 106, 
    "provision" : false, 
    "subnet_id" : 77, 
    "virtual" : false, 
    "updated_at" : "2015-06-06T22:06:42Z", 
    "type" : "interface", 
    "name" : "", 
    "domain_id" : null, 
    "created_at" : "2015-06-06T22:03:50Z" 
 } 
 </pre> ``` 

 Interface type has been reset to "interface"

Back