@@ -80,10 +80,10 @@ def do_custom(self):
80
80
if gitlab .mixins .GetWithoutIdMixin not in inspect .getmro (self .cls ):
81
81
data [self .cls ._id_attr ] = self .args .pop (self .cls ._id_attr )
82
82
o = self .cls (self .mgr , data )
83
+ method_name = self .action .replace ('-' , '_' )
84
+ return getattr (o , method_name )(** self .args )
83
85
else :
84
- o = self .mgr
85
- method_name = self .action .replace ('-' , '_' )
86
- return getattr (o , method_name )(** self .args )
86
+ return getattr (self .mgr , self .action )(** self .args )
87
87
88
88
def do_project_export_download (self ):
89
89
try :
@@ -217,14 +217,14 @@ def _populate_sub_parser_by_class(cls, sub_parser):
217
217
for x in mgr_cls ._from_parent_attrs ]
218
218
sub_parser_action .add_argument ("--sudo" , required = False )
219
219
220
- required , optional , needs_id = cli .custom_actions [name ][action_name ]
221
220
# We need to get the object somehow
222
- if needs_id and gitlab .mixins .GetWithoutIdMixin not in inspect .getmro (cls ):
221
+ if gitlab .mixins .GetWithoutIdMixin not in inspect .getmro (cls ):
223
222
if cls ._id_attr is not None :
224
223
id_attr = cls ._id_attr .replace ('_' , '-' )
225
224
sub_parser_action .add_argument ("--%s" % id_attr ,
226
225
required = True )
227
226
227
+ required , optional , dummy = cli .custom_actions [name ][action_name ]
228
228
[sub_parser_action .add_argument ("--%s" % x .replace ('_' , '-' ),
229
229
required = True )
230
230
for x in required if x != cls ._id_attr ]
0 commit comments