Skip to content

Commit

Permalink
The command 'juju show-cloud' does not support JSON format
Browse files Browse the repository at this point in the history
The PR canonical#228 [1] changed to use jq instead of sed to parse yaml
when relocating two lines. However, yaml format is not supported
in versions prior to juju 3.x.

$ juju show-cloud localhost --format json
ERROR invalid value "json" for option --format: unknown format "json"

Therefore, we need to revert back to the previous two lines
to support both juju 2.x and juju 3.x simultaneously.

[1] canonical#228
  • Loading branch information
zhhuabj committed Sep 19, 2024
1 parent e2a1c85 commit bbb3235
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/helpers
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ list_overlays ()

get_cloud_type ()
{
local cloud=$(juju show-model --format json |jq -r '[.[].cloud] | unique[]')
local type=$(juju show-cloud $cloud --format json | jq -r '[.[].type] | unique[]')
local cloud=`juju show-model| sed -rn 's/.+cloud:\s*(.+).*/\1/p'| uniq`
local type=`juju show-cloud $cloud| sed -rn 's/^type:\s*(.+).*/\1/p'| uniq`
echo "$type"
}

Expand Down

0 comments on commit bbb3235

Please sign in to comment.