Skip to content

Commit

Permalink
Update not_supported lists in option validation
Browse files Browse the repository at this point in the history
Change validation method from Some/None to True/False
  • Loading branch information
LegenJCdary committed Apr 21, 2022
1 parent cdc4520 commit 324ca61
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions source/modules/validators/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,26 @@ def validate_options(self, options: dict):

if options["subcommand"] == "run":
required = ["task", "infra", "stage"]
notsupported = ["switches"]
elif options["subcommand"] == "verify":
required = ["task", "infra", "stage"]
notsupported = ["commit"]
notsupported = ["switches", "commit"]
elif options["subcommand"] in ("lock", "unlock"):
required = ["infra", "stage"]
notsupported = ["task", "commit", "limit"]
notsupported = ["switches", "task", "commit", "limit", "raw_output"]
elif options["subcommand"] == "list":
notsupported = ["commit", "limit"]
notsupported = ["switches", "commit", "keep_locked", "limit", "raw_output"]
elif options["subcommand"] == "show":
notsupported = ["commit", "limit"]
notsupported = ["commit", "keep_locked", "limit", "raw_output"]

failed = False
for req in required:
if options[req] is None:
if not options[req]:
self.logger.error("%s is required for %s", req, options["subcommand"])
failed = True

for notsup in notsupported:
if options[notsup] is not None:
if options[notsup]:
self.logger.error("%s is not supported by %s", notsup, options["subcommand"])
failed = True

Expand Down

0 comments on commit 324ca61

Please # to comment.