maas-devel team mailing list archive
-
maas-devel team
-
Mailing list archive
-
Message #01690
Re: Allow API to use <system_id | hostname> for all operations that currently require the system_id
Yes having a specific call that could get the system_id from the hostname
would make it easier, but it still would not make it much more user
friendly. I think Gavin's approach would be the best, allowing a better cli
to be created. The new cli could add the ability to use hostname and tags
to reference nodes, and remove the returning of JSON, which is hard to
read, and replace it with a better output for a cli application. I think
the nova compute cli has a good output, and could provide some good
inspiration.
On Thu, May 29, 2014 at 9:49 AM, Gavin Panella
<gavin.panella@xxxxxxxxxxxxx>wrote:
> On 29 May 2014 13:46, Raphaël Badin <raphael.badin@xxxxxxxxxxxxx> wrote:
> > [...]
> >
> >> 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.
>
> Fwiw, jsonpath-rw 1.2.0 is in main in Trusty, and would fit the bill here.
> https://pypi.python.org/pypi/jsonpath-rw
>
> >
> > @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?
>
> Were scripts possible to write in straight Python, using a Python
> client API, we'd make a lot of people happy. Then the CLI becomes all
> about satisfying humans, and something like jsonpath would make this
> even more powerful.
>
> Some might argue that we should also make the CLI good for scripting
> from sh/bash, much like some might argue ridiculously that we ought to
> inject heroin into kids to prevent them from using it.
>
> --
> Mailing list: https://launchpad.net/~maas-devel
> Post to : maas-devel@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~maas-devel
> More help : https://help.launchpad.net/ListHelp
>
References