Skip to content

Commit

Permalink
Refactor domain validation and error handling in bind-user-domains sc…
Browse files Browse the repository at this point in the history
…ript (#588)
  • Loading branch information
stephdl authored Feb 28, 2024
1 parent 05b5dbe commit 2520b3a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ rdb = agent.redis_connect(privileged=True)
is_included = set(domain_list).issubset(set(domains))

if not is_included:
print(f"Error: the domain_list {domain_list} is not included in the list of domains {domains}", file=sys.stderr)
sys.exit(1)
agent.set_status('validation-failed')
json.dump([{'field':'domains', 'parameter':'domains','value': domain_list, 'error':'not_included_in_the_domains_list'}], fp=sys.stdout)
# we print the error message in logs
print(agent.SD_WARNING + f"Error: the domain_list {domain_list} is not included in the list of domains {domains}", file=sys.stderr)
sys.exit(3)

rdb.hset(f'cluster/module_domains', module_id, " ".join(domain_list))

Expand Down

0 comments on commit 2520b3a

Please sign in to comment.