Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display error details field (especially ExcessResources for create cluster) #231

Open
cben opened this issue Mar 17, 2021 · 1 comment
Open

Comments

@cben
Copy link
Contributor

cben commented Mar 17, 2021

When creating a cluster and quota is insufficient, all you see is:

$ go run ./cmd/ocm create cluster foo --dry-run --provider=aws --ccs=false --multi-az=false --region=us-east-1 --version=4.6.12 --compute-machine-type=r5.xlarge --compute-nodes=100 
Error: Failed to create cluster: dry run: unable to create cluster: identifier is '401', code is 'CLUSTERS-MGMT-401' and operation identifier is '4c3abc0f-4446-4e6e-9291-84ea86e4593a': Unauthorized due to missing quota
exit status 1

With --debug you see useful details how exactly you exceeded quota:

...
I0317 18:26:39.789504 2082861 dump.go:169] Response body follows
I0317 18:26:39.789941 2082861 dump.go:268] {
  "kind": "Error",
  "id": "401",
  "href": "/api/clusters_mgmt/v1/errors/401",
  "code": "CLUSTERS-MGMT-401",
  "reason": "Unauthorized due to missing quota",
  "details": [
    {
      "kind": "ExcessResources",
      "items": [
        {
          "resource_type": "compute.node.aws",
          "resource_name": "r5.xlarge",
          "availability_zone_type": "single",
          "count": 94,
          "billing_model": "standard"
        }
      ]
    }
  ],
  "operation_id": "5659e603-5c5a-4a6b-8de0-4835f5fe94b9"
}
Error: Failed to create cluster: dry run: unable to create cluster: identifier is '401', code is 'CLUSTERS-MGMT-401' and operation identifier is '5659e603-5c5a-4a6b-8de0-4835f5fe94b9': Unauthorized due to missing quota

This should be part of the normal output.
I don't think we need special formatting for this in ocm create cluster; I think the details field should be dumped, as json, whenever it's present.

@cben
Copy link
Contributor Author

cben commented Jun 29, 2021

Another example where this would be useful:

$ ocm create cluster greg --provider aws --region us-east-1
Error: Failed to create cluster: unable to create cluster: identifier is '451', code is 'CLUSTERS-MGMT-451' and operation identifier is '52153cc5-e806-4e6f-b61d-508d9538d2cc': Legal terms should be agreed. See details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant