Skip to content

Commit 0bdf89d

Browse files
committed
rhbugzilla: Move external_bug API wrappers to BugzillaBase
While RHBugzilla is the only instance that I know of with this extension enabled, it's not strictly rhbugzilla specific behavior, and keeping it separate framents the API. Move it Signed-off-by: Cole Robinson <[email protected]>
1 parent 3b28e7f commit 0bdf89d

2 files changed

Lines changed: 136 additions & 131 deletions

File tree

bugzilla/base.py

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,3 +1812,139 @@ def updateperms(self, user, action, groups):
18121812
}
18131813

18141814
return self._backend.user_update(update)
1815+
1816+
1817+
#############################
1818+
# ExternalBugs API wrappers #
1819+
#############################
1820+
1821+
def add_external_tracker(self, bug_ids, ext_bz_bug_id, ext_type_id=None,
1822+
ext_type_description=None, ext_type_url=None,
1823+
ext_status=None, ext_description=None,
1824+
ext_priority=None):
1825+
"""
1826+
Wrapper method to allow adding of external tracking bugs using the
1827+
ExternalBugs::WebService::add_external_bug method.
1828+
1829+
This is documented at
1830+
https://bugzilla.redhat.com/docs/en/html/api/extensions/ExternalBugs/lib/WebService.html#add_external_bug
1831+
1832+
bug_ids: A single bug id or list of bug ids to have external trackers
1833+
added.
1834+
ext_bz_bug_id: The external bug id (ie: the bug number in the
1835+
external tracker).
1836+
ext_type_id: The external tracker id as used by Bugzilla.
1837+
ext_type_description: The external tracker description as used by
1838+
Bugzilla.
1839+
ext_type_url: The external tracker url as used by Bugzilla.
1840+
ext_status: The status of the external bug.
1841+
ext_description: The description of the external bug.
1842+
ext_priority: The priority of the external bug.
1843+
"""
1844+
param_dict = {'ext_bz_bug_id': ext_bz_bug_id}
1845+
if ext_type_id is not None:
1846+
param_dict['ext_type_id'] = ext_type_id
1847+
if ext_type_description is not None:
1848+
param_dict['ext_type_description'] = ext_type_description
1849+
if ext_type_url is not None:
1850+
param_dict['ext_type_url'] = ext_type_url
1851+
if ext_status is not None:
1852+
param_dict['ext_status'] = ext_status
1853+
if ext_description is not None:
1854+
param_dict['ext_description'] = ext_description
1855+
if ext_priority is not None:
1856+
param_dict['ext_priority'] = ext_priority
1857+
params = {
1858+
'bug_ids': listify(bug_ids),
1859+
'external_bugs': [param_dict],
1860+
}
1861+
1862+
log.debug("Calling ExternalBugs.add_external_bug(%s)", params)
1863+
return self._backend.externalbugs_add(params)
1864+
1865+
def update_external_tracker(self, ids=None, ext_type_id=None,
1866+
ext_type_description=None, ext_type_url=None,
1867+
ext_bz_bug_id=None, bug_ids=None,
1868+
ext_status=None, ext_description=None,
1869+
ext_priority=None):
1870+
"""
1871+
Wrapper method to allow adding of external tracking bugs using the
1872+
ExternalBugs::WebService::update_external_bug method.
1873+
1874+
This is documented at
1875+
https://bugzilla.redhat.com/docs/en/html/api/extensions/ExternalBugs/lib/WebService.html#update_external_bug
1876+
1877+
ids: A single external tracker bug id or list of external tracker bug
1878+
ids.
1879+
ext_type_id: The external tracker id as used by Bugzilla.
1880+
ext_type_description: The external tracker description as used by
1881+
Bugzilla.
1882+
ext_type_url: The external tracker url as used by Bugzilla.
1883+
ext_bz_bug_id: A single external bug id or list of external bug ids
1884+
(ie: the bug number in the external tracker).
1885+
bug_ids: A single bug id or list of bug ids to have external tracker
1886+
info updated.
1887+
ext_status: The status of the external bug.
1888+
ext_description: The description of the external bug.
1889+
ext_priority: The priority of the external bug.
1890+
"""
1891+
params = {}
1892+
if ids is not None:
1893+
params['ids'] = listify(ids)
1894+
if ext_type_id is not None:
1895+
params['ext_type_id'] = ext_type_id
1896+
if ext_type_description is not None:
1897+
params['ext_type_description'] = ext_type_description
1898+
if ext_type_url is not None:
1899+
params['ext_type_url'] = ext_type_url
1900+
if ext_bz_bug_id is not None:
1901+
params['ext_bz_bug_id'] = listify(ext_bz_bug_id)
1902+
if bug_ids is not None:
1903+
params['bug_ids'] = listify(bug_ids)
1904+
if ext_status is not None:
1905+
params['ext_status'] = ext_status
1906+
if ext_description is not None:
1907+
params['ext_description'] = ext_description
1908+
if ext_priority is not None:
1909+
params['ext_priority'] = ext_priority
1910+
1911+
log.debug("Calling ExternalBugs.update_external_bug(%s)", params)
1912+
return self._backend.externalbugs_update(params)
1913+
1914+
def remove_external_tracker(self, ids=None, ext_type_id=None,
1915+
ext_type_description=None, ext_type_url=None,
1916+
ext_bz_bug_id=None, bug_ids=None):
1917+
"""
1918+
Wrapper method to allow removal of external tracking bugs using the
1919+
ExternalBugs::WebService::remove_external_bug method.
1920+
1921+
This is documented at
1922+
https://bugzilla.redhat.com/docs/en/html/api/extensions/ExternalBugs/lib/WebService.html#remove_external_bug
1923+
1924+
ids: A single external tracker bug id or list of external tracker bug
1925+
ids.
1926+
ext_type_id: The external tracker id as used by Bugzilla.
1927+
ext_type_description: The external tracker description as used by
1928+
Bugzilla.
1929+
ext_type_url: The external tracker url as used by Bugzilla.
1930+
ext_bz_bug_id: A single external bug id or list of external bug ids
1931+
(ie: the bug number in the external tracker).
1932+
bug_ids: A single bug id or list of bug ids to have external tracker
1933+
info updated.
1934+
"""
1935+
params = {}
1936+
if ids is not None:
1937+
params['ids'] = listify(ids)
1938+
if ext_type_id is not None:
1939+
params['ext_type_id'] = ext_type_id
1940+
if ext_type_description is not None:
1941+
params['ext_type_description'] = ext_type_description
1942+
if ext_type_url is not None:
1943+
params['ext_type_url'] = ext_type_url
1944+
if ext_bz_bug_id is not None:
1945+
params['ext_bz_bug_id'] = listify(ext_bz_bug_id)
1946+
if bug_ids is not None:
1947+
params['bug_ids'] = listify(bug_ids)
1948+
1949+
log.debug("Calling ExternalBugs.remove_external_bug(%s)", params)
1950+
return self._backend.externalbugs_remove(params)

