summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2011-01-30 14:25:48 -0700
committerJesse Keating <jkeating@redhat.com>2011-01-30 14:25:48 -0700
commitdaf42e7a8a89b41decb1526ee158a6ee60795512 (patch)
tree5f0ecd3da57e67d7dc1b7b370591c4edc5a69f15 /src
parent12aa298e49b86cad7d952ef7503a081ce13afd8d (diff)
downloadfedora-packager-daf42e7a8a89b41decb1526ee158a6ee60795512.zip
fedora-packager-daf42e7a8a89b41decb1526ee158a6ee60795512.tar.gz
fedora-packager-daf42e7a8a89b41decb1526ee158a6ee60795512.tar.xz
Add a method to create an anonymous koji session
This will be useful to query koji without bothering to log in
Diffstat (limited to 'src')
-rw-r--r--src/pyfedpkg/__init__.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index f78cee0..90c4582 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -1072,6 +1072,7 @@ class PackageModule:
self.mockconfig = None
# Set a place holder for kojisession
self.kojisession = None
+ self.anonkojisession = None
# Setup the repo
try:
self.repo = git.Repo(path)
@@ -1386,10 +1387,10 @@ class PackageModule:
self.kojisession.uploadWrapper(file, path, callback = callback)
return
- def init_koji(self, user, kojiconfig=None, url=None):
+ def init_koji(self, user=None, kojiconfig=None, url=None):
"""Initiate a koji session. Available options are:
- user: User to log into koji as
+ user: User to log into koji as (if no user, no login)
kojiconfig: Use an alternate koji config file
@@ -1431,19 +1432,24 @@ class PackageModule:
# watch the tasks.
log.debug('Initiating a koji session to %s' % defaults['server'])
try:
- self.kojisession = koji.ClientSession(defaults['server'], session_opts)
+ if user:
+ self.kojisession = koji.ClientSession(defaults['server'],
+ session_opts)
+ else:
+ self.kojisession = koji.ClientSession(defaults['server'])
except:
raise FedpkgError('Could not initiate koji session')
# save the weburl for later use too
self.kojiweburl = defaults['weburl']
# log in using ssl
- try:
- self.kojisession.ssl_login(defaults['cert'], defaults['ca'],
- defaults['serverca'])
- except:
- raise FedpkgError('Opening a SSL connection failed')
- if not self.kojisession.logged_in:
- raise FedpkgError('Could not auth with koji as %s' % user)
+ if user:
+ try:
+ self.kojisession.ssl_login(defaults['cert'], defaults['ca'],
+ defaults['serverca'])
+ except:
+ raise FedpkgError('Opening a SSL connection failed')
+ if not self.kojisession.logged_in:
+ raise FedpkgError('Could not auth with koji as %s' % user)
return
def install(self, arch=None, short=False):