forked from sig_core/toolkit
BugFix: Fix profile validity checking
This commit is contained in:
parent
4d6a0c9519
commit
9fa51f10de
9 changed files with 31 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.')
|
||||
|
|
Loading…
Reference in a new issue