| |
@@ -875,10 +875,11 @@
|
| |
|
| |
def _pkglist_add(tag_id, pkg_id, owner, block, extra_arches):
|
| |
#revoke old entry (if present)
|
| |
- _pkglist_remove(tag_id, pkg_id)
|
| |
data = dslice(locals(), ('tag_id', 'owner', 'extra_arches'))
|
| |
data['package_id'] = pkg_id
|
| |
data['blocked'] = block
|
| |
+ data['extra_arches'] = koji.parse_arches(data['extra_arches'], strict=True, allow_none=True)
|
| |
+ _pkglist_remove(tag_id, pkg_id)
|
| |
insert = InsertProcessor('tag_packages', data=data)
|
| |
insert.make_create() #XXX user_id?
|
| |
insert.execute()
|
| |
@@ -915,6 +916,8 @@
|
| |
assert_policy('package_list', policy_data)
|
| |
if not pkg:
|
| |
pkg = lookup_package(pkginfo, create=True)
|
| |
+ # validate arches before running callbacks
|
| |
+ extra_arches = koji.parse_arches(extra_arches, strict=True, allow_none=True)
|
| |
koji.plugin.run_callbacks('prePackageListChange', action=action, tag=tag, package=pkg, owner=owner,
|
| |
block=block, extra_arches=extra_arches, force=force, update=update)
|
| |
# first check to see if package is:
|
| |
@@ -2997,6 +3000,8 @@
|
| |
raise koji.GenericError("Tag name %s is too long. Max length is %s characters",
|
| |
name, max_name_length)
|
| |
|
| |
+ arches = koji.parse_arches(arches, strict=True, allow_none=True)
|
| |
+
|
| |
if not context.opts.get('EnableMaven') and (maven_support or maven_include_all):
|
| |
raise koji.GenericError("Maven support not enabled")
|
| |
|
| |
@@ -3177,6 +3182,11 @@
|
| |
WHERE id = %(tagID)i"""
|
| |
_dml(update, values)
|
| |
|
| |
+ # sanitize architecture names (space-separated string)
|
| |
+ arches = kwargs.get('arches')
|
| |
+ if arches and tag['arches'] != arches:
|
| |
+ kwargs['arches'] = koji.parse_arches(arches, strict=True, allow_none=True)
|
| |
+
|
| |
#check for changes
|
| |
data = tag.copy()
|
| |
changed = False
|
| |
@@ -10876,6 +10886,9 @@
|
| |
def addHost(self, hostname, arches, krb_principal=None):
|
| |
"""Add a host to the database"""
|
| |
context.session.assertPerm('admin')
|
| |
+ # validate arches
|
| |
+ arches = " ".join(arches)
|
| |
+ arches = koji.parse_arches(arches, strict=True)
|
| |
if get_host(hostname):
|
| |
raise koji.GenericError('host already exists: %s' % hostname)
|
| |
q = """SELECT id FROM channels WHERE name = 'default'"""
|
| |
@@ -10893,7 +10906,7 @@
|
| |
_dml(insert, dslice(locals(), ('hostID', 'userID', 'hostname')))
|
| |
|
| |
insert = InsertProcessor('host_config')
|
| |
- insert.set(host_id=hostID, arches=" ".join(arches))
|
| |
+ insert.set(host_id=hostID, arches=arches)
|
| |
insert.make_create()
|
| |
insert.execute()
|
| |
|
| |
Fixes: https://pagure.io/koji/issue/1237