pyats.utils.fileutils.plugins.localhost package¶
Subpackages¶
Submodules¶
File utils base class for Linux servers.
- class pyats.utils.fileutils.plugins.localhost.fileutils.FileUtils(*args, os='localhost', protocol=None, **kwargs)¶
Bases:
pyats.utils.fileutils.bases.fileutils.FileUtilsBase
Initialize an instance of FileUtils
- Parameters
os (
str
) – The operating system of the device acting as a file transfer client.testbed (
pyats.topology.Testbed
) – The testbed object that contains auth and address details for servers referenced by file transfer URLs.
- DEFAULT_COPY_TIMEOUT_SECONDS = 1200¶
- DEFAULT_TIMEOUT_SECONDS = 60¶
- chmod(target, mode, timeout_seconds=60, *args, **kwargs)¶
Change file permissions
- close()¶
Deallocate any resources being held.
- copyfile(source, destination, timeout_seconds=1200, *args, **kwargs)¶
Copy a single file.
Copy a single file either from local to remote, or remote to local. Remote to remote transfers are not supported. Users are expected to make two calls to this API to do this.
- deletefile(target, timeout_seconds=60, *args, **kwargs)¶
Delete a file
- dir(target, timeout_seconds=60, *args, **kwargs)¶
Retrieve filenames contained in a directory.
Do not recurse into subdirectories, only list files at the top level of the given directory.
- get_child(abstraction_scheme, **kwargs)¶
Attempt to load a protocol implementation.
First, attempt to load a native Python implementation. If none is available, then attempt to load a curl-based implementation.
- Raises
Exception – if the requested protocol is not supported, this occurs when no plugin can be found.
- getspace(target, timeout_seconds=60, *args, **kwargs)¶
get the available disk space from the file server, in bytes.
- is_valid_ip(ip)¶
- renamefile(source, destination, timeout_seconds=60, *args, **kwargs)¶
Rename a file
- stat(target, timeout_seconds=60, *args, **kwargs)¶
Retrieve file details such as length and permissions.
- Parameters
- Returns
`os.stat_result`
- Return type
Filename details including size.
- Raises
- validate_and_parse_url(url, calling_method)¶
- Returns
- Return type
server name, server port, resource path