Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1174 from rbradford/fix-quotas-cli
Browse files Browse the repository at this point in the history
ciao-cli: Fix privilege related error reporting for quotas command
  • Loading branch information
Tim Pepper authored Feb 17, 2017
2 parents 3c27d45 + a118125 commit c7b8082
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ciao-cli/quotas.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (cmd *quotasUpdateCommand) parseArgs(args []string) []string {

func (cmd *quotasUpdateCommand) run(args []string) error {
if !checkPrivilege() {
errorf("Updating quotas is only available for privileged users")
fatalf("Updating quotas is only available for privileged users")
}

if cmd.name == "" {
Expand Down Expand Up @@ -179,11 +179,16 @@ func (cmd *quotasListCommand) run(args []string) error {
}

if cmd.tenantID != "" {
if !checkPrivilege() {
fatalf("Listing quotas for other tenants is for privileged users only")
}

url = fmt.Sprintf("%s/%s/quotas", url, cmd.tenantID)
} else {
if !checkPrivilege() {
errorf("Listing quotas for other tenants is for privileged users only")
if checkPrivilege() {
fatalf("Admin user must specify the tenant with -for-tenant")
}

url = fmt.Sprintf("%s/quotas", url)
}
ver := api.TenantsV1
Expand Down

0 comments on commit c7b8082

Please sign in to comment.