@@ -133,52 +133,130 @@ def get_alias():
133133
134134 return vals
135135
136- def add_external_tracker (self , bug_ids , type_desc , external_id ):
136+ def add_external_tracker (self , bug_ids , ext_bz_bug_id , ext_type_id = None ,
137+ ext_type_description = None , ext_type_url = None ,
138+ ext_status = None , ext_description = None ,
139+ ext_priority = None ):
137140 """
138141 Wrapper method to allow adding of external tracking bugs using the
139142 ExternalBugs::WebService::add_external_bug method.
140143
141144 This is documented at
142145 https://bugzilla.redhat.com/docs/en/html/api/extensions/ExternalBugs/lib/WebService.html#add_external_bug
143146
144- bug_ids: A single bug id or list if bug ids to add the tracker to.
145- type_desc: The external tracker description as used by Bugzilla. This
146- value maps to the ext_type_description parameter of the XMLRPC
147- method.
148- external_id: The id as used by the external tracker. This value maps to
149- the ext_bz_bug_id parameter of the XMLRPC method.
147+ bug_ids: A single bug id or list of bug ids to have external trackers
148+ added.
149+ ext_bz_bug_id: The external bug id (ie: the bug number in the
150+ external tracker).
151+ ext_type_id: The external tracker id as used by Bugzilla.
152+ ext_type_description: The external tracker description as used by
153+ Bugzilla.
154+ ext_type_url: The external tracker url as used by Bugzilla.
155+ ext_status: The status of the external bug.
156+ ext_description: The description of the external bug.
157+ ext_priority: The priority of the external bug.
150158 """
151- kwargs = {
159+ param_dict = {'ext_bz_bug_id' : ext_bz_bug_id }
160+ if ext_type_id is not None :
161+ param_dict ['ext_type_id' ] = ext_type_id
162+ if ext_type_description is not None :
163+ param_dict ['ext_type_description' ] = ext_type_description
164+ if ext_type_url is not None :
165+ param_dict ['ext_type_url' ] = ext_type_url
166+ if ext_status is not None :
167+ param_dict ['ext_status' ] = ext_status
168+ if ext_description is not None :
169+ param_dict ['ext_description' ] = ext_description
170+ if ext_priority is not None :
171+ param_dict ['ext_priority' ] = ext_priority
172+ params = {
152173 'bug_ids' : self ._listify (bug_ids ),
153- 'external_bugs' : [{
154- 'ext_type_description' : type_desc ,
155- 'ext_bz_bug_id' : external_id ,
156- }],
174+ 'external_bugs' : [param_dict ],
157175 }
158- return self ._proxy .ExternalBugs .add_external_bug (kwargs )
176+ return self ._proxy .ExternalBugs .add_external_bug (params )
159177
160- def remove_external_tracker (self , bug_ids , type_desc , external_ids ):
178+ def update_external_tracker (self , ids = None , ext_type_id = None ,
179+ ext_type_description = None , ext_type_url = None ,
180+ ext_bz_bug_id = None , bug_ids = None ,
181+ ext_status = None , ext_description = None ,
182+ ext_priority = None ):
183+ """
184+ Wrapper method to allow adding of external tracking bugs using the
185+ ExternalBugs::WebService::update_external_bug method.
186+
187+ This is documented at
188+ https://bugzilla.redhat.com/docs/en/html/api/extensions/ExternalBugs/lib/WebService.html#update_external_bug
189+
190+ ids: A single external tracker bug id or list of external tracker bug
191+ ids.
192+ ext_type_id: The external tracker id as used by Bugzilla.
193+ ext_type_description: The external tracker description as used by
194+ Bugzilla.
195+ ext_type_url: The external tracker url as used by Bugzilla.
196+ ext_bz_bug_id: A single external bug id or list of external bug ids
197+ (ie: the bug number in the external tracker).
198+ bug_ids: A single bug id or list of bug ids to have external tracker
199+ info updated.
200+ ext_status: The status of the external bug.
201+ ext_description: The description of the external bug.
202+ ext_priority: The priority of the external bug.
203+ """
204+ params = {}
205+ if ids is not None :
206+ params ['ids' ] = self ._listify (ids )
207+ if ext_type_id is not None :
208+ params ['ext_type_id' ] = ext_type_id
209+ if ext_type_description is not None :
210+ params ['ext_type_description' ] = ext_type_description
211+ if ext_type_url is not None :
212+ params ['ext_type_url' ] = ext_type_url
213+ if ext_bz_bug_id is not None :
214+ params ['ext_bz_bug_id' ] = self ._listify (ext_bz_bug_id )
215+ if bug_ids is not None :
216+ params ['bug_ids' ] = self ._listify (bug_ids )
217+ if ext_status is not None :
218+ params ['ext_status' ] = ext_status
219+ if ext_description is not None :
220+ params ['ext_description' ] = ext_description
221+ if ext_priority is not None :
222+ params ['ext_priority' ] = ext_priority
223+ return self ._proxy .ExternalBugs .update_external_bug (params )
224+
225+ def remove_external_tracker (self , ids = None , ext_type_id = None ,
226+ ext_type_description = None , ext_type_url = None ,
227+ ext_bz_bug_id = None , bug_ids = None ):
161228 """
162229 Wrapper method to allow removal of external tracking bugs using the
163230 ExternalBugs::WebService::remove_external_bug method.
164231
165232 This is documented at
166233 https://bugzilla.redhat.com/docs/en/html/api/extensions/ExternalBugs/lib/WebService.html#remove_external_bug
167234
168- bug_ids: A single bug id or list if bug ids to remove the tracker from.
169- type_desc: The external tracker description as used by Bugzilla. This
170- value maps to the ext_type_description parameter of the XMLRPC
171- method.
172- external_ids: The id or list of ids as used by the external tracker.
173- This value maps to the ext_bz_bug_id parameter of the XMLRPC
174- method.
235+ ids: A single external tracker bug id or list of external tracker bug
236+ ids.
237+ ext_type_id: The external tracker id as used by Bugzilla.
238+ ext_type_description: The external tracker description as used by
239+ Bugzilla.
240+ ext_type_url: The external tracker url as used by Bugzilla.
241+ ext_bz_bug_id: A single external bug id or list of external bug ids
242+ (ie: the bug number in the external tracker).
243+ bug_ids: A single bug id or list of bug ids to have external tracker
244+ info updated.
175245 """
176- kwargs = {
177- 'bug_ids' : self ._listify (bug_ids ),
178- 'ext_type_description' : type_desc ,
179- 'ext_bz_bug_id' : self ._listify (external_ids ),
180- }
181- return self ._proxy .ExternalBugs .remove_external_bug (kwargs )
246+ params = {}
247+ if ids is not None :
248+ params ['ids' ] = self ._listify (ids )
249+ if ext_type_id is not None :
250+ params ['ext_type_id' ] = ext_type_id
251+ if ext_type_description is not None :
252+ params ['ext_type_description' ] = ext_type_description
253+ if ext_type_url is not None :
254+ params ['ext_type_url' ] = ext_type_url
255+ if ext_bz_bug_id is not None :
256+ params ['ext_bz_bug_id' ] = self ._listify (ext_bz_bug_id )
257+ if bug_ids is not None :
258+ params ['bug_ids' ] = self ._listify (bug_ids )
259+ return self ._proxy .ExternalBugs .remove_external_bug (params )
182260
183261
184262 #################
@@ -285,29 +363,41 @@ def post_translation(self, query, bug):
285363 bug ['groups' ] = tmp
286364
287365 def build_external_tracker_boolean_query (
288- self , type_desc = None , external_id = None ):
366+ self , ext_type_description = None , ext_type_url = None ,
367+ ext_bz_bug_id = None , ext_status = None ):
289368 """
290369 Helper method to build a boolean query to find bugs that contain an
291- external tracker with the 'type_desc' and 'external_id' combination .
370+ external tracker.
292371
293372 All parameters that are None will be ignored when building the query.
294373
295- type_desc: The external tracker description as used by Bugzilla. This
296- value maps to the external_bugzilla.description field.
297- external_ids: The id as used by the external tracker. This value maps
298- to the ext_bz_bug_map.ext_bz_bug_id field.
374+ ext_type_description: The external tracker description as used by
375+ Bugzilla.
376+ ext_type_url: The external tracker url as used by Bugzilla.
377+ ext_bz_bug_id: The external bug id (ie: the bug number in the
378+ external tracker).
379+ ext_status: The status of the external bug.
299380 """
300381 parts = []
301382
302- if type_desc is not None :
383+ if ext_type_description is not None :
384+ parts .append (
385+ 'external_bugzilla.description-equals-{0:s}' .format (
386+ ext_type_description ))
387+
388+ if ext_type_url is not None :
303389 parts .append (
304- 'external_bugzilla.description -equals-{0:s}' .format (type_desc ))
390+ 'external_bugzilla.url -equals-{0:s}' .format (ext_type_url ))
305391
306- if external_id is not None :
307- id_str = str (external_id )
392+ if ext_bz_bug_id is not None :
393+ id_str = str (ext_bz_bug_id )
308394 parts .append (
309395 'ext_bz_bug_map.ext_bz_bug_id-equals-{0:s}' .format (id_str ))
310396
397+ if ext_status is not None :
398+ parts .append (
399+ 'ext_bz_bug_map.ext_status-equals-{0:s}' .format (ext_status ))
400+
311401 return ' & ' .join (parts )
312402
313403 def build_query (self , ** kwargs ):
0 commit comments