BugFix: Fix profile validity checking

This commit is contained in:
Louis Abel 2022-10-20 15:27:30 -07:00
parent 4d6a0c9519
commit 9fa51f10de
Signed by: label
GPG Key ID: B37E62D143879B36
9 changed files with 31 additions and 9 deletions

View File

@ -85,7 +85,7 @@ from util import Checks
rlvars = rldict['9']
r = Checks(rlvars, arch)
r.check_valid_arch()
r.check_validity()
```
### script names and permissions

View File

@ -20,7 +20,7 @@ rlvars = rldict[results.release]
major = rlvars['major']
r = Checks(rlvars, config['arch'])
r.check_valid_arch()
r.check_validity()
# Send them and do whatever I guess
a = RepoSync(

View File

@ -24,7 +24,7 @@ rlvars = rldict[results.release]
major = rlvars['major']
r = Checks(rlvars, config['arch'])
r.check_valid_arch()
r.check_validity()
# Send them and do whatever I guess
def run():

View File

@ -22,7 +22,7 @@ rlvars = rldict[results.release]
major = rlvars['major']
r = Checks(rlvars, config['arch'])
r.check_valid_arch()
r.check_validity()
a = RepoSync(
rlvars,

View File

@ -40,7 +40,7 @@ rlvars = rldict[results.release]
major = rlvars['major']
r = Checks(rlvars, config['arch'])
r.check_valid_arch()
r.check_validity()
# Send them and do whatever I guess
a = RepoSync(

View File

@ -9,7 +9,7 @@ from empanadas.util import RepoSync
rlvars = rldict['9-lookahead']
r = Checks(rlvars, config['arch'])
r.check_valid_arch()
r.check_validity()
#a = RepoSync(rlvars, config, major="9", repo="ResilientStorage", parallel=True, ignore_debug=False, ignore_source=False)
a = RepoSync(rlvars, config, major="9", repo="BaseOS", parallel=True, ignore_debug=False, ignore_source=False, hashed=True)

View File

@ -7,7 +7,7 @@ from empanadas.util import SigRepoSync
#rlvars = rldict['9']
#r = Checks(rlvars, config['arch'])
#r.check_valid_arch()
#r.check_validity()
# Start up the parser baby
parser = argparse.ArgumentParser(description="Peridot Sync and Compose")
@ -39,7 +39,7 @@ results = parser.parse_args()
rlvars = rldict[results.release]
sigvars = sigdict[results.sig][results.release]
r = Checks(rlvars, config['arch'])
r.check_valid_arch()
r.check_validity()
# Send them and do whatever I guess
a = SigRepoSync(

View File

@ -20,7 +20,7 @@ rlvars = rldict[results.release]
major = rlvars['major']
r = Checks(rlvars, config['arch'])
r.check_valid_arch()
r.check_validity()
def run():
print(sys.path)

View File

@ -5,11 +5,33 @@ from empanadas.common import Color
class Checks:
"""This class helps check some things"""
def __init__(self, rlvars, arch):
self.profile = rlvars
self.arches = rlvars['allowed_arches']
self.arch = arch
def check_validity(self):
"""
Does the arch and profile check for us
"""
self.check_valid_profile()
self.check_valid_arch()
def check_valid_arch(self):
"""
Validates if the arch we're running on is technically supported.
"""
if self.arch not in self.arches:
raise SystemExit(Color.BOLD + 'This architecture is not supported.'
+ Color.END + '\n\nEnsure that the architecture you are '
'building for is supported for this compose process.')
def check_valid_profile(self):
"""
Validates if the profile we've selected actually exists
"""
if len(self.profile['major']) == 0:
raise SystemExit(Color.BOLD + 'Profile does not exist or major '
'version is not defined.' + Color.END + '\n\nEnsure that '
'the profile you are loading exists or is configured '
'correctly.\n\nNote: A major version MUST exist even for '
'SIG syncs.')