← Back to team overview

maas-devel team mailing list archive

Re: Allow API to use <system_id | hostname> for all operations that currently require the system_id

 

[...]
For this reason, I think we need to look at this in the context of some of the
upcoming work on general usability.

My opinion is that changing the API is the wrong thing to do here.  If we want
to make the command line more usable, I think we need to move maas back to
maas-cli and write a wrapper (called maas) around it to add a sugary layer for
end users.  This can include something that accepts hostnames for operations
involving nodes.  It can also include something that makes the parameters to
some of the operations a lot easier to understand.

I agree with the idea that changing the API would be wrong.

Even though the CLI is a bit rough to use right now (mostly because the inline (maas -h) documentation is a bit vague and the online documentation non-existant — two things that we've been wanting to fix for a long time, see https://bugs.launchpad.net/maas/+bugs?field.tag=cli), keeping its behaviour close to the API's behaviour has clear advantages.

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).

More precisely, it would make it very easy to get the system id of a node whose hostname you know; I'm thinking about something along the lines of:

$ maas <profile> nodes list hostname=<hostname> *limit=1 get-field=system_id* → system_id

The main functionality already exists (getting the filtered list of nodes); the part the we would need to add would be the limitation and the field extraction.

@Andres & al. don't you think that, if you had access (through a very clear call to the CLI) to the system_id of a node using its hostname, this would solve your usability problem?

R.


Follow ups

References