When using the json output of the cli (`-format=json`), a successful call to the controller API would place the HTTP status code in the JSON as `status_code`. However, if there was an error from the API the status code would be placed in the JSON as `status`. In order to be consistent, this adds a `status_code` field to the error response case. For backwards compatibility it still populates `status` in the error case. This inconsistency was missed partially due to a bug in the CLI tests. The assertion on status code was not valid and would always be successful. Thus this also fixes the assertions and tests.
22 lines
555 B
Bash
22 lines
555 B
Bash
function create_account() {
|
|
export BP="${DEFAULT_PASSWORD}"
|
|
boundary accounts create password -login-name $1 -password env://BP -auth-method-id $DEFAULT_AMPW
|
|
}
|
|
|
|
function read_account() {
|
|
boundary accounts read -id $1
|
|
}
|
|
|
|
function delete_account() {
|
|
boundary accounts delete -id $1 -format json
|
|
}
|
|
|
|
function list_accounts() {
|
|
boundary accounts list -auth-method-id $DEFAULT_AMPW -format json
|
|
}
|
|
|
|
function account_id() {
|
|
local acct=$1
|
|
strip $(list_accounts | jq -c ".items[] | select(.attributes.login_name | contains(\"$acct\")) | .[\"id\"]")
|
|
}
|