bugzilla/rhbugzilla.py

Lines changed: 0 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -111,137 +111,6 @@ def get_alias():
111111

112112
return vals
113113

114-
def add_external_tracker(self, bug_ids, ext_bz_bug_id, ext_type_id=None,
115-
ext_type_description=None, ext_type_url=None,
116-
ext_status=None, ext_description=None,
117-
ext_priority=None):
118-
"""
119-
Wrapper method to allow adding of external tracking bugs using the
120-
ExternalBugs::WebService::add_external_bug method.
121-
122-
This is documented at
123-
https://bugzilla.redhat.com/docs/en/html/api/extensions/ExternalBugs/lib/WebService.html#add_external_bug
124-
125-
bug_ids: A single bug id or list of bug ids to have external trackers
126-
added.
127-
ext_bz_bug_id: The external bug id (ie: the bug number in the
128-
external tracker).
129-
ext_type_id: The external tracker id as used by Bugzilla.
130-
ext_type_description: The external tracker description as used by
131-
Bugzilla.
132-
ext_type_url: The external tracker url as used by Bugzilla.
133-
ext_status: The status of the external bug.
134-
ext_description: The description of the external bug.
135-
ext_priority: The priority of the external bug.
136-
"""
137-
param_dict = {'ext_bz_bug_id': ext_bz_bug_id}
138-
if ext_type_id is not None:
139-
param_dict['ext_type_id'] = ext_type_id
140-
if ext_type_description is not None:
141-
param_dict['ext_type_description'] = ext_type_description
142-
if ext_type_url is not None:
143-
param_dict['ext_type_url'] = ext_type_url
144-
if ext_status is not None:
145-
param_dict['ext_status'] = ext_status
146-
if ext_description is not None:
147-
param_dict['ext_description'] = ext_description
148-
if ext_priority is not None:
149-
param_dict['ext_priority'] = ext_priority
150-
params = {
151-
'bug_ids': listify(bug_ids),
152-
'external_bugs': [param_dict],
153-
}
154-
155-
log.debug("Calling ExternalBugs.add_external_bug(%s)", params)
156-
return self._backend.externalbugs_update(params)
157-
158-
def update_external_tracker(self, ids=None, ext_type_id=None,
159-
ext_type_description=None, ext_type_url=None,
160-
ext_bz_bug_id=None, bug_ids=None,
161-
ext_status=None, ext_description=None,
162-
ext_priority=None):
163-
"""
164-
Wrapper method to allow adding of external tracking bugs using the
165-
ExternalBugs::WebService::update_external_bug method.
166-
167-
This is documented at
168-
https://bugzilla.redhat.com/docs/en/html/api/extensions/ExternalBugs/lib/WebService.html#update_external_bug
169-
170-
ids: A single external tracker bug id or list of external tracker bug
171-
ids.
172-
ext_type_id: The external tracker id as used by Bugzilla.
173-
ext_type_description: The external tracker description as used by
174-
Bugzilla.
175-
ext_type_url: The external tracker url as used by Bugzilla.
176-
ext_bz_bug_id: A single external bug id or list of external bug ids
177-
(ie: the bug number in the external tracker).
178-
bug_ids: A single bug id or list of bug ids to have external tracker
179-
info updated.
180-
ext_status: The status of the external bug.
181-
ext_description: The description of the external bug.
182-
ext_priority: The priority of the external bug.
183-
"""
184-
params = {}
185-
if ids is not None:
186-
params['ids'] = listify(ids)
187-
if ext_type_id is not None:
188-
params['ext_type_id'] = ext_type_id
189-
if ext_type_description is not None:
190-
params['ext_type_description'] = ext_type_description
191-
if ext_type_url is not None:
192-
params['ext_type_url'] = ext_type_url
193-
if ext_bz_bug_id is not None:
194-
params['ext_bz_bug_id'] = listify(ext_bz_bug_id)
195-
if bug_ids is not None:
196-
params['bug_ids'] = listify(bug_ids)
197-
if ext_status is not None:
198-
params['ext_status'] = ext_status
199-
if ext_description is not None:
200-
params['ext_description'] = ext_description
201-
if ext_priority is not None:
202-
params['ext_priority'] = ext_priority
203-
204-
log.debug("Calling ExternalBugs.update_external_bug(%s)", params)
205-
return self._backend.externalbugs_update(params)
206-
207-
def remove_external_tracker(self, ids=None, ext_type_id=None,
208-
ext_type_description=None, ext_type_url=None,
209-
ext_bz_bug_id=None, bug_ids=None):
210-
"""
211-
Wrapper method to allow removal of external tracking bugs using the
212-
ExternalBugs::WebService::remove_external_bug method.
213-
214-
This is documented at
215-
https://bugzilla.redhat.com/docs/en/html/api/extensions/ExternalBugs/lib/WebService.html#remove_external_bug
216-
217-
ids: A single external tracker bug id or list of external tracker bug
218-
ids.
219-
ext_type_id: The external tracker id as used by Bugzilla.
220-
ext_type_description: The external tracker description as used by
221-
Bugzilla.
222-
ext_type_url: The external tracker url as used by Bugzilla.
223-
ext_bz_bug_id: A single external bug id or list of external bug ids
224-
(ie: the bug number in the external tracker).
225-
bug_ids: A single bug id or list of bug ids to have external tracker
226-
info updated.
227-
"""
228-
params = {}
229-
if ids is not None:
230-
params['ids'] = listify(ids)
231-
if ext_type_id is not None:
232-
params['ext_type_id'] = ext_type_id
233-
if ext_type_description is not None:
234-
params['ext_type_description'] = ext_type_description
235-
if ext_type_url is not None:
236-
params['ext_type_url'] = ext_type_url
237-
if ext_bz_bug_id is not None:
238-
params['ext_bz_bug_id'] = listify(ext_bz_bug_id)
239-
if bug_ids is not None:
240-
params['bug_ids'] = listify(bug_ids)
241-
242-
log.debug("Calling ExternalBugs.remove_external_bug(%s)", params)
243-
return self._backend.externalbugs_remove(params)
244-
245114

246115
#################
247116
# Query methods #

0 commit comments

Comments
 (0)