Skip to content
Permalink
Browse files

Miscellaneous cleanups - typos, unused imports and unicode literals

  • Loading branch information
Onager committed Aug 17, 2018
1 parent 1f70f2a commit 88bf5eeab4c2bbc5f4660199ecded6fdfa140c27
@@ -23,3 +23,6 @@ terraform/gcp/terraform.tfstate
terraform/gcp/terraform.tfstate.backup
terraform/gcp/terraform.tfvars
terraform/gcp/*.auto.tfvars

# Exclude pycharm files
.idea/
@@ -32,7 +32,7 @@ def evidence_decode(evidence_dict):
"""Decode JSON into appropriate Evidence object.
Args:
evidence_dict: JSON serializeable evidence object (i.e. a dict post JSON
evidence_dict: JSON serializable evidence object (i.e. a dict post JSON
decoding).
Returns:
@@ -14,6 +14,8 @@
# limitations under the License.
"""Job to execute Plaso task."""

from __future__ import unicode_literals

from turbinia.evidence import Directory
from turbinia.evidence import GoogleCloudDisk
from turbinia.evidence import GoogleCloudDiskRawEmbedded
@@ -14,6 +14,9 @@
# limitations under the License.
"""Job to execute Psort task."""


from __future__ import unicode_literals

from turbinia.evidence import PlasoFile
from turbinia.evidence import PlasoCsvFile
from turbinia.jobs import TurbiniaJob
@@ -14,6 +14,9 @@
# limitations under the License.
"""Job to execute strings task."""


from __future__ import unicode_literals

from turbinia.evidence import GoogleCloudDisk
from turbinia.evidence import GoogleCloudDiskRawEmbedded
from turbinia.evidence import RawDisk
@@ -14,6 +14,9 @@
# limitations under the License.
"""Job for running a stat call on the supplied evidence."""


from __future__ import unicode_literals

from turbinia.evidence import Directory
from turbinia.evidence import RawDisk
from turbinia.evidence import ReportText
@@ -52,7 +52,6 @@ def GetLocalInstanceName():
Returns:
The instance name as a string
"""
instance = None
# TODO(aarontp): Use cloud API instead of manual requests to metadata service.
req = urllib2.Request(
'http://metadata.google.internal/computeMetadata/v1/instance/name',
@@ -14,6 +14,9 @@
# limitations under the License.
"""Evidence processor to mount local images or disks."""


from __future__ import unicode_literals

import logging
import os
import subprocess
@@ -22,7 +22,6 @@

import json
import logging
import sys
from datetime import datetime
from datetime import timedelta

@@ -228,8 +228,7 @@ def main():
'-n', '--name', help='Descriptive name of the evidence', required=False)

# List Jobs
parser_listjobs = subparsers.add_parser(
'listjobs', help='List all available jobs')
subparsers.add_parser('listjobs', help='List all available jobs')

# PSQ Worker
parser_psqworker = subparsers.add_parser('psqworker', help='Run PSQ worker')
@@ -241,8 +240,7 @@ def main():
required=False)

# Celery Worker
parser_celeryworker = subparsers.add_parser(
'celeryworker', help='Run Celery worker')
subparsers.add_parser('celeryworker', help='Run Celery worker')

# Parser options for Turbinia status command
parser_status = subparsers.add_parser(
@@ -277,7 +275,7 @@ def main():
'-u', '--user', help='Show task for given user', required=False)

# Server
parser_server = subparsers.add_parser('server', help='Run Turbinia Server')
subparsers.add_parser('server', help='Run Turbinia Server')

args = parser.parse_args()
if args.quiet:
@@ -338,7 +338,7 @@ def touch(self):
self.last_update = datetime.now()

def result_check(self, result):
"""Checks to make sure that the result is serializeable.
"""Checks to make sure that the result is serializable.
We occasionally get something added into a TurbiniaTaskResult that makes
it unpickleable. We don't necessarily know what caused it to be in that
@@ -384,7 +384,7 @@ def run_wrapper(self, evidence):
This wrapper should be called to invoke the run() methods so it can handle
the management of TurbiniaTaskResults and the exception handling. Otherwise
details from exceptions in the worker cannot be propogated back to the
details from exceptions in the worker cannot be propagated back to the
Turbinia TaskManager.
Args:
@@ -404,8 +404,8 @@ def run_wrapper(self, evidence):
tmp_result = self.run(evidence, self.result)
if not isinstance(tmp_result, TurbiniaTaskResult):
raise TurbiniaException(
'Task returned type [{0:s}] instead of TurbiniaTaskResult.').format(
type(tmp_result))
'Task returned type [{0:s}] instead of TurbiniaTaskResult.'.format(
type(tmp_result)))
self.result = tmp_result
# pylint: disable=broad-except
except (TurbiniaException, Exception) as e:
@@ -421,7 +421,7 @@ def run_wrapper(self, evidence):
log.error('No TurbiniaTaskResult object found after task execution.')

# Trying to close the result if possible so that we clean up what we can.
# This has a higher liklihood of failing because something must have gone
# This has a higher likelihood of failing because something must have gone
# wrong as the Task should have already closed this.
if self.result and not self.result.closed:
msg = 'Trying last ditch attempt to close result'
@@ -19,6 +19,8 @@
in PSQ.
"""

from __future__ import unicode_literals

import os

from turbinia.workers import TurbiniaTask
@@ -35,7 +37,7 @@ def run(self, evidence, result):
evidence: Path to data to process.
Returns:
TurbiniaTaskResult object.
TurbiniaTaskResult: object.
"""
report = ReportText()
result.log('Running stat on evidence {0:s}'.format(evidence.local_path))
@@ -16,14 +16,12 @@

from __future__ import unicode_literals

import json
import mock
import os
import tempfile
import unittest

from turbinia import evidence
from turbinia import TurbiniaException
from turbinia.workers import TurbiniaTask
from turbinia.workers import TurbiniaTaskResult

0 comments on commit 88bf5ee

Please sign in to comment.
You can’t perform that action at this time.