Skip to content

Commit

Permalink
Try to address 'Commands' object has no attribute 'read_koji_config'
Browse files Browse the repository at this point in the history
  • Loading branch information
leigh123linux committed Sep 16, 2020
1 parent be33cce commit d0ec0eb
Showing 1 changed file with 7 additions and 39 deletions.
46 changes: 7 additions & 39 deletions rfpkg/__init__.py
Expand Up @@ -333,46 +333,14 @@ def update(self, template='bodhi.template', bugs=[]):
self._run_command(cmd, shell=True)

def load_kojisession(self, anon=False):
"""Initiate a koji session.
The koji session can be logged in or anonymous
"""
koji_config = self.read_koji_config()

# Expand out the directory options
for name in ('cert', 'ca', 'serverca'):
path = koji_config[name]
if path:
koji_config[name] = os.path.expanduser(path)

# save the weburl and topurl for later use as well
self._kojiweburl = koji_config['weburl']
self._topurl = koji_config['topurl']

self.log.debug('Initiating a %s session to %s',
os.path.basename(self.build_client), koji_config['server'])

# Build session options used to create instance of ClientSession
session_opts = koji.grab_session_options(koji_config)

try:
session = koji.ClientSession(koji_config['server'], session_opts)
except Exception:
raise rpkgError('Could not initiate %s session' % os.path.basename(self.build_client))
else:
if anon:
self._anon_kojisession = session
else:
self._kojisession = session

if not anon:
try:
self.login_koji_session(koji_config, self._kojisession)
except pyrpkg.rpkgAuthError:
self.log.info("You might want to run rpmfusion-packager-setup or rpmfusion-cert -n to "
"regenerate SSL certificate. For more info see "
"https://rpmfusion.org/Contributors#If_SSL_certificate_expired")
raise
return super(Commands, self).load_kojisession(anon)
except pyrpkg.rpkgAuthError:
self.log.info("You might want to run rpmfusion-packager-setup "
"or rpmfusion-cert -n to regenerate SSL certificate. "
"For more info see https://rpmfusion.org/Contributors"
"#If_SSL_certificate_expired")
raise


def _get_bodhi_version():
Expand Down

0 comments on commit d0ec0eb

Please sign in to comment.