diff options
author | Steve McIntyre <steve.mcintyre@linaro.org> | 2014-12-16 19:23:10 +0000 |
---|---|---|
committer | Steve McIntyre <steve.mcintyre@linaro.org> | 2014-12-16 19:23:10 +0000 |
commit | 0ebf583ad216b0c4b7ac54321e68a5d59face226 (patch) | |
tree | cbeb7bb2d4e26ffaebb736ac315bd6733b53245d /vland.py | |
parent | 231354baf0ef7c3397fffecacd3388f9190b82eb (diff) |
Rename "query" to "db_query" in vland, so we can add "daemon_query"
Change-Id: I15479939062c8f6b68aa2567a983b3938cd9816e
Diffstat (limited to 'vland.py')
-rw-r--r-- | vland.py | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -131,10 +131,27 @@ while True: response = {} - if json_data['type'] == 'query': - response['type'] = 'queryresponse' + # Several types of IPC message here, with potentially different + # access control and safety + + # First - simple queries to the database only. Should be safe! + if json_data['type'] == 'db_query': + response['type'] = 'response' + try: + response['data'] = util.perform_db_query(db, json_data['command'], json_data['data']) + response['response'] = 'ACK' + except InputError as e: + print e + response['response'] = 'ERROR' + response['error'] = e.__str__() + print 'FOO?' + pass + + # Next - simple queries about daemon state only. Should be safe! + if json_data['type'] == 'daemon_query': + response['type'] = 'response' try: - response['data'] = util.perform_query(db, json_data['command'], json_data['data']) + response['data'] = util.perform_daemon_query(state, json_data['command'], json_data['data']) response['response'] = 'ACK' except InputError as e: print e |