예제 #1
0
    def testPostprocessDeleteLVM(self, mock_subprocess, mock_output):
        """Test PostprocessDeleteLosetup method on LVM."""
        lv_uuid = 'RI0pgm-rdy4-XxcL-5eoK-Easc-fgPq-CWaEJb'
        mock_output.return_value = (
            '  /dev/test_volume_group/test_logical_volume1:test_volume_group:3:0:-1:'
            '0:8192:1:-1:0:-1:-1:-1\n')
        mount_local.PostprocessDeleteLosetup(None, lv_uuid=lv_uuid)
        expected_args = [
            'sudo', 'lvdisplay', '--colon', '--select',
            'lv_uuid={0:s}'.format(lv_uuid)
        ]
        mock_output.assert_called_once_with(expected_args,
                                            universal_newlines=True)
        mock_subprocess.assert_called_once_with(
            ['sudo', 'vgchange', '-a', 'n', 'test_volume_group'])

        # Test vgchange error
        mock_subprocess.reset_mock()
        mock_subprocess.side_effect = CalledProcessError(1, 'vgchange')
        with self.assertRaises(TurbiniaException):
            mount_local.PostprocessDeleteLosetup(None, lv_uuid=lv_uuid)

        # Test lvdisplay error
        mock_output.reset_mock()
        mock_output.side_effect = CalledProcessError(1, 'lvdisplay')
        with self.assertRaises(TurbiniaException):
            mount_local.PostprocessDeleteLosetup(None, lv_uuid=lv_uuid)
    def testPostprocessDeleteLosetup(self, mock_subprocess):
        """Test PostprocessDeleteLosetup method."""
        mount_local.PostprocessDeleteLosetup('/dev/loop0')
        mock_subprocess.assert_called_once_with(
            ['sudo', 'losetup', '-d', '/dev/loop0'])

        # Test losetup error
        mock_subprocess.reset_mock()
        mock_subprocess.side_effect = CalledProcessError(1, 'losetup')
        with self.assertRaises(TurbiniaException):
            mount_local.PostprocessDeleteLosetup('/dev/loop0')
예제 #3
0
 def _postprocess(self):
     if self.state[EvidenceState.PARENT_MOUNTED]:
         mount_local.PostprocessUnmountPath(self.mount_path)
         self.state[EvidenceState.PARENT_MOUNTED] = False
     if self.state[EvidenceState.PARENT_ATTACHED]:
         mount_local.PostprocessDeleteLosetup(self.device_path)
         self.state[EvidenceState.PARENT_ATTACHED] = False
예제 #4
0
  def _postprocess(self):
    if self.state[EvidenceState.ATTACHED]:
      mount_local.PostprocessDeleteLosetup(self.device_path)
      self.state[EvidenceState.ATTACHED] = False

    # Need to unmount parent disk
    if self.parent_evidence.state[EvidenceState.MOUNTED]:
      mount_local.PostprocessUnmountPath(self.parent_evidence.mount_path)
      self.parent_evidence.state[EvidenceState.MOUNTED] = False
예제 #5
0
  def _postprocess(self):
    if self.state[EvidenceState.MOUNTED]:
      mount_local.PostprocessUnmountPath(self.mount_path)
      self.state[EvidenceState.MOUNTED] = False
    if self.state[EvidenceState.ATTACHED]:
      # Late loading the partition processor to avoid loading dfVFS unnecessarily.
      from turbinia.processors import partitions

      # Check for encryption
      encryption_type = partitions.GetPartitionEncryptionType(self.path_spec)
      if encryption_type == 'BDE':
        # bdemount creates a virtual device named bde1 in the mount path. This
        # needs to be unmounted rather than detached.
        mount_local.PostprocessUnmountPath(self.device_path.replace('bde1', ''))
        self.state[EvidenceState.ATTACHED] = False
      else:
        mount_local.PostprocessDeleteLosetup(self.device_path)
        self.state[EvidenceState.ATTACHED] = False
예제 #6
0
 def _postprocess(self):
   google_cloud.PostprocessDetachDisk(self.disk_name, self.local_path)
   mount_local.PostprocessUnmountPath(self.mount_path)
   mount_local.PostprocessDeleteLosetup(self.loopdevice_path)
예제 #7
0
 def _postprocess(self):
   mount_local.PostprocessDeleteLosetup(self.loopdevice_path)
   self.loopdevice_path = None
예제 #8
0
 def _postprocess(self):
     if self.state[EvidenceState.ATTACHED]:
         mount_local.PostprocessDeleteLosetup(self.device_path)
         self.state[EvidenceState.ATTACHED] = False
예제 #9
0
 def _postprocess(self):
     mount_local.PostprocessUnmountPath(self.mount_path)
     mount_local.PostprocessDeleteLosetup(self.device_path)