[packagedb-cli] (7 commits) ...Merge pull request #39 from fedora-infra/py3
by Pierre-YvesChibon
Summary of changes:
b71c737... Retrieve the version before doing something with it
c27380a... Merge pull request #40 from fedora-infra/get_version
cf22a78... Fix set_koschei_status() argument name
74756fa... Use the print() method instead of the print statement to be
25d004e... Catch exceptions as to be py3 compatible
3e3a19e... Merge pull request #42 from mizdebsk/argument-name
71203b5... Merge pull request #39 from fedora-infra/py3
8 years, 8 months
[packagedb-cli: 14/14] Merge pull request #38 from tyll/lxml
by Pierre-YvesChibon
commit 768962f6bc23c5f6dd3aa2e1ebe35700cc886c7d
Merge: ba99e27 303f2a9
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Wed Jul 29 08:07:25 2015 +0200
Merge pull request #38 from tyll/lxml
Set default BeautifulSoup parser
pkgdb2client/__init__.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
8 years, 8 months
[packagedb-cli: 13/14] Set default BeautifulSoup parser
by Pierre-YvesChibon
commit 303f2a91a5708e553bf25b9bf76cfec24ca294cd
Author: Till Maas <opensource(a)till.name>
Date: Tue Jul 28 23:02:49 2015 +0200
Set default BeautifulSoup parser
This is required to get rid of a UserWarning in Fedora 22.
pkgdb2client/__init__.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb2client/__init__.py b/pkgdb2client/__init__.py
index cc73e21..6c949ee 100644
--- a/pkgdb2client/__init__.py
+++ b/pkgdb2client/__init__.py
@@ -70,7 +70,7 @@ def _parse_service_form(response):
"""
import bs4
- parsed = bs4.BeautifulSoup(response.text)
+ parsed = bs4.BeautifulSoup(response.text, "lxml")
inputs = {}
for child in parsed.form.find_all(name='input'):
if child.attrs['type'] == 'submit':
8 years, 8 months
[packagedb-cli: 12/14] Merge pull request #37 from fedora-infra/koschei_monitoring
by Pierre-YvesChibon
commit ba99e27f94a9d09c2720131d2b6d146a6766fce9
Merge: 9e7f0a2 15fe2d1
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sat Jul 11 10:01:41 2015 +0200
Merge pull request #37 from fedora-infra/koschei_monitoring
Koschei monitoring integration to pkgdb-cli
pkgdb2client/__init__.py | 22 ++++++++++++++++++++++
pkgdb2client/cli.py | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
---
8 years, 8 months
[packagedb-cli: 11/14] Check if the pkgdb2 instance called support koschei monitoring flag
by Pierre-YvesChibon
commit 15fe2d1bda1b469f59e425e4288781140e53f20d
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Jul 9 12:37:07 2015 +0200
Check if the pkgdb2 instance called support koschei monitoring flag
pkgdb2client/cli.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/pkgdb2client/cli.py b/pkgdb2client/cli.py
index 4ce3ac4..74afeef 100644
--- a/pkgdb2client/cli.py
+++ b/pkgdb2client/cli.py
@@ -818,6 +818,10 @@ def do_koschei(args):
LOG.info("package : {0}".format(args.package))
LOG.info("koschei : {0}".format(args.koschei))
+ if version < (1, 16):
+ raise PkgDBException(
+ 'This version of PkgDB does not support koschei monitoring')
+
if not args.koschei:
pkg = pkgdbclient.get_package(
args.package, branches='master', acls=False
8 years, 8 months
[packagedb-cli: 10/14] Add a koschei action to pkgdb-cli
by Pierre-YvesChibon
commit 4fc79b546a1b46148a1f0d99fb8516e0a30da265
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Jul 9 11:56:28 2015 +0200
Add a koschei action to pkgdb-cli
This action can be used to either retrieve the current koschei monitoring
status of a package, or update it to the specified status.
pkgdb2client/cli.py | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/pkgdb2client/cli.py b/pkgdb2client/cli.py
index 12bb172..4ce3ac4 100644
--- a/pkgdb2client/cli.py
+++ b/pkgdb2client/cli.py
@@ -397,6 +397,19 @@ def setup_parser():
"(can be: 0, 1, nobuild)")
parser_monitoring.set_defaults(func=do_monitoring)
+ ## Koschei Monitoring
+ parser_koschei = subparsers.add_parser(
+ 'koschei',
+ help='Get or Set the koschei monitoring of a package')
+ parser_koschei.add_argument(
+ 'package', help="Name of the package")
+ parser_koschei.add_argument(
+ 'koschei', default=None, nargs="?",
+ help="Koschei monitoring status to set the package to, "
+ "if not specified will show the current koschei monitoring status, "
+ "otherwise will update it. (can be: false, 0, true, 1)")
+ parser_koschei.set_defaults(func=do_koschei)
+
return parser
@@ -797,6 +810,26 @@ def do_monitoring(args):
'messages', 'Invalid output returned, please contact an admin')
+def do_koschei(args):
+ ''' Retrieve or set the koschei monitoring status of a package from
+ pkgdb.
+
+ '''
+ LOG.info("package : {0}".format(args.package))
+ LOG.info("koschei : {0}".format(args.koschei))
+
+ if not args.koschei:
+ pkg = pkgdbclient.get_package(
+ args.package, branches='master', acls=False
+ )['packages'][0]['package']
+ print "Current koschei monitoring status of {0} is: {1}".format(
+ pkg['name'], pkg['koschei_monitor'])
+ else:
+ output = pkgdbclient.set_koschei_status(args.package, args.koschei)
+ print output.get(
+ 'messages', 'Invalid output returned, please contact an admin')
+
+
def main():
''' Main function '''
# Set up parser for global args
8 years, 8 months
[packagedb-cli: 9/14] Add a set_koschei_status to the module pkgdb2client
by Pierre-YvesChibon
commit 6906ac51789cba712ba61dc1e67e09b90e4d236d
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Jul 9 11:53:40 2015 +0200
Add a set_koschei_status to the module pkgdb2client
pkgdb2client/__init__.py | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/pkgdb2client/__init__.py b/pkgdb2client/__init__.py
index c8fa809..cc73e21 100644
--- a/pkgdb2client/__init__.py
+++ b/pkgdb2client/__init__.py
@@ -1113,3 +1113,25 @@ class PkgDB(object):
return self.handle_api_call(
'/package/%s/monitor/%s' % (pkgname, monitoring), data=args)
+ def set_koschei_status(self, pkgname, koschei):
+ ''' Set / Remove the koschei status of a package.
+
+ :arg pkgname: The name of the package
+ :type pkgname: str
+ :arg monitoring: The koschei status to set the package to. Can
+ be any of: True, 1, False, 0.
+ :type monitoring: str
+
+ '''
+ valid = ['true', '1', 'false', '0']
+ if str(koschei).lower() not in valid:
+ raise PkgDBException(
+ 'Invalid koschei status specified, %s is not in: %s' % (
+ koschei, ', '.join(valid))
+ )
+ args = {
+ 'package': pkgname,
+ 'status': monitoring,
+ }
+ return self.handle_api_call(
+ '/package/%s/koschei/%s' % (pkgname, monitoring), data=args)
8 years, 8 months
[packagedb-cli: 8/14] Merge pull request #36 from fedora-infra/monitoring
by Pierre-YvesChibon
commit 9e7f0a2264132beb33b3a47a32cb8d0eb2ac480f
Merge: 97bece3 a30001b
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Jul 10 11:02:21 2015 +0200
Merge pull request #36 from fedora-infra/monitoring
Allow retrieving or setting the monitoring status of a package in pkgdb-cli
pkgdb2client/__init__.py | 29 ++++++++++++++++++++++++++++-
pkgdb2client/cli.py | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+), 1 deletions(-)
---
8 years, 8 months
[packagedb-cli: 7/14] Adjust the error message returned
by Pierre-YvesChibon
commit a30001b9d141acb5d3c11eb1b783610e70447a55
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Jul 9 12:37:46 2015 +0200
Adjust the error message returned
pkgdb2client/cli.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb2client/cli.py b/pkgdb2client/cli.py
index 3d36d62..12bb172 100644
--- a/pkgdb2client/cli.py
+++ b/pkgdb2client/cli.py
@@ -782,7 +782,7 @@ def do_monitoring(args):
if version < (1, 13):
raise PkgDBException(
- 'This version of PkgDB does not support koschei monitoring')
+ 'This version of PkgDB does not support monitoring')
if not args.monitoring:
pkg = pkgdbclient.get_package(
8 years, 8 months
[packagedb-cli: 6/14] Check if the pkgdb instance we're calling support setting monitoring flag by the API
by Pierre-YvesChibon
commit a88c42de814e71a7c6f0e94fd9099dcc56e036b7
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Jul 9 12:35:56 2015 +0200
Check if the pkgdb instance we're calling support setting monitoring flag by the API
pkgdb2client/cli.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/pkgdb2client/cli.py b/pkgdb2client/cli.py
index 05b271b..3d36d62 100644
--- a/pkgdb2client/cli.py
+++ b/pkgdb2client/cli.py
@@ -780,6 +780,10 @@ def do_monitoring(args):
LOG.info("package : {0}".format(args.package))
LOG.info("monitoring : {0}".format(args.monitoring))
+ if version < (1, 13):
+ raise PkgDBException(
+ 'This version of PkgDB does not support koschei monitoring')
+
if not args.monitoring:
pkg = pkgdbclient.get_package(
args.package, branches='master', acls=False
8 years, 8 months