juju get output is ugly (broken line wrapping and escape characters)

Bug #1292116 reported by James Troup
42
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Medium
Unassigned

Bug Description

The output from 'juju get' is so ugly as to be almost unreadable.
It's full of broken line wrapping, e.g.:

| external-network-id:
| description: 'Optional configuration to set the external-network-id. Only needed
| when
|
| configuring multiple external networks and should be used in conjunction
|
| with run-internal-router.
|
| '
| type: string
| value: eth0

Or escape characters, e.g.:

| openstack-origin:
| description: "Optional configuration to support use of additional sources such
| as:\n.\n - ppa:myteam/ppa\n - cloud:precise-folsom/proposed\n - cloud:precise-folsom\n
| \ - deb http://my.archive.com/ubuntu main|KEYID\n.\nNote that quantum/neutron
| is only supported >= Folsom.\n"
| type: string
| value: cloud:precise-havana

I've seen this kind of problem across dozen of different charms, so I
assume it's a juju issue rather than a charm one.

James Troup (elmo)
tags: added: canonical-is
Revision history for this message
Curtis Hovey (sinzui) wrote :

This might be a bug in goyaml.

Changed in juju-core:
status: New → Triaged
importance: Undecided → High
tags: added: papercut
tags: added: config
Changed in juju-core:
importance: High → Medium
Revision history for this message
Brad Crittenden (bac) wrote :

Due to this bug, a new charm author and I just had a long back-and-forth trying to figure out how to format descriptions in config.yaml so they don't look terrible. The work-around was to not put any line breaks in the description. So this trades pleasant user experience for ugly source.

It would be nice to not have this compromise. The bug makes for a bad user experience, as James points out, and wastes charm developer time.

Revision history for this message
Jay R. Wren (evarlast) wrote :

I've learned more than I wanted to know about yaml since filing a duplicate of this bug.

It turns out the work around is very easy. Do not use | or >

Charm config.yaml option description values should either be all on one line or continue to next line.

For example, in the mysql charm:

    ha-bindiface:
        type: string
        default: eth0
        description: |
          Default network interface on which HA cluster will bind to communication
          with the other members of the HA Cluster.

This renders ugly with juju get:

  ha-bindiface:
    default: true
    description: 'Default network interface on which HA cluster will bind to communication

      with the other members of the HA Cluster.

'

If instead the config.yaml did not use | it would render pretty.

Example of fixed section of config.yaml:

    ha-bindiface:
        type: string
        default: eth0
        description: Default network interface on which HA cluster will bind to communication
          with the other members of the HA Cluster.

Documentation should be updated with these details and charm proof should be updated with checks for good rendering.

Revision history for this message
Caio Begotti (caio1982) wrote :

Another thing related to this bug, which is affecting my deployments with Juju and Mojo is that juju get service will break lines when it should not. Long values with spaces in them are broken this way. I have credentials in the config file and juju get will break the line for no reason and thus I can't use its output normally, I have to hack a bunch of sed commands around it...

My config file (just the relevant bits):

projectname:
    services:
        servicename:
            options:
                repository: "deb https://username:<email address hidden>/projectrepo/ubuntu trusty main"

But then juju get returns this:

  repository:
    description: The PPA address or private repository line for apt-add-repository
    type: string
    value: deb https://username:<email address hidden>/projectrepo/ubuntu
      trusty main

I've tried to change the COLUMNS env var but it does not help, the linebreak is coming from Juju.

Revision history for this message
Ryan Finnie (fo0bar) wrote :

Here's a script I pipe the output of `juju get` to. It formats the settings (non-default by default, or all settings with --all) as `juju set` commands, taking into account formatting and escaping introduced by the YAML output process. --comments shows the help for each setting, but commented out.

I've found that this helps tremendously when needing to modify a complex setting, or even viewing modified settings in an environment.

Changed in juju-core:
milestone: none → 1.26-alpha1
Mark Ramm (mark-ramm)
Changed in juju-core:
importance: Medium → High
tags: added: bug-squad
Revision history for this message
Cheryl Jennings (cherylj) wrote :

