[2.7.1] action-get with --format=json returns 'null' when no parameters are defined for an action

Bug #1862026 reported by Dmitrii Shcherbakov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Harry Pidcock

Bug Description

cat actions.yaml
test: {}

It appears to be that action-get returns 'null' when `--format=json` is used and there are no parameters defined for an action in actions.yaml. An empty dict is returned without `--format=json` which seems inconsistent.

# with an RPDB trace set up in a charm code:
juju run-action <unit> test --wait

(Pdb) subprocess.check_output(['action-get', '--format=json'])
b'null\n'

(Pdb) type(json.loads(subprocess.check_output(['action-get', '--format=json']).decode('utf-8')))
<class 'NoneType'>

(Pdb) subprocess.check_output(['action-get']).decode('utf-8')
'{}\n'

Related discussion:
https://github.com/canonical/operator/pull/132#discussion_r375271096

Changed in juju:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.7.2
Changed in juju:
milestone: 2.7.2 → 2.7.3
Changed in juju:
milestone: 2.7.3 → 2.7.4
Changed in juju:
milestone: 2.7.4 → 2.7.5
Changed in juju:
milestone: 2.7.5 → 2.7.6
Ian Booth (wallyworld)
Changed in juju:
milestone: 2.7.6 → 2.8-rc1
Revision history for this message
Harry Pidcock (hpidcock) wrote :
Changed in juju:
assignee: nobody → Harry Pidcock (hpidcock)
Ian Booth (wallyworld)
Changed in juju:
status: Triaged → Fix Committed
Harry Pidcock (hpidcock)
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.