MCPcopy Create free account
hub / github.com/StackStorm/st2 / delete_dir

Method delete_dir

st2common/st2common/runners/paramiko_ssh.py:349–377  ·  view source on GitHub ↗

Delete a dir on remote box. :param path: Path to remote dir to be deleted. :type path: ``str`` :param force: Optional Forcefully remove dir. :type force: ``bool`` :param timeout: Optional Time to wait for dir to be deleted. Only relevant for force.

(self, path, force=False, timeout=None)

Source from the content-addressed store, hash-verified

347 return True
348
349 def delete_dir(self, path, force=False, timeout=None):
350 """
351 Delete a dir on remote box.
352
353 :param path: Path to remote dir to be deleted.
354 :type path: ``str``
355
356 :param force: Optional Forcefully remove dir.
357 :type force: ``bool``
358
359 :param timeout: Optional Time to wait for dir to be deleted. Only relevant for force.
360 :type timeout: ``int``
361
362 :return: True if the file has been successfully deleted, False
363 otherwise.
364 :rtype: ``bool``
365 """
366
367 path = quote_unix(path)
368 extra = {"_path": path}
369 if force:
370 command = "rm -rf %s" % path
371 extra["_command"] = command
372 extra["_force"] = force
373 self.logger.debug("Deleting dir", extra=extra)
374 return self.run(command, timeout=timeout)
375
376 self.logger.debug("Deleting dir", extra=extra)
377 return self.sftp.rmdir(path)
378
379 def run(self, cmd, timeout=None, quote=False, call_line_handler_func=False):
380 """

Callers 1

_runMethod · 0.45

Calls 2

runMethod · 0.95
quote_unixFunction · 0.90

Tested by

no test coverage detected