commit 9398d6dbadbad79102e54a13edb5bcd28be52390 Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Thu Mar 6 11:43:49 2014 +0100
Add update_collection_status method to update a collection status via the API
pkgdb.py | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) --- diff --git a/pkgdb.py b/pkgdb.py index 107cb03..2dc584d 100644 --- a/pkgdb.py +++ b/pkgdb.py @@ -510,3 +510,33 @@ class PkgDB(object): raise PkgDBException(output['error'])
return output + + def update_collection_status(self, clt_branchname, clt_status): + ''' Update the status of the specified collection. + + :arg clt_branchname: + :arg clt_status: + + ''' + if not self.logged: + raise PkgDBAuthException('Authentication required') + + args = { + 'collection_branchname': clt_branchname, + 'collection_status': clt_status, + } + + req = self.session.post( + '{0}/api/collection/{1}/status/'.format( + self.url, clt_branchname), + 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