ginger
ginger copied to clipboard
Issue while performing GET or PUT operation, performed after PUT operation with any parameter as "" even with DEVICE
After PUT call with any parameter as "" even DEVICE, Get API call give incorrect value(null) for that operational parameter and if it is operational parameter then PUT without that optional parameter result into setting it to None. Tried with with ONBOOT and MTU(issue #64) and DEVICE.
- Performed PUT with ONBOOT "".
curl -k -uusername:password -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -d '{"BASIC_INFO":{"DEVICE":"enp0s3de","ONBOOT":""}}' 'https://127.0.0.1:8001/plugins/ginger/network/cfginterfaces/enp0s3d'
{
"reason":"The server encountered an unexpected condition which prevented it from fulfilling the request.",
"code":"500 Internal Server Error"
}
real 0m0.726s user 0m0.036s sys 0m0.064s
Network interface file still has ONBOOT:yes
- Performed GET curl -k -u username:password -H "Content-Type: application/json" -H "Accept: application/json" 'https://127.0.0.1:8001/plugins/ginger/network/cfginterfaces/enp0s3d' { "IPV4_INFO":{ "PEERROUTES":""yes"", "BOOTPROTO":""dhcp"", "DEFROUTE":""yes"", "PEERDNS":""yes"", "IPV4_FAILURE_FATAL":""no"" }, "BASIC_INFO":{ "UUID":""7241d3b4-2b15-49a8-994e-b788062a9b02"", "MTU":"None", "HWADDR":"08:00:27:65:33:7F", "DEVICE":"enp0s3de", "TYPE":"Ethernet", "ONBOOT":null, "NAME":"enp0s3d" }, "IPV6_INFO":{ "IPV6INIT":""yes"", "IPV6_PEERDNS":""yes"", "IPV6_DEFROUTE":""yes"", "IPV6_AUTOCONF":""yes"", "IPV6_FAILURE_FATAL":""no"", "IPV6_PEERROUTES":""yes"" } } However network interface has ONBOOT: yes
- performed PUT without passing any value to ONBOOT, in this case it should not change value of ONBOOT in network interface file.
curl -k -u archana:passw0rd -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -d '{"BASIC_INFO":{"DEVICE":"enp0s3de"}}' 'https://127.0.0.1:8001/plugins/ginger/network/cfginterfaces/enp0s3d' { "IPV4_INFO":{ "PEERROUTES":""yes"", "BOOTPROTO":""dhcp"", "DEFROUTE":""yes"", "PEERDNS":""yes"", "IPV4_FAILURE_FATAL":""no"" }, "BASIC_INFO":{ "UUID":""7241d3b4-2b15-49a8-994e-b788062a9b02"", "MTU":"None", "HWADDR":"08:00:27:65:33:7F", "DEVICE":"enp0s3de", "TYPE":"Ethernet", "ONBOOT":"None", "NAME":"enp0s3d" }, "IPV6_INFO":{ "IPV6INIT":""yes"", "IPV6_PEERDNS":""yes"", "IPV6_DEFROUTE":""yes"", "IPV6_AUTOCONF":""yes"", "IPV6_FAILURE_FATAL":""no"", "IPV6_PEERROUTES":""yes"" } } infcfg file also got updated with ONBOOT:yes.
This issue is generic, i.e we need to define jscon schema, for all the attributes and values that are acceptable.
Current code will not behave properly leading to exceptions, if we send curl commands with unexpected values.
@archu-s the API changed quite a bit since you've opened the bug. Does the issue still occur?