PR#843: make py2 files parseable with py3
Merges #843 https://pagure.io/koji/pull-request/843
This commit is contained in:
commit
e4412e4d57
2 changed files with 15 additions and 15 deletions
|
|
@ -1453,7 +1453,7 @@ class BuildMavenTask(BaseBuildTask):
|
||||||
st = os.lstat(filepath)
|
st = os.lstat(filepath)
|
||||||
mtime = time.localtime(st.st_mtime)
|
mtime = time.localtime(st.st_mtime)
|
||||||
info = zipfile.ZipInfo(filepath[roottrim:])
|
info = zipfile.ZipInfo(filepath[roottrim:])
|
||||||
info.external_attr |= 0120000 << 16L # symlink file type
|
info.external_attr |= 0o120000 << 16 # symlink file type
|
||||||
info.compress_type = zipfile.ZIP_STORED
|
info.compress_type = zipfile.ZIP_STORED
|
||||||
info.date_time = mtime[:6]
|
info.date_time = mtime[:6]
|
||||||
zfo.writestr(info, content)
|
zfo.writestr(info, content)
|
||||||
|
|
@ -2100,7 +2100,7 @@ class ChainMavenTask(MultiPlatformTask):
|
||||||
del todo[package]
|
del todo[package]
|
||||||
try:
|
try:
|
||||||
results = self.wait(running.keys())
|
results = self.wait(running.keys())
|
||||||
except (xmlrpclib.Fault, koji.GenericError), e:
|
except (xmlrpclib.Fault, koji.GenericError) as e:
|
||||||
# One task has failed, wait for the rest to complete before the
|
# One task has failed, wait for the rest to complete before the
|
||||||
# chainmaven task fails. self.wait(all=True) should thrown an exception.
|
# chainmaven task fails. self.wait(all=True) should thrown an exception.
|
||||||
self.wait(all=True)
|
self.wait(all=True)
|
||||||
|
|
@ -2237,7 +2237,7 @@ class TagBuildTask(BaseTaskHandler):
|
||||||
#XXX - add more post tests
|
#XXX - add more post tests
|
||||||
self.session.host.tagBuild(self.id,tag_id,build_id,force=force,fromtag=fromtag)
|
self.session.host.tagBuild(self.id,tag_id,build_id,force=force,fromtag=fromtag)
|
||||||
self.session.host.tagNotification(True, tag_id, fromtag, build_id, user_id, ignore_success)
|
self.session.host.tagNotification(True, tag_id, fromtag, build_id, user_id, ignore_success)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
exctype, value = sys.exc_info()[:2]
|
exctype, value = sys.exc_info()[:2]
|
||||||
self.session.host.tagNotification(False, tag_id, fromtag, build_id, user_id, ignore_success, "%s: %s" % (exctype, value))
|
self.session.host.tagNotification(False, tag_id, fromtag, build_id, user_id, ignore_success, "%s: %s" % (exctype, value))
|
||||||
raise e
|
raise e
|
||||||
|
|
@ -2807,10 +2807,10 @@ class ImageTask(BaseTaskHandler):
|
||||||
self.ks = ksparser.KickstartParser(version)
|
self.ks = ksparser.KickstartParser(version)
|
||||||
try:
|
try:
|
||||||
self.ks.readKickstart(kspath)
|
self.ks.readKickstart(kspath)
|
||||||
except IOError, e:
|
except IOError as e:
|
||||||
raise koji.LiveCDError("Failed to read kickstart file "
|
raise koji.LiveCDError("Failed to read kickstart file "
|
||||||
"'%s' : %s" % (kspath, e))
|
"'%s' : %s" % (kspath, e))
|
||||||
except kserrors.KickstartError, e:
|
except kserrors.KickstartError as e:
|
||||||
raise koji.LiveCDError("Failed to parse kickstart file "
|
raise koji.LiveCDError("Failed to parse kickstart file "
|
||||||
"'%s' : %s" % (kspath, e))
|
"'%s' : %s" % (kspath, e))
|
||||||
|
|
||||||
|
|
@ -3472,10 +3472,10 @@ class OzImageTask(BaseTaskHandler):
|
||||||
self.logger.debug('attempting to read kickstart: %s' % kspath)
|
self.logger.debug('attempting to read kickstart: %s' % kspath)
|
||||||
try:
|
try:
|
||||||
ks.readKickstart(kspath)
|
ks.readKickstart(kspath)
|
||||||
except IOError, e:
|
except IOError as e:
|
||||||
raise koji.BuildError("Failed to read kickstart file "
|
raise koji.BuildError("Failed to read kickstart file "
|
||||||
"'%s' : %s" % (kspath, e))
|
"'%s' : %s" % (kspath, e))
|
||||||
except kserrors.KickstartError, e:
|
except kserrors.KickstartError as e:
|
||||||
raise koji.BuildError("Failed to parse kickstart file "
|
raise koji.BuildError("Failed to parse kickstart file "
|
||||||
"'%s' : %s" % (kspath, e))
|
"'%s' : %s" % (kspath, e))
|
||||||
return ks
|
return ks
|
||||||
|
|
@ -4416,7 +4416,7 @@ class BuildIndirectionImageTask(OzImageTask):
|
||||||
base_factory_image = _nvr_to_image(opts['base_image_build'], opts['arch'])
|
base_factory_image = _nvr_to_image(opts['base_image_build'], opts['arch'])
|
||||||
else:
|
else:
|
||||||
base_factory_image = _task_to_image(int(opts['base_image_task']))
|
base_factory_image = _task_to_image(int(opts['base_image_task']))
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
self.logger.exception(e)
|
self.logger.exception(e)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
@ -4478,7 +4478,7 @@ class BuildIndirectionImageTask(OzImageTask):
|
||||||
image_id=base_factory_image.identifier,
|
image_id=base_factory_image.identifier,
|
||||||
parameters=params)
|
parameters=params)
|
||||||
target.target_thread.join()
|
target.target_thread.join()
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
self.logger.debug("Exception encountered during target build")
|
self.logger.debug("Exception encountered during target build")
|
||||||
self.logger.exception(e)
|
self.logger.exception(e)
|
||||||
finally:
|
finally:
|
||||||
|
|
@ -5833,7 +5833,7 @@ if __name__ == "__main__":
|
||||||
# authenticate using SSL client certificates
|
# authenticate using SSL client certificates
|
||||||
session.ssl_login(options.cert, None,
|
session.ssl_login(options.cert, None,
|
||||||
options.serverca)
|
options.serverca)
|
||||||
except koji.AuthError, e:
|
except koji.AuthError as e:
|
||||||
quit("Error: Unable to log in: %s" % e)
|
quit("Error: Unable to log in: %s" % e)
|
||||||
except xmlrpclib.ProtocolError:
|
except xmlrpclib.ProtocolError:
|
||||||
quit("Error: Unable to connect to server %s" % (options.server))
|
quit("Error: Unable to connect to server %s" % (options.server))
|
||||||
|
|
@ -5853,9 +5853,9 @@ if __name__ == "__main__":
|
||||||
session.krb_login(principal=krb_principal,
|
session.krb_login(principal=krb_principal,
|
||||||
keytab=options.keytab,
|
keytab=options.keytab,
|
||||||
ccache=options.ccache)
|
ccache=options.ccache)
|
||||||
except krbV.Krb5Error, e:
|
except krbV.Krb5Error as e:
|
||||||
quit("Kerberos authentication failed: '%s' (%s)" % (e.args[1], e.args[0]))
|
quit("Kerberos authentication failed: '%s' (%s)" % (e.args[1], e.args[0]))
|
||||||
except socket.error, e:
|
except socket.error as e:
|
||||||
quit("Could not connect to Kerberos authentication service: '%s'" % e.args[1])
|
quit("Could not connect to Kerberos authentication service: '%s'" % e.args[1])
|
||||||
else:
|
else:
|
||||||
quit("No username/password supplied and Kerberos missing or not configured")
|
quit("No username/password supplied and Kerberos missing or not configured")
|
||||||
|
|
|
||||||
|
|
@ -122,18 +122,18 @@ def parse_task_params(method, params):
|
||||||
args, kwargs = koji.decode_args(*params)
|
args, kwargs = koji.decode_args(*params)
|
||||||
|
|
||||||
if method not in LEGACY_SIGNATURES:
|
if method not in LEGACY_SIGNATURES:
|
||||||
raise TypeError, "No legacy signature for %s" % method
|
raise TypeError("No legacy signature for %s" % method)
|
||||||
|
|
||||||
err = None
|
err = None
|
||||||
for argspec in LEGACY_SIGNATURES[method]:
|
for argspec in LEGACY_SIGNATURES[method]:
|
||||||
try:
|
try:
|
||||||
params = koji.util.apply_argspec(argspec, args, kwargs)
|
params = koji.util.apply_argspec(argspec, args, kwargs)
|
||||||
break
|
break
|
||||||
except koji.ParameterError, e:
|
except koji.ParameterError as e:
|
||||||
if not err:
|
if not err:
|
||||||
err = e.message
|
err = e.message
|
||||||
else:
|
else:
|
||||||
raise koji.ParameterError, "Invalid signature for %s: %s" % (method, err)
|
raise koji.ParameterError("Invalid signature for %s: %s" % (method, err))
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue