@@ -2262,7 +2262,19 @@ async def set_constraints(self, constraints):
22622262 constraints = constraints )
22632263
22642264 async def get_action_output (self , action_uuid , wait = None ):
2265- """Get the results of an action by ID.
2265+ """ Get the results of an action by ID.
2266+
2267+ :param str action_uuid: Id of the action
2268+ :param int wait: Time in seconds to wait for action to complete.
2269+ :return dict: Output from action
2270+ :raises: :class:`JujuError` if invalid action_uuid
2271+ """
2272+ action = await self ._get_completed_action (action_uuid , wait = wait )
2273+ # ActionResult.output is None if the action produced no output
2274+ return {} if action .output is None else action .output
2275+
2276+ async def _get_completed_action (self , action_uuid , wait = None ):
2277+ """Get the completed internal _definitions.Action object.
22662278
22672279 :param str action_uuid: Id of the action
22682280 :param int wait: Time in seconds to wait for action to complete.
@@ -2288,13 +2300,8 @@ async def _wait_for_action_status():
22882300 await jasyncio .wait_for (
22892301 _wait_for_action_status (),
22902302 timeout = wait )
2291- action_output = await action_facade .Actions (entities = entity )
2292- # ActionResult.output is None if the action produced no output
2293- if action_output .results [0 ].output is None :
2294- output = {}
2295- else :
2296- output = action_output .results [0 ].output
2297- return output
2303+ action_results = await action_facade .Actions (entities = entity )
2304+ return action_results .results [0 ]
22982305
22992306 async def get_action_status (self , uuid_or_prefix = None , name = None ):
23002307 """Get the status of all actions, filtered by ID, ID prefix, or name.
0 commit comments