| OLD | NEW |
| 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
| 3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 # Cleanup the Google Storage dart-editor-archive-continuous bucket. | 5 # Cleanup the Google Storage dart-editor-archive-continuous bucket. |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import platform | 8 import platform |
| 9 import subprocess | 9 import subprocess |
| 10 import tempfile | 10 import tempfile |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 if p.returncode: | 389 if p.returncode: |
| 390 failure_message = 'failed to getacl {0}\n'.format(item_uri) | 390 failure_message = 'failed to getacl {0}\n'.format(item_uri) |
| 391 self._LogStream(err, failure_message, True) | 391 self._LogStream(err, failure_message, True) |
| 392 message = None | 392 message = None |
| 393 else: | 393 else: |
| 394 message = '' | 394 message = '' |
| 395 for ch in out: | 395 for ch in out: |
| 396 message += ch | 396 message += ch |
| 397 return message | 397 return message |
| 398 | 398 |
| 399 def AddPublicAcl(self, acl): | 399 def AddPublicAcl(self, acl): # pylint: disable=R0201 |
| 400 """Create the new ACL for the Object. | 400 """Create the new ACL for the Object. |
| 401 | 401 |
| 402 Args: | 402 Args: |
| 403 acl: the xml document representing the ACL | 403 acl: the xml document representing the ACL |
| 404 | 404 |
| 405 Returns: | 405 Returns: |
| 406 xml document with updated ACL | 406 xml document with updated ACL |
| 407 """ | 407 """ |
| 408 root = ET.fromstring(acl) | 408 root = ET.fromstring(acl) |
| 409 #root = dom.getroot() | 409 #root = dom.getroot() |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 p = subprocess.Popen(args, stdout=subprocess.PIPE, | 499 p = subprocess.Popen(args, stdout=subprocess.PIPE, |
| 500 stderr=subprocess.PIPE, | 500 stderr=subprocess.PIPE, |
| 501 shell=self._useshell) | 501 shell=self._useshell) |
| 502 (out, err) = p.communicate() | 502 (out, err) = p.communicate() |
| 503 if p.returncode: | 503 if p.returncode: |
| 504 failure_message = 'failed to setacl {0}\n'.format(object_uri) | 504 failure_message = 'failed to setacl {0}\n'.format(object_uri) |
| 505 self._LogStream(err, failure_message, True) | 505 self._LogStream(err, failure_message, True) |
| 506 else: | 506 else: |
| 507 self._LogStream(out, '') | 507 self._LogStream(out, '') |
| 508 | 508 |
| 509 def _PrintFailure(self, text): | 509 def _PrintFailure(self, text): # pylint: disable=R0201 |
| 510 """Print a failure message.""" | 510 """Print a failure message.""" |
| 511 error_line_seperator = '*****************************' | 511 error_line_seperator = '*****************************' |
| 512 | 512 |
| 513 print | 513 print |
| 514 print error_line_seperator | 514 print error_line_seperator |
| 515 print text | 515 print text |
| 516 print error_line_seperator | 516 print error_line_seperator |
| 517 print | 517 print |
| 518 | 518 |
| 519 def _CommandGsutil(self): | 519 def _CommandGsutil(self): |
| 520 """Execute a gsutil command. | 520 """Execute a gsutil command. |
| 521 | 521 |
| 522 Returns: | 522 Returns: |
| 523 the command to execute gsutil | 523 the command to execute gsutil |
| 524 """ | 524 """ |
| 525 args = [] | 525 args = [] |
| 526 if not self._running_on_buildbot and self._useshell: | 526 if not self._running_on_buildbot and self._useshell: |
| 527 args.append('python') | 527 args.append('python') |
| 528 args.append(self._gsutil) | 528 args.append(self._gsutil) |
| 529 return args | 529 return args |
| OLD | NEW |