metal-cli icon indicating copy to clipboard operation
metal-cli copied to clipboard

can't filter capacity list by metro or facility

Open displague opened this issue 3 years ago • 3 comments

What happened?

Capacity filtering by metro or facility does not work as documented: metal capacity get -m DA should return a only plans in that metro. All metros are returned instead.

The same problem occurs when filtering by facility.

How can we reproduce it?

metal capacity get -m DA | grep SV

CLI version (metal --version):

displague avatar Nov 30 '21 19:11 displague

Reopening as this does not appear to be working in 0.7.0

$ ( cd; go install github.com/equinix/metal-cli/cmd/[email protected])
$ which -a metal
/Users/marques/.local/share/go/bin/metal

The request does not include a metro filter:

$ PACKNGO_DEBUG=1 metal capacity get -m DA
2022/01/12 09:17:21
=======[REQUEST]=============
GET /metal/v1/capacity/metros HTTP/1.1
Host: api.equinix.com
User-Agent: metal-cli/v0.7.0 packngo/v0.20.0
Connection: close
Accept: application/json
Content-Type: application/json
X-Auth-Token: **REDACTED**
X-Consumer-Token: Equinix Metal CLI
Accept-Encoding: gzip

The results are not client-side filtered either.

+-------+------------------------+-------------+
| METRO |          PLAN          |    LEVEL    |
+-------+------------------------+-------------+
| sy    | c3.medium.x86          | normal      |
| pa    | c3.medium.x86          | normal      |
| tr    | c3.small.x86           | limited     |
| ch    | c3.small.x86           | limited     |
...

displague avatar Jan 12 '22 14:01 displague

#161 fixes metal capacity check, not metal capacity get.

cprivitere avatar Jan 13 '22 18:01 cprivitere

Semi-related issue: metal capacity check --plans c3.small.x86 -q 50 --metros ny,sv,da will combine the command line args plans and metros with the plan and metro found in the ~/.config/equinix/metal.yaml file.

The lists should be unique'd. The lists arguments, when set, should override the defaults from the config file. We may need a generic way to request the command line argument rather than anything found in the config file. We have this recurring problem #153

displague avatar Jan 19 '22 21:01 displague