use new exception syntax
This commit is contained in:
parent
9b9a8f32a1
commit
1494301465
27 changed files with 836 additions and 836 deletions
|
|
@ -120,10 +120,10 @@ class RunRootTask(tasks.BaseTaskHandler):
|
|||
# c) is canonical
|
||||
host_arches = self.session.host.getHost()['arches']
|
||||
if not host_arches:
|
||||
raise koji.BuildError, "No arch list for this host"
|
||||
raise koji.BuildError("No arch list for this host")
|
||||
tag_arches = self.session.getBuildConfig(root)['arches']
|
||||
if not tag_arches:
|
||||
raise koji.BuildError, "No arch list for tag: %s" % root
|
||||
raise koji.BuildError("No arch list for tag: %s" % root)
|
||||
#index canonical host arches
|
||||
host_arches = dict([(koji.canonArch(a),1) for a in host_arches.split()])
|
||||
#pick the first suitable match from tag's archlist
|
||||
|
|
@ -134,15 +134,15 @@ class RunRootTask(tasks.BaseTaskHandler):
|
|||
break
|
||||
else:
|
||||
#no overlap
|
||||
raise koji.BuildError, "host does not match tag arches: %s (%s)" % (root, tag_arches)
|
||||
raise koji.BuildError("host does not match tag arches: %s (%s)" % (root, tag_arches))
|
||||
else:
|
||||
br_arch = arch
|
||||
if repo_id:
|
||||
repo_info = self.session.repoInfo(repo_id, strict=True)
|
||||
if repo_info['tag_name'] != root:
|
||||
raise koji.BuildError, "build tag (%s) does not match repo tag (%s)" % (root, repo_info['tag_name'])
|
||||
raise koji.BuildError("build tag (%s) does not match repo tag (%s)" % (root, repo_info['tag_name']))
|
||||
if repo_info['state'] not in (koji.REPO_STATES['READY'], koji.REPO_STATES['EXPIRED']):
|
||||
raise koji.BuildError, "repos in the %s state may not be used by runroot" % koji.REPO_STATES[repo_info['state']]
|
||||
raise koji.BuildError("repos in the %s state may not be used by runroot" % koji.REPO_STATES[repo_info['state']])
|
||||
else:
|
||||
repo_info = self.session.getRepo(root)
|
||||
if not repo_info:
|
||||
|
|
@ -169,7 +169,7 @@ class RunRootTask(tasks.BaseTaskHandler):
|
|||
status = broot.mock(pkgcmd)
|
||||
self.session.host.updateBuildRootList(broot.id, broot.getPackageList())
|
||||
if not _isSuccess(status):
|
||||
raise koji.BuildrootError, _parseStatus(status, pkgcmd)
|
||||
raise koji.BuildrootError(_parseStatus(status, pkgcmd))
|
||||
|
||||
if isinstance(command, str):
|
||||
cmdstr = command
|
||||
|
|
@ -218,7 +218,7 @@ class RunRootTask(tasks.BaseTaskHandler):
|
|||
if _isSuccess(rv):
|
||||
return '%s completed successfully' % cmd
|
||||
else:
|
||||
raise koji.BuildrootError, _parseStatus(rv, cmd)
|
||||
raise koji.BuildrootError(_parseStatus(rv, cmd))
|
||||
|
||||
def do_extra_mounts(self, rootdir, mounts):
|
||||
mnts = []
|
||||
|
|
@ -315,7 +315,7 @@ class RunRootTask(tasks.BaseTaskHandler):
|
|||
msg = "Unable to unmount: %s" % ', '.join(failed)
|
||||
self.logger.warn(msg)
|
||||
if fatal:
|
||||
raise koji.GenericError, msg
|
||||
raise koji.GenericError(msg)
|
||||
else:
|
||||
# remove the mount list when everything is unmounted
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ def get_sender():
|
|||
keytab = krbV.Keytab(name='FILE:' + config.get('broker', 'keytab'), context=ctx)
|
||||
ccache.init_creds_keytab(principal=cprinc, keytab=keytab)
|
||||
else:
|
||||
raise PluginError, 'unsupported auth type: %s' % auth
|
||||
raise PluginError('unsupported auth type: %s' % auth)
|
||||
|
||||
url += config.get('broker', 'host') + ':'
|
||||
url += config.get('broker', 'port')
|
||||
|
|
@ -223,7 +223,7 @@ def send_message(cbtype, *args, **kws):
|
|||
headers = get_message_headers(msgtype, *args, **kws)
|
||||
message = qpid.messaging.Message(properties=headers, content=data)
|
||||
else:
|
||||
raise PluginError, 'unsupported exchange type: %s' % exchange_type
|
||||
raise PluginError('unsupported exchange type: %s' % exchange_type)
|
||||
|
||||
sender.send(message, sync=True, timeout=config.getfloat('broker', 'timeout'))
|
||||
sender.close(timeout=config.getfloat('broker', 'timeout'))
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ def expand_rpm(filepath, tmpdir):
|
|||
stdout=devnull, stderr=devnull,
|
||||
close_fds=True)
|
||||
if rpm2cpio.wait() != 0 or cpio.wait() != 0:
|
||||
raise koji.CallbackError, 'error extracting files from %s, ' \
|
||||
raise koji.CallbackError('error extracting files from %s, ' \
|
||||
'rpm2cpio returned %s, cpio returned %s' % \
|
||||
(filepath, rpm2cpio.wait(), cpio.wait())
|
||||
(filepath, rpm2cpio.wait(), cpio.wait()))
|
||||
devnull.close()
|
||||
|
||||
def scan_and_import(buildinfo, rpminfo, tmpdir):
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ def runroot(tagInfo, arch, command, channel=None, **opts):
|
|||
#not all arches can generate a proper buildroot for all tags
|
||||
tag = kojihub.get_tag(tagInfo)
|
||||
if not tag['arches']:
|
||||
raise koji.GenericError, 'no arches defined for tag %s' % tag['name']
|
||||
raise koji.GenericError('no arches defined for tag %s' % tag['name'])
|
||||
|
||||
#get all known arches for the system
|
||||
fullarches = kojihub.get_all_arches()
|
||||
|
|
@ -53,8 +53,8 @@ def runroot(tagInfo, arch, command, channel=None, **opts):
|
|||
chanarches = get_channel_arches(taskopts['channel'])
|
||||
choices = [x for x in tagarches if x in chanarches]
|
||||
if not choices:
|
||||
raise koji.GenericError, 'no common arches for tag/channel: %s/%s' \
|
||||
% (tagInfo, taskopts['channel'])
|
||||
raise koji.GenericError('no common arches for tag/channel: %s/%s' \
|
||||
% (tagInfo, taskopts['channel']))
|
||||
taskopts['arch'] = koji.canonArch(random.choice(choices))
|
||||
|
||||
args = koji.encode_args(tagInfo, arch, command,**opts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue