def _remove_temp_directory(self):
     L.debug("Removing temp directory {}".format(
         self._device.temp_directory()))
     cmd = ['sudo', '-n', 'rm', '-rf', self._device.temp_directory()]
     ret, stdout, stderr = self._device.connector().execute(cmd)
     # TODO: warn instead of raising
     if ret != 0:
         raise XVProcessException(cmd, ret, stdout, stderr)
Exemple #2
0
 def _create_temp_directory(self):
     # Note we can't use execute_scriptlet yet as that relies on the temp dir existing.
     L.debug("Ensuring temp directory {} exists".format(
         self._device.temp_directory()))
     cmd = ['mkdir', '-p', self._device.temp_directory()]
     ret, stdout, stderr = self._device.connector().execute(cmd)
     if ret:
         raise XVEx("Couldn't create temp directory: {}".format(
             XVProcessException(cmd, ret, stdout, stderr)))
    def add_torrent(self, magnet_uri):
        if not self._daemon_started:
            L.debug("Transmission daemon not started; starting...")
            self.open()
            # TODO: replace this sleep with a timeout.
            time.sleep(1)
        L.debug("Adding {} to Transmission".format(magnet_uri))
        cmd = ['transmission-remote', '--add', "{}".format(magnet_uri)]
        out = self._device.connector().execute(cmd)
        if out[0]:
            raise XVProcessException(cmd, *out)

        self.added_torrents.append(self._object_from_magnet_uri(magnet_uri))
Exemple #4
0
 def check_python(self, cmd, root=False):
     ret, stdout, stderr = self.execute_python(cmd, root)
     if ret != 0:
         raise XVProcessException(cmd, ret, stdout, stderr)
     return stdout, stderr
Exemple #5
0
 def check_command(self, cmd, root=False):
     cmd = ConnectorHelper._sanitize_cmd(cmd)
     ret, stdout, stderr = self.execute_command(cmd, root)
     if ret != 0:
         raise XVProcessException(cmd, ret, stdout, stderr)
     return stdout, stderr
 def _check_adb_cmd(self, cmd):
     ret, stdout, stderr = self._run_adb_cmd(cmd)
     if ret:
         raise XVProcessException(cmd, ret, stdout, stderr)
     return ret, stdout, stderr
Exemple #7
0
 def check_command(self, cmd, root=False):
     ret, stdout, stderr = self._device.connector().execute(cmd, root)
     if ret:
         raise XVProcessException(cmd, ret, stdout, stderr)
     return ret, stdout, stderr