juju config does not print new line at end of output

Bug #1879809 reported by Joe Guo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Simon Richardson

Bug Description

For example:

juju config octavia amp-image-tag
octavia-amphoraMyBashPrompt

It's even worse for complex output:

juju config kubernetes-master api-extra-args
api-extra-args=oidc-issuer-url=https://accounts.google.com oidc-client-id=1234567890-lbkinbhxxxv81xxxjrt13xasik17fqh.apps.googleusercontent.com oidc-username-claim=email oidc-groups-claim=groups enable-admission-plugins=PersistentVolumeLabel,NodeRestriction,PodSecurityPolicyMyBashPrompt

The config output joines seamlessly with bash prompt, users need to be very careful to find out the real output.
For those who are not aware of this, they may just copy the joined output to docs or apply to other envs, which is dangerours.

Tags: bitesize
Ian Booth (wallyworld)
Changed in juju:
milestone: none → 2.8.1
importance: Undecided → High
status: New → Triaged
tags: added: bitesize
Changed in juju:
assignee: nobody → Simon Richardson (simonrichardson)
status: Triaged → In Progress
Revision history for this message
Simon Richardson (simonrichardson) wrote :

Removing the milestone as we can't fix this because we'll end up breaking existing scripts - see https://github.com/juju/juju/blob/74c3a01c2f7f8d53db9452a65de6b5b14818fca6/cmd/juju/application/config.go#L415-L417

We can do this in Juju 3 at some point.

Changed in juju:
assignee: Simon Richardson (simonrichardson) → nobody
status: In Progress → Triaged
milestone: 2.8.1 → none
Revision history for this message
Pen Gale (pengale) wrote :

Per inline comment in the code, this would break existing scripts, and needs to wait for Juju 3.0.

Revision history for this message
Ian Booth (wallyworld) wrote :

Are we sure it will "break all existing scripts"?
eg

$ password=`juju config mysql root_password`
$ echo $password
secret

runs the same regardless of whether there's a new line added or not.

As we the new actions UX, we can always enable the fix via an opt in feature flag, but really, in this case we should just make the fix.

Changed in juju:
milestone: none → 2.8.1
Revision history for this message
Simon Richardson (simonrichardson) wrote :

I'll enable this with a opt-in feature flag then.

Changed in juju:
assignee: nobody → Simon Richardson (simonrichardson)
Revision history for this message
Ian Booth (wallyworld) wrote :

No flag needed since having a new line or not doesn't affect the primary script use case. It's overkill, we just need to add the \n.

Changed in juju:
status: Triaged → In Progress
Revision history for this message
Simon Richardson (simonrichardson) wrote :
Ian Booth (wallyworld)
Changed in juju:
status: In Progress → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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