add regex check in def
This commit is contained in:
parent
6f5b1f59ac
commit
dadc382dae
@ -89,6 +89,10 @@ def set_releasever(releasever):
|
|||||||
"""
|
"""
|
||||||
Sets a release version
|
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}')
|
print(f'Setting releasever to {releasever}')
|
||||||
with open('/etc/dnf/vars/releasever', 'w') as f:
|
with open('/etc/dnf/vars/releasever', 'w') as f:
|
||||||
f.write(releasever)
|
f.write(releasever)
|
||||||
@ -138,12 +142,12 @@ def repoutil(results):
|
|||||||
if results.use_baseurl and results.use_mirrorlist:
|
if results.use_baseurl and results.use_mirrorlist:
|
||||||
print('You cannot set both baseurl and mirrorlist.')
|
print('You cannot set both baseurl and mirrorlist.')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if results.use_baseurl:
|
if results.use_baseurl:
|
||||||
switch_to_baseurl()
|
switch_to_baseurl()
|
||||||
elif results.use_mirrorlist:
|
elif results.use_mirrorlist:
|
||||||
switch_to_mirrorlist()
|
switch_to_mirrorlist()
|
||||||
|
|
||||||
if len(results.releasever) > 0:
|
if len(results.releasever) > 0:
|
||||||
set_releasever(results.releasever)
|
set_releasever(results.releasever)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user