add regex check in def

This commit is contained in:
Louis Abel 2023-10-02 21:13:09 -07:00
parent 6f5b1f59ac
commit dadc382dae
Signed by untrusted user: label
GPG Key ID: B37E62D143879B36

View File

@ -89,6 +89,10 @@ def set_releasever(releasever):
"""
Sets a release version
"""
check_for_rel = re.search(regex, releasever)
if not check_for_rel:
print(f'Release version does not conform to X.Y or it does not start with {dist}')
sys.exit(1)
print(f'Setting releasever to {releasever}')
with open('/etc/dnf/vars/releasever', 'w') as f:
f.write(releasever)