From 53938d9d94b1d3c292fbe89e4494d0e5cbec6b52 Mon Sep 17 00:00:00 2001 From: Dmitriy Smirnov Date: Sun, 21 Jul 2024 11:02:57 +0300 Subject: [PATCH] Improve code style and docstring for the method `DecortController.account_find` --- module_utils/decort_utils.py | 45 +++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/module_utils/decort_utils.py b/module_utils/decort_utils.py index 014947e..381daf3 100644 --- a/module_utils/decort_utils.py +++ b/module_utils/decort_utils.py @@ -2024,49 +2024,52 @@ class DecortController(object): self.result['changed'] = True return - def account_find(self, account_name: str, account_id=0, - resource_consumption=False, - resource_groups_args: None | dict = None, - computes_args: None | dict = None, - vinses_args: None | dict = None, - fail_if_not_found=False): + def account_find( + self, + account_id=0, + account_name: str = '', + computes_args: None | dict = None, + fail_if_not_found=False, + resource_consumption=False, + resource_groups_args: None | dict = None, + vinses_args: None | dict = None, + ): """ Find account specified by account ID or name and return a turple with account ID and account info dict. + @param (int) account_id: ID of the account to find. + @param (string) account_name: name of the account to find. - Pass empty string if you want to find account by ID. - @param (int) account_id: ID of the account to find. + @param (None | dict) computes_args: If dict is + specified, then the method `self.account_computes` + will be called passing founded account ID + and `**computes_args`. Result of the call will + be added to account info dict (key `computes`). + + @param (bool) fail_if_not_found: If `True` is specified, then + the method `self.amodule.fail_json(**self.result)` will be + called if account is not found. @param (bool) resource_consumption: If `True` is specified, - then the method `account_resource_consumption` + then the method `self.account_resource_consumption` will be called passing founded account ID and result of the call will be added to account info dict (key `resource_consumption`). @param (None | dict) resource_groups_args: If dict is - specified, then the method `account_resource_groups` + specified, then the method `self.account_resource_groups` will be called passing founded account ID and `**resource_groups_args`. Result of the call will be added to account info dict (key `resource_groups`). - @param (None | dict) computes_args: If dict is - specified, then the method `account_computes` - will be called passing founded account ID - and `**computes_args`. Result of the call will - be added to account info dict (key `computes`). - @param (None | dict) vinses_args: If dict is - specified, then the method `account_vinses` + specified, then the method `self.account_vinses` will be called passing founded account ID and `**vinses_args`. Result of the call will be added to account info dict (key `vinses`). - @param (bool) fail_if_not_found: If `True` is specified, then - the method `self.amodule.fail_json(**self.result)` will be - called if account is not found. - Returns non zero account ID and account info dict on success, 0 and empty dict otherwise (if `fail_if_not_found=False`). """