Comment 4 for bug 1938927

Revision history for this message
Adam Collard (adam-collard) wrote :

@James - admin users can get power_parameters for all of the machines in MAAS by using

maas "$MAAS_USER" machines power-parameters

So instead of this monstrosity

```
for i in $(maas "$MAAS_USER" machines read | jq -r '.[].system_id'); do maas $MAAS_USER machine power-parameters "$i" | jq ". + {\"system_id\": \"$i\"}"; done | jq -s
```

You can simply have `maas "$MAAS_USER" machines power-parameters | jq` to see all of them (in about 25x less time on my test)

And instead of

```
for i in $(maas "$MAAS_USER" machines read | jq -r '.[] | select(.power_type == "moonshot") | .system_id'); do maas <LOGIN> machine power-parameters "$i" | jq ". + {\"system_id\": \"$i\"}"; done | jq -s
```

to select for a power_type you can have

`maas "$MAAS_USER" machines read | jq -r '.[] | select(.power_type == "moonshot") | "id=" + .system_id'| xargs -r maas "$MAAS_USER" machines power-parameters`

which again is much more performant