Could you give an example of a charm with a particularly ugly `juju get` output, as well as the juju version you're using? The ones I've been looking at seem okay, and there may have been some changes between versions.

Revision history for this message
Caio Begotti (caio1982) wrote :

I believe the original bug description was from the quantum-gateway charm. The charm I mentioned in comment #4 was capomastro, which is private though the problem can be simulated with a dummy charm anyway. Juju version I'm using is 1.22.6-trusty-amd64.

Revision history for this message
Cheryl Jennings (cherylj) wrote :

I guess at this point, all the charms I've looked at have been written to work around this issue, so I'll spend some time creating a dummy charm and seeing how the output looks.

Revision history for this message
Jay R. Wren (evarlast) wrote : Re: [Bug 1292116] Re: juju get output is ugly (broken line wrapping and escape characters)

The apache2 charm exhibits this behavior.

Take a look at the config.yaml. Most multilines are done via
indentation or > instead of |, but the one attribute which uses |
shows this behavior.

  nagios_context:
    default: true
    description: |
      Used by the nrpe-external-master subordinate charm. A string
that will be prepended to instance name to set the host name in
nagios. So for instance the hostname would be something like:
          juju-postgresql-0
      If you're running multiple environments with the same services
in them this allows you to differentiate between them.
    type: string
    value: juju

The wrapping on nagios_context description is just odd and not valid
yaml because it is wrapped and not indented.

On Thu, Oct 29, 2015 at 10:34 AM, Cheryl Jennings
<email address hidden> wrote:
> I guess at this point, all the charms I've looked at have been written
> to work around this issue, so I'll spend some time creating a dummy
> charm and seeing how the output looks.
>
> --
> You received this bug notification because you are subscribed to a
> duplicate bug report (1356498).
> https://bugs.launchpad.net/bugs/1292116
>
> Title:
> juju get output is ugly (broken line wrapping and escape characters)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/juju-core/+bug/1292116/+subscriptions

Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 1.26-alpha1 → 1.26-alpha2
Changed in juju-core:
milestone: 1.26-alpha2 → 1.26.0
Changed in juju-core:
milestone: 1.26.0 → 2.0-alpha2
Changed in juju-core:
milestone: 2.0-alpha2 → 2.0-alpha3
Changed in juju-core:
milestone: 2.0-alpha3 → 2.0-beta4
Changed in juju-core:
milestone: 2.0-beta4 → 2.0.0
affects: juju-core → juju
Changed in juju:
milestone: 2.0.0 → none
milestone: none → 2.0.0
Changed in juju:
milestone: 2.0.0 → 2.1.0
Revision history for this message
Anastasia (anastasia-macmood) wrote :

As this is mostly cosmetic and has a workaround, I am reducing it to Medium and removing it from a milestone. This is a desirable rather than must-have at the moment.

Changed in juju:
importance: High → Medium
milestone: 2.1.0 → none
tags: added: usability
Revision history for this message
Anastasia (anastasia-macmood) wrote :

We believe that this has been recently addressed on 2.3-beta2+ by: https://github.com/juju/juju/commit/911e093c61f699ee27c326a3fd836435aa31f2fa

Revision history for this message
Anastasia (anastasia-macmood) wrote :

The content of 'juju get' has been changed to be more descriptive, as per comment # 11. Escape characters and broken line wrapping will need to be a follow-up.

tags: added: helptext
Revision history for this message
Anastasia (anastasia-macmood) wrote :

Since this bug was filed, a lot work was undertaken in the area and whilst the command itself has changed to 'config' and the output has been significantly modified (for example, with the addition of default values, etc), the bug itself has not been updated...

Here is how the output of 'juju config quantum-gateway' looks now - https://pastebin.ubuntu.com/p/TSm5s7GV7q/. No more broken lines wrapping or escape characters.

I will mark this bug as Fix Released. Please open a new report if there are further improvements that will make application configuration more readable.

Changed in juju:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.