summaryrefslogtreecommitdiff
path: root/gitlab/v4/cli.py
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-01-22 00:11:26 +0100
committerNejc Habjan <nejc.habjan@siemens.com>2022-01-22 00:50:40 +0100
commit109d730d5f67fbc45114e59d5aae4edc66229ff1 (patch)
tree60e6e1810839faff6c14e1a81aff4971eae6c7e0 /gitlab/v4/cli.py
parentff049005cc9e5161eddda786e58ed4364639cf02 (diff)
downloadgitlab-fix/cli-manager-custom-methods.tar.gz
fix(cli): allow custom methods in managersfix/cli-manager-custom-methods
Diffstat (limited to 'gitlab/v4/cli.py')
-rw-r--r--gitlab/v4/cli.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index 504b7a9..ddce8b6 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -94,6 +94,7 @@ class GitlabCLI(object):
return self.do_custom()
def do_custom(self) -> Any:
+ class_instance: Union[gitlab.base.RESTManager, gitlab.base.RESTObject]
in_obj = cli.custom_actions[self.cls_name][self.action][2]
# Get the object (lazy), then act
@@ -106,11 +107,12 @@ class GitlabCLI(object):
if TYPE_CHECKING:
assert isinstance(self.cls._id_attr, str)
data[self.cls._id_attr] = self.args.pop(self.cls._id_attr)
- obj = self.cls(self.mgr, data)
- method_name = self.action.replace("-", "_")
- return getattr(obj, method_name)(**self.args)
+ class_instance = self.cls(self.mgr, data)
else:
- return getattr(self.mgr, self.action)(**self.args)
+ class_instance = self.mgr
+
+ method_name = self.action.replace("-", "_")
+ return getattr(class_instance, method_name)(**self.args)
def do_project_export_download(self) -> None:
try: