@@ -1201,6 +1201,7 @@ class ProjectCommitStatusManager(ListMixin, CreateMixin, RESTManager):
1201
1201
('description' , 'name' , 'context' , 'ref' , 'target_url' ,
1202
1202
'coverage' ))
1203
1203
1204
+ @exc .on_http_error (exc .GitlabCreateError )
1204
1205
def create (self , data , ** kwargs ):
1205
1206
"""Create a new object.
1206
1207
@@ -1218,9 +1219,15 @@ def create(self, data, **kwargs):
1218
1219
RESTObject: A new instance of the manage object class build with
1219
1220
the data sent by the server
1220
1221
"""
1221
- path = '/projects/%(project_id)s/statuses/%(commit_id)s'
1222
- computed_path = self ._compute_path (path )
1223
- return CreateMixin .create (self , data , path = computed_path , ** kwargs )
1222
+ # project_id and commit_id are in the data dict when using the CLI, but
1223
+ # they are missing when using only the API
1224
+ # See #511
1225
+ base_path = '/projects/%(project_id)s/statuses/%(commit_id)s'
1226
+ if 'project_id' in data and 'commit_id' in data :
1227
+ path = base_path % data
1228
+ else :
1229
+ path = self ._compute_path (base_path )
1230
+ return CreateMixin .create (self , data , path = path , ** kwargs )
1224
1231
1225
1232
1226
1233
class ProjectCommitComment (RESTObject ):
0 commit comments