Skip to content

Commit b05c0b6

Browse files
author
Gauvain Pocentek
committed
[CLI] Fix wrong use of arguments
The previous change removed undefined arguments from the args dict, don't try to use possibly missing arguments without a fallback value.
1 parent f4fcf45 commit b05c0b6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gitlab/cli.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def do_project_search(self, cls, gl, what, args):
181181

182182
def do_project_all(self, cls, gl, what, args):
183183
try:
184-
return gl.projects.all(all=args['all'])
184+
return gl.projects.all(all=args.get('all', False))
185185
except Exception as e:
186186
_die("Impossible to list all projects", e)
187187

@@ -333,10 +333,10 @@ def do_project_merge_request_cancel(self, cls, gl, what, args):
333333
def do_project_merge_request_merge(self, cls, gl, what, args):
334334
try:
335335
o = self.do_get(cls, gl, what, args)
336-
should_remove = args['should_remove_source_branch']
337-
build_succeeds = args['merged_when_build_succeeds']
336+
should_remove = args.get('should_remove_source_branch', False)
337+
build_succeeds = args.get('merged_when_build_succeeds', False)
338338
return o.merge(
339-
merge_commit_message=args['merge_commit_message'],
339+
merge_commit_message=args.get('merge_commit_message', ''),
340340
should_remove_source_branch=should_remove,
341341
merged_when_build_succeeds=build_succeeds)
342342
except Exception as e:

0 commit comments

Comments
 (0)