diff options
author | Max Wittig <max.wittig95@gmail.com> | 2019-05-10 17:23:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-10 17:23:52 +0200 |
commit | e8823e91b04fd6cf3838ad256c02373db7029191 (patch) | |
tree | 6d4a2e9edf80ff941fc3de39fec17e60a8101952 /gitlab/v4/cli.py | |
parent | 84bcdc0c452d2ada9a47aa9907d7551aeac23821 (diff) | |
parent | 6158fd23022b2e2643b6da7a39708b28ce59270a (diff) | |
download | gitlab-e8823e91b04fd6cf3838ad256c02373db7029191.tar.gz |
Merge pull request #760 from kkoralsky/custom_cli_actions_fix
Custom cli actions fix
Diffstat (limited to 'gitlab/v4/cli.py')
-rw-r--r-- | gitlab/v4/cli.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py index 242874d..4e15642 100644 --- a/gitlab/v4/cli.py +++ b/gitlab/v4/cli.py @@ -80,10 +80,10 @@ class GitlabCLI(object): if gitlab.mixins.GetWithoutIdMixin not in inspect.getmro(self.cls): data[self.cls._id_attr] = self.args.pop(self.cls._id_attr) o = self.cls(self.mgr, data) - method_name = self.action.replace('-', '_') - return getattr(o, method_name)(**self.args) else: - return getattr(self.mgr, self.action)(**self.args) + o = self.mgr + method_name = self.action.replace('-', '_') + return getattr(o, method_name)(**self.args) def do_project_export_download(self): try: @@ -217,14 +217,14 @@ def _populate_sub_parser_by_class(cls, sub_parser): for x in mgr_cls._from_parent_attrs] sub_parser_action.add_argument("--sudo", required=False) + required, optional, needs_id = cli.custom_actions[name][action_name] # We need to get the object somehow - if gitlab.mixins.GetWithoutIdMixin not in inspect.getmro(cls): + if needs_id and gitlab.mixins.GetWithoutIdMixin not in inspect.getmro(cls): if cls._id_attr is not None: id_attr = cls._id_attr.replace('_', '-') sub_parser_action.add_argument("--%s" % id_attr, required=True) - required, optional, dummy = cli.custom_actions[name][action_name] [sub_parser_action.add_argument("--%s" % x.replace('_', '-'), required=True) for x in required if x != cls._id_attr] |