-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
42 lines (31 loc) · 1.02 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from cloud import CloudAPI
import sys
import logging_setup
import argument_parser
import environment
import device_matcher
import device_handler
def main():
logger = logging_setup.setup_logging()
args = argument_parser.parse_arguments()
env_vars = environment.load_environment_variables(args)
if args.delegation_config:
cloud = CloudAPI(
api_client=env_vars["TORIZON_API_CLIENT_ID"],
api_secret=env_vars["TORIZON_API_SECRET_ID"],
delegation_config_path=args.delegation_config,
)
else:
logger.error("Missing delegation config file")
sys.exit(1)
possible_duts = device_matcher.find_possible_devices(cloud, args, env_vars)
if (
device_handler.process_devices(possible_duts, cloud, env_vars, args)
and not env_vars["TEST_WHOLE_FLEET"]
):
sys.exit(0)
if not env_vars["TEST_WHOLE_FLEET"]:
# EX_UNAVAILABLE 69 /* service unavailable */ sysexits.h
sys.exit(69)
if __name__ == "__main__":
main()