mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-05-16 13:56:11 +08:00
Merge #990 Allow overriding the name and stream from scm repos.
This commit is contained in:
@@ -197,6 +197,16 @@ class Config(object):
|
|||||||
'default': True,
|
'default': True,
|
||||||
'desc': 'Enable or disable imports to koji using content '
|
'desc': 'Enable or disable imports to koji using content '
|
||||||
'generator api'},
|
'generator api'},
|
||||||
|
'allow_name_override_from_scm': {
|
||||||
|
'type': bool,
|
||||||
|
'default': False,
|
||||||
|
'desc': 'Allow modulemd files to override the module name '
|
||||||
|
'if different from the scm repo name.'},
|
||||||
|
'allow_stream_override_from_scm': {
|
||||||
|
'type': bool,
|
||||||
|
'default': False,
|
||||||
|
'desc': 'Allow modulemd files to override the module stream '
|
||||||
|
'if different from the scm repo branch.'},
|
||||||
'allow_custom_scmurls': {
|
'allow_custom_scmurls': {
|
||||||
'type': bool,
|
'type': bool,
|
||||||
'default': False,
|
'default': False,
|
||||||
|
|||||||
@@ -418,17 +418,19 @@ def _fetch_mmd(url, branch=None, allow_local_url=False, whitelist_url=False):
|
|||||||
# If the name was set in the modulemd, make sure it matches what the scmurl
|
# If the name was set in the modulemd, make sure it matches what the scmurl
|
||||||
# says it should be
|
# says it should be
|
||||||
if mmd.get_name() and mmd.get_name() != scm.name:
|
if mmd.get_name() and mmd.get_name() != scm.name:
|
||||||
raise ValidationError('The name "{0}" that is stored in the modulemd '
|
if not conf.allow_name_override_from_scm:
|
||||||
'is not valid'.format(mmd.get_name()))
|
raise ValidationError('The name "{0}" that is stored in the modulemd '
|
||||||
|
'is not valid'.format(mmd.get_name()))
|
||||||
else:
|
else:
|
||||||
mmd.set_name(scm.name)
|
mmd.set_name(scm.name)
|
||||||
|
|
||||||
# If the stream was set in the modulemd, make sure it matches what the repo
|
# If the stream was set in the modulemd, make sure it matches what the repo
|
||||||
# branch is
|
# branch is
|
||||||
if mmd.get_stream() and mmd.get_stream() != scm.branch:
|
if mmd.get_stream() and mmd.get_stream() != scm.branch:
|
||||||
raise ValidationError('The stream "{0}" that is stored in the modulemd '
|
if not conf.allow_stream_override_from_scm:
|
||||||
'does not match the branch "{1}"'.format(
|
raise ValidationError('The stream "{0}" that is stored in the modulemd '
|
||||||
mmd.get_stream(), scm.branch))
|
'does not match the branch "{1}"'.format(
|
||||||
|
mmd.get_stream(), scm.branch))
|
||||||
else:
|
else:
|
||||||
mmd.set_stream(str(scm.branch))
|
mmd.set_stream(str(scm.branch))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user