OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging, os, re | 5 import logging, os, re |
6 from autotest_lib.client.bin import site_log_reader, site_utils, test | 6 from autotest_lib.client.bin import site_log_reader, site_utils, test |
7 from autotest_lib.client.bin.chromeos_constants import CLEANUP_LOGS_PAUSED_FILE | |
8 from autotest_lib.client.common_lib import error, utils | 7 from autotest_lib.client.common_lib import error, utils |
| 8 from autotest_lib.client.cros.constants import CLEANUP_LOGS_PAUSED_FILE |
9 | 9 |
10 class LogRotationPauser(object): | 10 class LogRotationPauser(object): |
11 """ | 11 """ |
12 Class to control when logs are rotated from either server or client. | 12 Class to control when logs are rotated from either server or client. |
13 | 13 |
14 Assumes all setting of CLEANUP_LOGS_PAUSED_FILE is done by this class | 14 Assumes all setting of CLEANUP_LOGS_PAUSED_FILE is done by this class |
15 and that all calls to begin and end are properly | 15 and that all calls to begin and end are properly |
16 nested. For instance, [ a.begin(), b.begin(), b.end(), a.end() ] is | 16 nested. For instance, [ a.begin(), b.begin(), b.end(), a.end() ] is |
17 supported, but [ a.begin(), b.begin(), a.end(), b.end() ] is not. | 17 supported, but [ a.begin(), b.begin(), a.end(), b.end() ] is not. |
18 We do support redundant calls to the same class, such as | 18 We do support redundant calls to the same class, such as |
(...skipping 27 matching lines...) Expand all Loading... |
46 self._begun = True | 46 self._begun = True |
47 | 47 |
48 | 48 |
49 def end(self): | 49 def end(self): |
50 assert self._begun | 50 assert self._begun |
51 if not self._is_nested: | 51 if not self._is_nested: |
52 self._run('rm -f ' + CLEANUP_LOGS_PAUSED_FILE) | 52 self._run('rm -f ' + CLEANUP_LOGS_PAUSED_FILE) |
53 else: | 53 else: |
54 logging.info('Leaving existing %s file' % CLEANUP_LOGS_PAUSED_FILE) | 54 logging.info('Leaving existing %s file' % CLEANUP_LOGS_PAUSED_FILE) |
55 self._begun = False | 55 self._begun = False |
OLD | NEW |