OLD | NEW |
1 #!/usr/bin/python2.5 | 1 #!/usr/bin/python2.5 |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """A bare-bones test server for testing cloud policy support. | 6 """A bare-bones test server for testing cloud policy support. |
7 | 7 |
8 This implements a simple cloud policy test server that can be used to test | 8 This implements a simple cloud policy test server that can be used to test |
9 chrome's device management service client. The policy information is read from | 9 chrome's device management service client. The policy information is read from |
10 the file named device_management in the server's data directory. It contains | 10 the file named device_management in the server's data directory. It contains |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 import logging | 43 import logging |
44 import os | 44 import os |
45 import random | 45 import random |
46 import re | 46 import re |
47 import sys | 47 import sys |
48 import time | 48 import time |
49 import tlslite | 49 import tlslite |
50 import tlslite.api | 50 import tlslite.api |
51 import tlslite.utils | 51 import tlslite.utils |
52 | 52 |
| 53 LOG_FILENAME = '/dev/stdout' |
| 54 logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG) |
| 55 |
| 56 |
53 # The name and availability of the json module varies in python versions. | 57 # The name and availability of the json module varies in python versions. |
54 try: | 58 try: |
55 import simplejson as json | 59 import simplejson as json |
56 except ImportError: | 60 except ImportError: |
57 try: | 61 try: |
58 import json | 62 import json |
59 except ImportError: | 63 except ImportError: |
60 json = None | 64 json = None |
61 | 65 |
62 import asn1der | 66 import asn1der |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 return self._registered_tokens.get(dmtoken, None) | 651 return self._registered_tokens.get(dmtoken, None) |
648 | 652 |
649 def UnregisterDevice(self, dmtoken): | 653 def UnregisterDevice(self, dmtoken): |
650 """Unregisters a device identified by the given DM token. | 654 """Unregisters a device identified by the given DM token. |
651 | 655 |
652 Args: | 656 Args: |
653 dmtoken: The device management token provided by the client. | 657 dmtoken: The device management token provided by the client. |
654 """ | 658 """ |
655 if dmtoken in self._registered_tokens.keys(): | 659 if dmtoken in self._registered_tokens.keys(): |
656 del self._registered_tokens[dmtoken] | 660 del self._registered_tokens[dmtoken] |
OLD | NEW |