commit aaa3bcbebd7408c0dd146e9aedf1abf170419aff Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Thu Mar 6 11:44:45 2014 +0100
Add update_package_poc method to update the point of contact via the API
This method allows updaing the point of contact of one or more packages on one or more branches via the API
pkgdb.py | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) --- diff --git a/pkgdb.py b/pkgdb.py index 2dc584d..0631885 100644 --- a/pkgdb.py +++ b/pkgdb.py @@ -540,3 +540,40 @@ class PkgDB(object): raise PkgDBException(output['error'])
return output + + def update_package_poc(self, packages, branches, new_poc): + ''' Update the point of contact of the specified packages on the + specified branches. + + :arg packages: + :arg branches: + :arg new_poc: + + ''' + if not self.logged: + raise PkgDBAuthException('Authentication required') + + if isinstance(branches, basestring): + branches = [branches] + if isinstance(packages, basestring): + packages = [packages] + + args = { + 'packages': ','.join(packages), + 'branches': ','.join(branches), + 'user_target': new_poc, + } + + req = self.session.post( + '{0}/api/package/acl/reassign/'.format(self.url), + data=args + ) + LOG.debug('Called: %s with arg %s', req.url, args) + + output = req.json() + + if req.status_code != 200: + LOG.debug('full output %s', output) + raise PkgDBException(output['error']) + + return output
packagedb-cli-commits@lists.stg.fedorahosted.org