xcat2 / xcat-inventory

An inventory tool for xcat cluster
8 stars 16 forks source link

add secrets api and inventary table update #199

Closed bybai closed 5 years ago

bybai commented 5 years ago

For https://github.ibm.com/xcat2/task_management/issues/145

Description:

  1. add updating and adding xCAT table entry in xcat-inventory
  2. add secrets post API

UT:

  1. /inventory/secrets POST create a new secret object  
    curl -X POST "http://10.4.41.7:5000/api/v2/security/secrets" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{    \"kind\": \"test\",    \"spec\": {      \"username\": \"xc\",      \"password\": \"cluster\"    }}"
    {
    "message": "new user is created.",
    "id": "test_xc"
    }
  2. /inventory/secrets/{id} POST modify a specified type of secrets object  
    
    curl -X POST "http://10.4.41.7:5000/api/v2/security/secrets/test_xcx" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{    \"kind\": \"test\",    \"spec\": {      \"username\": \"x\",      \"password\": \"aaabbbbb\"    }}"
    {
    "message": "It is not the same user."
    }

curl -X POST "http://10.4.41.7:5000/api/v2/security/secrets/test_x" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"kind\": \"test\", \"spec\": { \"username\": \"x\", \"password\": \"aaxxxkkkkn\" }}" { "message": "Update user test_x successfully." }