diff --git a/.gitignore b/.gitignore index f717486..c4cf44f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# tmp files +*.swp + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/src/sorunlib/util.py b/src/sorunlib/util.py index afe02c4..c1af830 100644 --- a/src/sorunlib/util.py +++ b/src/sorunlib/util.py @@ -74,17 +74,21 @@ def create_clients(config=None, test_mode=False): 'smurf': [smurf_client1, smurf_client2, smurf_client3]} """ + clients = {} + if test_mode: smurf_agent_class = 'SmurfFileEmulator' else: smurf_agent_class = 'PysmurfController' - acu_id = _find_instances('ACUAgent', config) - smurf_ids = _find_instances(smurf_agent_class, config) + acu_id = _find_instances('ACUAgent', config=config) + smurf_ids = _find_instances(smurf_agent_class, config=config) - acu_client = OCSClient(acu_id[0]) - smurf_clients = [OCSClient(x) for x in smurf_ids] + if acu_id: + acu_client = OCSClient(acu_id[0]) + clients['acu'] = acu_client + if smurf_ids: + smurf_clients = [OCSClient(x) for x in smurf_ids] + clients['smurf'] = smurf_clients - clients = {'acu': acu_client, - 'smurf': smurf_clients} return clients