[Maas-devel] Allow API to use <system_id | hostname> for all operations that currently require the system_id
Jeroen Vermeulen
jeroen.vermeulen at canonical.com
Thu May 29 14:06:20 UTC 2014
On 2014-05-29 14:46, Raphaël Badin wrote:
> I wonder if, instead of changing the core *behaviour* by adding the
> option to look up the nodes using hostnames, we shouldn't improve the
> CLI so that it's easier to *extract* information from the returned
> responses. This is based on the idea that most of the pain we feel when
> using the CLI comes from the awkwardness of having to deal with
> JSON-formatted output. While this is fine when using the API in Python,
> JSON is clumsy to use on the command-line (even though I know that they
> are workarounds, for instance by piping the JSON blob into a Python
> command).
We may be getting into different problems here... I agree that
extracting fields from results is probably a client-side job by nature.
For short-term pain relief, by the way, a command called ‘jq’ makes this
easy. Here's how you get just the system_id for a node with hostname foo:
maas myprof nodes list hostname=foo | jq '.[0].system_id'
Jeroen
More information about the Maas-devel
mailing list