[packagedb-cli] Add the possibility for admins to orphans someone else's packages
by Pierre-YvesChibon
commit b37162a719b8fddb4d67459ed03f011e108be2ed
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jun 27 10:10:24 2014 +0200
Add the possibility for admins to orphans someone else's packages
pkgdb2_cli.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/pkgdb2_cli.py b/pkgdb2_cli.py
index 7a9a1f7..7036ac9 100644
--- a/pkgdb2_cli.py
+++ b/pkgdb2_cli.py
@@ -269,7 +269,7 @@ def setup_parser():
'orphan',
help='Orphan package(s) according to the specified criteria')
parser_orphan.add_argument(
- 'package',
+ 'package', nargs="?",
help="Name of the package to orphan or simple pattern")
parser_orphan.add_argument(
'branch', default='master', nargs="?",
@@ -281,6 +281,11 @@ def setup_parser():
parser_orphan.add_argument(
'--all', action="store_true", default=False,
help="Orphan all your packages")
+ parser_orphan.add_argument(
+ '--poc', default=None,
+ help="When orphaning someone else's package, precise here the FAS "
+ "username of the person whose packages should be orphaned. "
+ "(Admin only)")
parser_orphan.set_defaults(func=do_orphan)
## Unorphan
@@ -540,15 +545,17 @@ def do_orphan(args):
'''
LOG.info("user : {0}".format(args.username))
+ LOG.info("poc : {0}".format(args.poc))
LOG.info("package : {0}".format(args.package))
LOG.info("branch : {0}".format(args.branch))
LOG.info("all : {0}".format(args.all))
LOG.info("retire : {0}".format(args.retire))
if args.all is True:
- pkgs = _get_user_packages(args.username)
+ pkgs = _get_user_packages(args.poc or args.username)
else:
pkgs = [args.package]
+
if args.branch == 'all':
branches = _get_active_branch()
else:
9 years, 10 months
[packagedb-cli] Update the log.debug to use {} and .format() as elsewhere
by Pierre-YvesChibon
commit 3f4bd28ebf5016b39d3637e11d417be18602b8ca
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jun 27 09:53:05 2014 +0200
Update the log.debug to use {} and .format() as elsewhere
pkgdb2client.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb2client.py b/pkgdb2client.py
index 5957d2a..45228eb 100644
--- a/pkgdb2client.py
+++ b/pkgdb2client.py
@@ -341,7 +341,7 @@ class PkgDB(object):
LOG.debug(response.text)
if response.status_code != 200:
- LOG.debug('full output %s', output)
+ LOG.debug('full output: {0}'.format(output))
raise PkgDBException(output['error'])
return output
9 years, 10 months
[packagedb-cli] Handle the situation where the pkgdb2 api did not return a JSON object
by Pierre-YvesChibon
commit 60409f68f027b27ca2d9f6b90e2a22daefcd506c
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jun 27 09:51:38 2014 +0200
Handle the situation where the pkgdb2 api did not return a JSON object
This will be likely caused by a 500 error returning the default 500
page/html which will of course not load correctly as JSON.
With --debug we will be able to see what went wrong.
pkgdb2client.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb2client.py b/pkgdb2client.py
index b378ef9..5957d2a 100644
--- a/pkgdb2client.py
+++ b/pkgdb2client.py
@@ -333,7 +333,12 @@ class PkgDB(object):
'''
response = self.call_api(path, params, data)
- output = response.json()
+ output = None
+ try:
+ output = response.json()
+ except Exception, err:
+ LOG.debug('Error while decoding the JSON: {0}'.format(err))
+ LOG.debug(response.text)
if response.status_code != 200:
LOG.debug('full output %s', output)
9 years, 10 months
[packagedb-cli] A little more debugging upon exception when logging in
by Pierre-YvesChibon
commit d202d1d01a4b3dffeea3c9a4c0502cf30765f440
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jun 27 09:25:16 2014 +0200
A little more debugging upon exception when logging in
pkgdb2client.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb2client.py b/pkgdb2client.py
index af1d68f..b378ef9 100644
--- a/pkgdb2client.py
+++ b/pkgdb2client.py
@@ -306,7 +306,8 @@ class PkgDB(object):
response=response)
success = True
break
- except PkgDBException:
+ except PkgDBException as err:
+ log.debug('Exception: {0}'.format(err))
response = None
bad_password = True
if not success:
9 years, 10 months
[packagedb-cli] Fix the regex to ensure the openid url is the one expected
by Pierre-YvesChibon
commit 0ed83fd4e0361be1a8f3238f3fbb1c3b156b58aa
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jun 27 09:24:45 2014 +0200
Fix the regex to ensure the openid url is the one expected
pkgdb2client.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb2client.py b/pkgdb2client.py
index f25936a..af1d68f 100644
--- a/pkgdb2client.py
+++ b/pkgdb2client.py
@@ -211,7 +211,7 @@ class PkgDB(object):
from urlparse import urlparse, parse_qs
fedora_openid_api = r'https://id.fedoraproject.org/api/v1/'
- fedora_openid = r'^http(s)?:\/\/(|stg.|dev.)?id\.fedoraproject'\
+ fedora_openid = r'^http(s)?:\/\/id\.(|stg.|dev.)?fedoraproject'\
'\.org(/)?'
motif = re.compile(fedora_openid)
9 years, 10 months
[packagedb-cli] Add a little more debugging information/output
by Pierre-YvesChibon
commit 295d8c879069de55ae4206d99492b525230c1515
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jun 27 09:16:26 2014 +0200
Add a little more debugging information/output
pkgdb2_cli.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/pkgdb2_cli.py b/pkgdb2_cli.py
index 375a448..7a9a1f7 100644
--- a/pkgdb2_cli.py
+++ b/pkgdb2_cli.py
@@ -65,6 +65,7 @@ def _get_active_branch(packagename=None):
''' Return a list of the active branch for a specific package or simply
all the active branches if no package is specified.
'''
+ LOG.debug("Retrieving all the active branches")
branches = []
if packagename:
output = pkgdbclient.get_package(packagename)
@@ -88,6 +89,7 @@ def _get_user_packages(username):
:arg username: the FAS username of the user of interest
'''
+ LOG.debug("Get the packages of user {0}".format(username))
pkgs = []
output = pkgdbclient.get_packages(poc=username)
for pkg in output['packages']:
9 years, 10 months
[packagedb-cli] Add the `give` action to pkgdb-cli
by Pierre-YvesChibon
commit 97a7495a96cfe703657e0c94d1f45d5eb9e0449e
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Jun 17 11:43:03 2014 +0200
Add the `give` action to pkgdb-cli
This allows an user to give his/her package or an pkgdb admin to give an
orphaned package to someone else
pkgdb2_cli.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/pkgdb2_cli.py b/pkgdb2_cli.py
index 4766e4b..375a448 100644
--- a/pkgdb2_cli.py
+++ b/pkgdb2_cli.py
@@ -208,6 +208,28 @@ def setup_parser():
"last build)")
parser_acl.set_defaults(func=do_acl)
+ ## Give
+ parser_give = subparsers.add_parser(
+ 'give',
+ help='Give package(s) according to the specified criteria')
+ parser_give.add_argument(
+ 'package',
+ help="Name of the package to give")
+ parser_give.add_argument(
+ 'branch', default='master', nargs="?",
+ help="Branch of the package to give "
+ "(default: 'master', can be: 'all')")
+ parser_give.add_argument(
+ '--all', action="store_true", default=False,
+ help="Give all your packages")
+ parser_give.add_argument(
+ '--poc', default=None,
+ help="FAS username of the new point of contact of the package "
+ "This allows to give your package or an orphaned "
+ "package to someone else. "
+ "(default: current FAS user)")
+ parser_give.set_defaults(func=do_give)
+
## List
parser_list = subparsers.add_parser(
'list',
@@ -419,6 +441,35 @@ def do_acl(args):
get_last_build(pkg['package']['name'], tag)
+def do_give(args):
+ ''' Give a package to someone in pkgdb.
+
+ '''
+ LOG.info("user : {0}".format(args.username))
+ LOG.info("package : {0}".format(args.package))
+ LOG.info("branch : {0}".format(args.branch))
+ LOG.info("poc : {0}".format(args.poc))
+
+ if args.all is True:
+ pkgs = _get_user_packages(args.username)
+ else:
+ pkgs = [args.package]
+
+ if args.branch == 'all':
+ branches = _get_active_branch()
+ else:
+ branches = [args.branch]
+
+ pkgdbclient.username = args.username
+
+ username = args.poc or args.username or pkgdbclient.username
+ LOG.info("new poc : {0}".format(username))
+
+ output = pkgdbclient.update_package_poc(pkgs, branches, username)
+ for msg in output.get('messages', []):
+ print msg
+
+
def do_list(args):
''' Retrieve the list of packages matching a pattern from pkgdb.
9 years, 10 months
[packagedb-cli] Allow the `unorphan` action to be used to `give` a package to someone else
by Pierre-YvesChibon
commit 3b472f903b722af795b804e64f0beb9f41271091
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Jun 17 11:41:28 2014 +0200
Allow the `unorphan` action to be used to `give` a package to someone else
This brings back the behavior of pkgdb-cli 1.+ and correspond to what the
documentation says.
Fixes https://fedorahosted.org/pkgdb2/ticket/23
pkgdb2_cli.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb2_cli.py b/pkgdb2_cli.py
index 983bd14..4766e4b 100644
--- a/pkgdb2_cli.py
+++ b/pkgdb2_cli.py
@@ -521,10 +521,12 @@ def do_unorphan(args):
LOG.info("package : {0}".format(args.package))
LOG.info("branch : {0}".format(args.branch))
LOG.info("poc : {0}".format(args.poc))
+
if args.all is True:
pkgs = _get_user_packages(args.username)
else:
pkgs = [args.package]
+
if args.branch == 'all':
branches = _get_active_branch()
else:
@@ -535,7 +537,7 @@ def do_unorphan(args):
username = args.poc or args.username or pkgdbclient.username
LOG.info("new poc : {0}".format(username))
- output = pkgdbclient.unorphan_packages(pkgs, branches, username)
+ output = pkgdbclient.update_package_poc(pkgs, branches, username)
for msg in output.get('messages', []):
print msg
9 years, 10 months
[packagedb-cli] Created tag v2.3.1
by Pierre-YvesChibon
The signed tag 'v2.3.1' was created.
Tagger: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Jun 12 14:51:35 2014 +0200
Release 2.3.1
Changes since the last tag 'v2.3':
Pierre-Yves Chibon (2):
If the branch is orphaned there are sometime no ACLs at all
Bump the version to 2.3.1 in the setup.py file
9 years, 11 months
[packagedb-cli] Created tag v2.3
by Pierre-YvesChibon
The signed tag 'v2.3' was created.
Tagger: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Tue Jun 10 11:47:39 2014 +0200
Release 2.3
Changes since the last tag 'v2.2':
Luke Macken (1):
Fix a few docstring typos
Pierre-Yves Chibon (32):
Order the ACL per branches
Merge pull request #5 from fedora-infra/feature/docstring-fixes
Order the users in the ACL output
Add a dedicated pkgdb2version file that contains only the version information
Let pkgdb2client rely on pkgdb2version to set its version information
Update the setup.py to rely on pkgdb2version to set its version
Fix the test and expand them to test get_package for multiple branches
Add a global boolean allowing to turn on/off the authenticated tests (saves time)
Remove un-used lines of code
Small pep8 clean up
Drop the pkgdb2version approach in favor of setup.py and relying on pkg_resources
Add setuptools in the list of dependency
Add the missing beautifulsoup4 as a requirement
Give the possibility to set the username and password outside of the login function
Honor the --username and --password command line arguments
Fix incorrect docstring
Merge pull request #10 from tyll/simplify
pkgdb2client is a library, no need for if __name__ == '__main__'
Merge pull request #12 from tyll/simplify
Merge pull request #13 from tyll/cli
Merge pull request #14 from tyll/simplify
Merge pull request #9 from tyll/store_cookies
If no password is provided, skip the auth tests
If the user is already logged in via the session pickle, move on
When listing packages, return all pages not just the first one
Drop `--all` as this is now the default if `list` is called with no arguments
Update the `list` method to return all packages unless specified otherwise
Add a dedicated method to retrieve the current version of the pkgdb API
Add method to retrieve the packages of a specific packager
Adjust the pkgdb-cli list --user to rely on the new API added in pkgdb 1.6
Fix the tests to account for the presence of the `acls` key even if it's empty
Adjust tests a little to make them more flexible
Ralph Bean (1):
Merge pull request #11 from tyll/pep8
Till Maas (8):
pkgdb2client: Remove duplicate code to call the API
pkgdb2client: Allow low-level API calls
pkgdb2client: Support on-demand authentication
setup.py: Wrap line
pkgdb2client: Cleanup on-demand login code
pkgdb2_cli: Ask for password only if required
PkgDB: Store cookies
pkgdb2client: fix indentation
9 years, 11 months