Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

ciao-cli: reduce the output of ciao-cli instance list #308

Merged
merged 1 commit into from
Jun 23, 2016
Merged

ciao-cli: reduce the output of ciao-cli instance list #308

merged 1 commit into from
Jun 23, 2016

Conversation

albertomurillo
Copy link

@albertomurillo albertomurillo commented Jun 22, 2016

ciao-cli instance list output shows a detailed information for
each instance that is running taking 1 line per property making
the output difficult to digest by humans trying to seek fast the
instance of interest. For example:

Instance #1
        UUID: 37089506-dfc4-411c-ae57-c261ef891a7f
        Status: running
        Private IP: 172.16.0.3
        MAC Address: 02:00:ac:10:00:03
        CN UUID: 1d1f0791-eb93-4947-893f-8b325433dea7
        Image UUID: 73a86d7e-93c0-480e-9c41-ab42f69b7799
        Tenant UUID: effa268c7350464797e2794b798658aa
        SSH IP: 192.168.10.180
        SSH Port: 33003

This commit makes instance list print a table with the most relevant
information of each instance as a field, taking 1 line per instance.
For Example:

# UUID                                 Status  Private IP SSH IP         SSH PORT
1 37089506-dfc4-411c-ae57-c261ef891a7f running 172.16.0.3 192.168.10.180 33003
2 49e5d95a-1e40-4b3f-988a-183b607817c4 running 172.16.0.2 192.168.10.180 33002

Also adds the instance list -detail option to print the full information
for each instance since this output can be consumed by scripts.

Signed-off-by: Alberto Murillo [email protected]

@coveralls
Copy link

coveralls commented Jun 22, 2016

Coverage Status

Coverage decreased (-0.007%) to 62.676% when pulling b134cbf on albertomurillo:instance_list into 21de96b on 01org:master.

@coveralls
Copy link

coveralls commented Jun 22, 2016

Coverage Status

Coverage remained the same at 62.682% when pulling b134cbf on albertomurillo:instance_list into 21de96b on 01org:master.

fmt.Fprintf(w, "\t%s", server.ID)
fmt.Fprintf(w, "\t%s", server.Status)
fmt.Fprintf(w, "\t%s", server.Addresses.Private[0].Addr)
fmt.Fprintf(w, "\t%s", server.SSHIP)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server.SSHIP can be an empty string in which case this is a property that we do not export. Thus I'd like those 2 lines to be handled this way:

            if server.SSHIP != "" {
                fmt.Fprintf(w, "\t%s", server.SSHIP)
                fmt.Fprintf(w, "\t%d", server.SSHPort)
            } else {
                fmt.Fprintf(w, "\tN/A")
                fmt.Fprintf(w, "\tN/A")
            }

@sameo
Copy link

sameo commented Jun 23, 2016

Besides the SSHIP == "" case, the patch looks good to me.
@albertomurillo I also think we should implement a ciao-cli instance show [instance UUID] for showing one specific instance details. See issue #309 and let me know if you can work on it.

ciao-cli instance list output shows a detailed information for
each instance that is running taking 1 line per property making
the output difficult to digest by humans trying to seek fast the
instance of interest. For example:

Instance #1
        UUID: 37089506-dfc4-411c-ae57-c261ef891a7f
        Status: running
        Private IP: 172.16.0.3
        MAC Address: 02:00:ac:10:00:03
        CN UUID: 1d1f0791-eb93-4947-893f-8b325433dea7
        Image UUID: 73a86d7e-93c0-480e-9c41-ab42f69b7799
        Tenant UUID: effa268c7350464797e2794b798658aa
        SSH IP: 192.168.10.180
        SSH Port: 33003

This commit makes instance list print a table with the most relevant
information of each instance as a field, taking 1 line per instance.
For Example:

# UUID                                 Status  Private IP SSH IP         SSH PORT
1 37089506-dfc4-411c-ae57-c261ef891a7f running 172.16.0.3 192.168.10.180 33003
2 49e5d95a-1e40-4b3f-988a-183b607817c4 running 172.16.0.2 192.168.10.180 33002

Also adds the instance list -detail option to print the full information
for each instance since this output can be consumed by scripts.

Signed-off-by: Alberto Murillo <[email protected]>
@coveralls
Copy link

coveralls commented Jun 23, 2016

Coverage Status

Coverage remained the same at 62.682% when pulling be73bad on albertomurillo:instance_list into 21de96b on 01org:master.

@tpepper
Copy link

tpepper commented Jun 23, 2016

If anybody has automation around the cli, this will break them. Probably that's not extensively the case currently. Which argues for making this change sooner than later.

Looks good to me.

@sameo sameo merged commit 58559fb into ciao-project:master Jun 23, 2016
@sameo sameo removed the in progress label Jun 23, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants