Skip to content

Commit

Permalink
add regex check in def
Browse files Browse the repository at this point in the history
  • Loading branch information
nazunalika committed Oct 3, 2023
1 parent 6f5b1f5 commit dadc382
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mangle/rlutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -138,12 +142,12 @@ def repoutil(results):
if results.use_baseurl and results.use_mirrorlist:
print('You cannot set both baseurl and mirrorlist.')
sys.exit(1)

if results.use_baseurl:
switch_to_baseurl()
elif results.use_mirrorlist:
switch_to_mirrorlist()

if len(results.releasever) > 0:
set_releasever(results.releasever)

Expand Down

0 comments on commit dadc382

Please sign in to comment.