partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
append
.. versionadded:: 0.9.5 Append text to the end of a file path path to file `*args` strings to append to file CLI Example: .. code-block:: bash salt '*' file.append /etc/motd \\ "With all thine offerings thou shalt offer salt." \\ "Salt is...
salt/modules/file.py
def append(path, *args, **kwargs): ''' .. versionadded:: 0.9.5 Append text to the end of a file path path to file `*args` strings to append to file CLI Example: .. code-block:: bash salt '*' file.append /etc/motd \\ "With all thine offerings thou...
def append(path, *args, **kwargs): ''' .. versionadded:: 0.9.5 Append text to the end of a file path path to file `*args` strings to append to file CLI Example: .. code-block:: bash salt '*' file.append /etc/motd \\ "With all thine offerings thou...
[ "..", "versionadded", "::", "0", ".", "9", ".", "5" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L2998-L3067
[ "def", "append", "(", "path", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "# Largely inspired by Fabric's contrib.files.append()", "if", "'args'", "in", "kwargs", ":", "if", "isi...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
prepend
.. versionadded:: 2014.7.0 Prepend text to the beginning of a file path path to file `*args` strings to prepend to the file CLI Example: .. code-block:: bash salt '*' file.prepend /etc/motd \\ "With all thine offerings thou shalt offer salt." \\ ...
salt/modules/file.py
def prepend(path, *args, **kwargs): ''' .. versionadded:: 2014.7.0 Prepend text to the beginning of a file path path to file `*args` strings to prepend to the file CLI Example: .. code-block:: bash salt '*' file.prepend /etc/motd \\ "With all thi...
def prepend(path, *args, **kwargs): ''' .. versionadded:: 2014.7.0 Prepend text to the beginning of a file path path to file `*args` strings to prepend to the file CLI Example: .. code-block:: bash salt '*' file.prepend /etc/motd \\ "With all thi...
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3070-L3125
[ "def", "prepend", "(", "path", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "'args'", "in", "kwargs", ":", "if", "isinstance", "(", "kwargs", "[", "'args'", "]", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
write
.. versionadded:: 2014.7.0 Write text to a file, overwriting any existing contents. path path to file `*args` strings to write to the file CLI Example: .. code-block:: bash salt '*' file.write /etc/motd \\ "With all thine offerings thou shalt offer salt....
salt/modules/file.py
def write(path, *args, **kwargs): ''' .. versionadded:: 2014.7.0 Write text to a file, overwriting any existing contents. path path to file `*args` strings to write to the file CLI Example: .. code-block:: bash salt '*' file.write /etc/motd \\ "W...
def write(path, *args, **kwargs): ''' .. versionadded:: 2014.7.0 Write text to a file, overwriting any existing contents. path path to file `*args` strings to write to the file CLI Example: .. code-block:: bash salt '*' file.write /etc/motd \\ "W...
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3128-L3173
[ "def", "write", "(", "path", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "'args'", "in", "kwargs", ":", "if", "isinstance", "(", "kwargs", "[", "'args'", "]", ","...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
touch
.. versionadded:: 0.9.5 Just like the ``touch`` command, create a file if it doesn't exist or simply update the atime and mtime if it already does. atime: Access time in Unix epoch time. Set it to 0 to set atime of the file with Unix date of birth. If this parameter isn't set, atime ...
salt/modules/file.py
def touch(name, atime=None, mtime=None): ''' .. versionadded:: 0.9.5 Just like the ``touch`` command, create a file if it doesn't exist or simply update the atime and mtime if it already does. atime: Access time in Unix epoch time. Set it to 0 to set atime of the file with Unix dat...
def touch(name, atime=None, mtime=None): ''' .. versionadded:: 0.9.5 Just like the ``touch`` command, create a file if it doesn't exist or simply update the atime and mtime if it already does. atime: Access time in Unix epoch time. Set it to 0 to set atime of the file with Unix dat...
[ "..", "versionadded", "::", "0", ".", "9", ".", "5" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3176-L3224
[ "def", "touch", "(", "name", ",", "atime", "=", "None", ",", "mtime", "=", "None", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "if", "atime", "and", "atime", ".", "isdigit", "(", ")", ":", "atime", "=", "int", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
tail
.. versionadded:: Neon Read the last n lines from a file path path to file lines number of lines to read CLI Example: .. code-block:: bash salt '*' file.tail /path/to/file 10
salt/modules/file.py
def tail(path, lines): ''' .. versionadded:: Neon Read the last n lines from a file path path to file lines number of lines to read CLI Example: .. code-block:: bash salt '*' file.tail /path/to/file 10 ''' path = os.path.expanduser(path) lines_found ...
def tail(path, lines): ''' .. versionadded:: Neon Read the last n lines from a file path path to file lines number of lines to read CLI Example: .. code-block:: bash salt '*' file.tail /path/to/file 10 ''' path = os.path.expanduser(path) lines_found ...
[ "..", "versionadded", "::", "Neon" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3227-L3287
[ "def", "tail", "(", "path", ",", "lines", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "lines_found", "=", "[", "]", "buffer_size", "=", "4098", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
seek_read
.. versionadded:: 2014.1.0 Seek to a position on a file and read it path path to file seek amount to read at once offset offset to start into the file CLI Example: .. code-block:: bash salt '*' file.seek_read /path/to/file 4096 0
salt/modules/file.py
def seek_read(path, size, offset): ''' .. versionadded:: 2014.1.0 Seek to a position on a file and read it path path to file seek amount to read at once offset offset to start into the file CLI Example: .. code-block:: bash salt '*' file.seek_read /...
def seek_read(path, size, offset): ''' .. versionadded:: 2014.1.0 Seek to a position on a file and read it path path to file seek amount to read at once offset offset to start into the file CLI Example: .. code-block:: bash salt '*' file.seek_read /...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3290-L3318
[ "def", "seek_read", "(", "path", ",", "size", ",", "offset", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "seek_fh", "=", "os", ".", "open", "(", "path", ",", "os", ".", "O_RDONLY", ")", "try", ":", "os", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
seek_write
.. versionadded:: 2014.1.0 Seek to a position on a file and write to it path path to file data data to write to file offset position in file to start writing CLI Example: .. code-block:: bash salt '*' file.seek_write /path/to/file 'some data' 4096
salt/modules/file.py
def seek_write(path, data, offset): ''' .. versionadded:: 2014.1.0 Seek to a position on a file and write to it path path to file data data to write to file offset position in file to start writing CLI Example: .. code-block:: bash salt '*' file.see...
def seek_write(path, data, offset): ''' .. versionadded:: 2014.1.0 Seek to a position on a file and write to it path path to file data data to write to file offset position in file to start writing CLI Example: .. code-block:: bash salt '*' file.see...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3321-L3350
[ "def", "seek_write", "(", "path", ",", "data", ",", "offset", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "seek_fh", "=", "os", ".", "open", "(", "path", ",", "os", ".", "O_WRONLY", ")", "try", ":", "os", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
truncate
.. versionadded:: 2014.1.0 Seek to a position on a file and delete everything after that point path path to file length offset into file to truncate CLI Example: .. code-block:: bash salt '*' file.truncate /path/to/file 512
salt/modules/file.py
def truncate(path, length): ''' .. versionadded:: 2014.1.0 Seek to a position on a file and delete everything after that point path path to file length offset into file to truncate CLI Example: .. code-block:: bash salt '*' file.truncate /path/to/file 512 ''...
def truncate(path, length): ''' .. versionadded:: 2014.1.0 Seek to a position on a file and delete everything after that point path path to file length offset into file to truncate CLI Example: .. code-block:: bash salt '*' file.truncate /path/to/file 512 ''...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3353-L3373
[ "def", "truncate", "(", "path", ",", "length", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "path", ",", "'rb+'", ")", "as", "seek_fh", ":", "seek_fh",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
link
.. versionadded:: 2014.1.0 Create a hard link to a file CLI Example: .. code-block:: bash salt '*' file.link /path/to/file /path/to/link
salt/modules/file.py
def link(src, path): ''' .. versionadded:: 2014.1.0 Create a hard link to a file CLI Example: .. code-block:: bash salt '*' file.link /path/to/file /path/to/link ''' src = os.path.expanduser(src) if not os.path.isabs(src): raise SaltInvocationError('File path must be...
def link(src, path): ''' .. versionadded:: 2014.1.0 Create a hard link to a file CLI Example: .. code-block:: bash salt '*' file.link /path/to/file /path/to/link ''' src = os.path.expanduser(src) if not os.path.isabs(src): raise SaltInvocationError('File path must be...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3376-L3398
[ "def", "link", "(", "src", ",", "path", ")", ":", "src", "=", "os", ".", "path", ".", "expanduser", "(", "src", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "src", ")", ":", "raise", "SaltInvocationError", "(", "'File path must be absolute.'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
symlink
Create a symbolic link (symlink, soft link) to a file CLI Example: .. code-block:: bash salt '*' file.symlink /path/to/file /path/to/link
salt/modules/file.py
def symlink(src, path): ''' Create a symbolic link (symlink, soft link) to a file CLI Example: .. code-block:: bash salt '*' file.symlink /path/to/file /path/to/link ''' path = os.path.expanduser(path) try: if os.path.normpath(os.readlink(path)) == os.path.normpath(src): ...
def symlink(src, path): ''' Create a symbolic link (symlink, soft link) to a file CLI Example: .. code-block:: bash salt '*' file.symlink /path/to/file /path/to/link ''' path = os.path.expanduser(path) try: if os.path.normpath(os.readlink(path)) == os.path.normpath(src): ...
[ "Create", "a", "symbolic", "link", "(", "symlink", "soft", "link", ")", "to", "a", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3419-L3446
[ "def", "symlink", "(", "src", ",", "path", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "try", ":", "if", "os", ".", "path", ".", "normpath", "(", "os", ".", "readlink", "(", "path", ")", ")", "==", "os", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
rename
Rename a file or directory CLI Example: .. code-block:: bash salt '*' file.rename /path/to/src /path/to/dst
salt/modules/file.py
def rename(src, dst): ''' Rename a file or directory CLI Example: .. code-block:: bash salt '*' file.rename /path/to/src /path/to/dst ''' src = os.path.expanduser(src) dst = os.path.expanduser(dst) if not os.path.isabs(src): raise SaltInvocationError('File path must b...
def rename(src, dst): ''' Rename a file or directory CLI Example: .. code-block:: bash salt '*' file.rename /path/to/src /path/to/dst ''' src = os.path.expanduser(src) dst = os.path.expanduser(dst) if not os.path.isabs(src): raise SaltInvocationError('File path must b...
[ "Rename", "a", "file", "or", "directory" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3449-L3472
[ "def", "rename", "(", "src", ",", "dst", ")", ":", "src", "=", "os", ".", "path", ".", "expanduser", "(", "src", ")", "dst", "=", "os", ".", "path", ".", "expanduser", "(", "dst", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "src", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
copy
Copy a file or directory from source to dst In order to copy a directory, the recurse flag is required, and will by default overwrite files in the destination with the same path, and retain all other existing files. (similar to cp -r on unix) remove_existing will remove all files in the target directo...
salt/modules/file.py
def copy(src, dst, recurse=False, remove_existing=False): ''' Copy a file or directory from source to dst In order to copy a directory, the recurse flag is required, and will by default overwrite files in the destination with the same path, and retain all other existing files. (similar to cp -r on ...
def copy(src, dst, recurse=False, remove_existing=False): ''' Copy a file or directory from source to dst In order to copy a directory, the recurse flag is required, and will by default overwrite files in the destination with the same path, and retain all other existing files. (similar to cp -r on ...
[ "Copy", "a", "file", "or", "directory", "from", "source", "to", "dst" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3475-L3536
[ "def", "copy", "(", "src", ",", "dst", ",", "recurse", "=", "False", ",", "remove_existing", "=", "False", ")", ":", "src", "=", "os", ".", "path", ".", "expanduser", "(", "src", ")", "dst", "=", "os", ".", "path", ".", "expanduser", "(", "dst", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
lstat
.. versionadded:: 2014.1.0 Returns the lstat attributes for the given file or dir. Does not support symbolic links. CLI Example: .. code-block:: bash salt '*' file.lstat /path/to/file
salt/modules/file.py
def lstat(path): ''' .. versionadded:: 2014.1.0 Returns the lstat attributes for the given file or dir. Does not support symbolic links. CLI Example: .. code-block:: bash salt '*' file.lstat /path/to/file ''' path = os.path.expanduser(path) if not os.path.isabs(path): ...
def lstat(path): ''' .. versionadded:: 2014.1.0 Returns the lstat attributes for the given file or dir. Does not support symbolic links. CLI Example: .. code-block:: bash salt '*' file.lstat /path/to/file ''' path = os.path.expanduser(path) if not os.path.isabs(path): ...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3539-L3562
[ "def", "lstat", "(", "path", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "raise", "SaltInvocationError", "(", "'Path to file must be absolute.'", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
access
.. versionadded:: 2014.1.0 Test whether the Salt process has the specified access to the file. One of the following modes must be specified: .. code-block::text f: Test the existence of the path r: Test the readability of the path w: Test the writability of the path x: Tes...
salt/modules/file.py
def access(path, mode): ''' .. versionadded:: 2014.1.0 Test whether the Salt process has the specified access to the file. One of the following modes must be specified: .. code-block::text f: Test the existence of the path r: Test the readability of the path w: Test the wr...
def access(path, mode): ''' .. versionadded:: 2014.1.0 Test whether the Salt process has the specified access to the file. One of the following modes must be specified: .. code-block::text f: Test the existence of the path r: Test the readability of the path w: Test the wr...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3565-L3601
[ "def", "access", "(", "path", ",", "mode", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "raise", "SaltInvocationError", "(", "'Path to link must be a...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
read
.. versionadded:: 2017.7.0 Return the content of the file. CLI Example: .. code-block:: bash salt '*' file.read /path/to/file
salt/modules/file.py
def read(path, binary=False): ''' .. versionadded:: 2017.7.0 Return the content of the file. CLI Example: .. code-block:: bash salt '*' file.read /path/to/file ''' access_mode = 'r' if binary is True: access_mode += 'b' with salt.utils.files.fopen(path, access_mod...
def read(path, binary=False): ''' .. versionadded:: 2017.7.0 Return the content of the file. CLI Example: .. code-block:: bash salt '*' file.read /path/to/file ''' access_mode = 'r' if binary is True: access_mode += 'b' with salt.utils.files.fopen(path, access_mod...
[ "..", "versionadded", "::", "2017", ".", "7", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3604-L3620
[ "def", "read", "(", "path", ",", "binary", "=", "False", ")", ":", "access_mode", "=", "'r'", "if", "binary", "is", "True", ":", "access_mode", "+=", "'b'", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "path", ",", "access_mode", ")...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
readlink
.. versionadded:: 2014.1.0 Return the path that a symlink points to If canonicalize is set to True, then it return the final target CLI Example: .. code-block:: bash salt '*' file.readlink /path/to/link
salt/modules/file.py
def readlink(path, canonicalize=False): ''' .. versionadded:: 2014.1.0 Return the path that a symlink points to If canonicalize is set to True, then it return the final target CLI Example: .. code-block:: bash salt '*' file.readlink /path/to/link ''' path = os.path.expanduser...
def readlink(path, canonicalize=False): ''' .. versionadded:: 2014.1.0 Return the path that a symlink points to If canonicalize is set to True, then it return the final target CLI Example: .. code-block:: bash salt '*' file.readlink /path/to/link ''' path = os.path.expanduser...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3623-L3647
[ "def", "readlink", "(", "path", ",", "canonicalize", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "raise", "SaltInvocationError", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
readdir
.. versionadded:: 2014.1.0 Return a list containing the contents of a directory CLI Example: .. code-block:: bash salt '*' file.readdir /path/to/dir/
salt/modules/file.py
def readdir(path): ''' .. versionadded:: 2014.1.0 Return a list containing the contents of a directory CLI Example: .. code-block:: bash salt '*' file.readdir /path/to/dir/ ''' path = os.path.expanduser(path) if not os.path.isabs(path): raise SaltInvocationError('Dir...
def readdir(path): ''' .. versionadded:: 2014.1.0 Return a list containing the contents of a directory CLI Example: .. code-block:: bash salt '*' file.readdir /path/to/dir/ ''' path = os.path.expanduser(path) if not os.path.isabs(path): raise SaltInvocationError('Dir...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3650-L3672
[ "def", "readdir", "(", "path", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "raise", "SaltInvocationError", "(", "'Dir path must be absolute.'", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
statvfs
.. versionadded:: 2014.1.0 Perform a statvfs call against the filesystem that the file resides on CLI Example: .. code-block:: bash salt '*' file.statvfs /path/to/file
salt/modules/file.py
def statvfs(path): ''' .. versionadded:: 2014.1.0 Perform a statvfs call against the filesystem that the file resides on CLI Example: .. code-block:: bash salt '*' file.statvfs /path/to/file ''' path = os.path.expanduser(path) if not os.path.isabs(path): raise SaltIn...
def statvfs(path): ''' .. versionadded:: 2014.1.0 Perform a statvfs call against the filesystem that the file resides on CLI Example: .. code-block:: bash salt '*' file.statvfs /path/to/file ''' path = os.path.expanduser(path) if not os.path.isabs(path): raise SaltIn...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3675-L3699
[ "def", "statvfs", "(", "path", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "raise", "SaltInvocationError", "(", "'File path must be absolute.'", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
stats
Return a dict containing the stats for a given file CLI Example: .. code-block:: bash salt '*' file.stats /etc/passwd
salt/modules/file.py
def stats(path, hash_type=None, follow_symlinks=True): ''' Return a dict containing the stats for a given file CLI Example: .. code-block:: bash salt '*' file.stats /etc/passwd ''' path = os.path.expanduser(path) ret = {} if not os.path.exists(path): try: ...
def stats(path, hash_type=None, follow_symlinks=True): ''' Return a dict containing the stats for a given file CLI Example: .. code-block:: bash salt '*' file.stats /etc/passwd ''' path = os.path.expanduser(path) ret = {} if not os.path.exists(path): try: ...
[ "Return", "a", "dict", "containing", "the", "stats", "for", "a", "given", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3702-L3760
[ "def", "stats", "(", "path", ",", "hash_type", "=", "None", ",", "follow_symlinks", "=", "True", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "ret", "=", "{", "}", "if", "not", "os", ".", "path", ".", "exists", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
rmdir
.. versionadded:: 2014.1.0 Remove the specified directory. Fails if a directory is not empty. CLI Example: .. code-block:: bash salt '*' file.rmdir /tmp/foo/
salt/modules/file.py
def rmdir(path): ''' .. versionadded:: 2014.1.0 Remove the specified directory. Fails if a directory is not empty. CLI Example: .. code-block:: bash salt '*' file.rmdir /tmp/foo/ ''' path = os.path.expanduser(path) if not os.path.isabs(path): raise SaltInvocationErro...
def rmdir(path): ''' .. versionadded:: 2014.1.0 Remove the specified directory. Fails if a directory is not empty. CLI Example: .. code-block:: bash salt '*' file.rmdir /tmp/foo/ ''' path = os.path.expanduser(path) if not os.path.isabs(path): raise SaltInvocationErro...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3763-L3787
[ "def", "rmdir", "(", "path", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "raise", "SaltInvocationError", "(", "'File path must be absolute.'", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
remove
Remove the named file. If a directory is supplied, it will be recursively deleted. CLI Example: .. code-block:: bash salt '*' file.remove /tmp/foo
salt/modules/file.py
def remove(path, **kwargs): ''' Remove the named file. If a directory is supplied, it will be recursively deleted. CLI Example: .. code-block:: bash salt '*' file.remove /tmp/foo ''' path = os.path.expanduser(path) if not os.path.isabs(path): raise SaltInvocationError...
def remove(path, **kwargs): ''' Remove the named file. If a directory is supplied, it will be recursively deleted. CLI Example: .. code-block:: bash salt '*' file.remove /tmp/foo ''' path = os.path.expanduser(path) if not os.path.isabs(path): raise SaltInvocationError...
[ "Remove", "the", "named", "file", ".", "If", "a", "directory", "is", "supplied", "it", "will", "be", "recursively", "deleted", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3790-L3817
[ "def", "remove", "(", "path", ",", "*", "*", "kwargs", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "raise", "SaltInvocationError", "(", "'File p...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
path_exists_glob
Tests to see if path after expansion is a valid path (file or directory). Expansion allows usage of ? * and character ranges []. Tilde expansion is not supported. Returns True/False. .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' file.path_exists_glob /etc/pam*/pas...
salt/modules/file.py
def path_exists_glob(path): ''' Tests to see if path after expansion is a valid path (file or directory). Expansion allows usage of ? * and character ranges []. Tilde expansion is not supported. Returns True/False. .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt...
def path_exists_glob(path): ''' Tests to see if path after expansion is a valid path (file or directory). Expansion allows usage of ? * and character ranges []. Tilde expansion is not supported. Returns True/False. .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt...
[ "Tests", "to", "see", "if", "path", "after", "expansion", "is", "a", "valid", "path", "(", "file", "or", "directory", ")", ".", "Expansion", "allows", "usage", "of", "?", "*", "and", "character", "ranges", "[]", ".", "Tilde", "expansion", "is", "not", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3848-L3863
[ "def", "path_exists_glob", "(", "path", ")", ":", "return", "True", "if", "glob", ".", "glob", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ")", "else", "False" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
restorecon
Reset the SELinux context on a given path CLI Example: .. code-block:: bash salt '*' file.restorecon /home/user/.ssh/authorized_keys
salt/modules/file.py
def restorecon(path, recursive=False): ''' Reset the SELinux context on a given path CLI Example: .. code-block:: bash salt '*' file.restorecon /home/user/.ssh/authorized_keys ''' if recursive: cmd = ['restorecon', '-FR', path] else: cmd = ['restorecon', '-F', pat...
def restorecon(path, recursive=False): ''' Reset the SELinux context on a given path CLI Example: .. code-block:: bash salt '*' file.restorecon /home/user/.ssh/authorized_keys ''' if recursive: cmd = ['restorecon', '-FR', path] else: cmd = ['restorecon', '-F', pat...
[ "Reset", "the", "SELinux", "context", "on", "a", "given", "path" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3866-L3880
[ "def", "restorecon", "(", "path", ",", "recursive", "=", "False", ")", ":", "if", "recursive", ":", "cmd", "=", "[", "'restorecon'", ",", "'-FR'", ",", "path", "]", "else", ":", "cmd", "=", "[", "'restorecon'", ",", "'-F'", ",", "path", "]", "return"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_selinux_context
Get an SELinux context from a given path CLI Example: .. code-block:: bash salt '*' file.get_selinux_context /etc/hosts
salt/modules/file.py
def get_selinux_context(path): ''' Get an SELinux context from a given path CLI Example: .. code-block:: bash salt '*' file.get_selinux_context /etc/hosts ''' out = __salt__['cmd.run'](['ls', '-Z', path], python_shell=False) try: ret = re.search(r'\w+:\w+:\w+:\w+', out).g...
def get_selinux_context(path): ''' Get an SELinux context from a given path CLI Example: .. code-block:: bash salt '*' file.get_selinux_context /etc/hosts ''' out = __salt__['cmd.run'](['ls', '-Z', path], python_shell=False) try: ret = re.search(r'\w+:\w+:\w+:\w+', out).g...
[ "Get", "an", "SELinux", "context", "from", "a", "given", "path" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3883-L3902
[ "def", "get_selinux_context", "(", "path", ")", ":", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "[", "'ls'", ",", "'-Z'", ",", "path", "]", ",", "python_shell", "=", "False", ")", "try", ":", "ret", "=", "re", ".", "search", "(", "r'\\w+:\\w...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_selinux_context
.. versionchanged:: Neon Added persist option Set a specific SELinux label on a given path CLI Example: .. code-block:: bash salt '*' file.set_selinux_context path <user> <role> <type> <range> salt '*' file.set_selinux_context /etc/yum.repos.d/epel.repo system_u object_r system_...
salt/modules/file.py
def set_selinux_context(path, user=None, role=None, type=None, # pylint: disable=W0622 range=None, # pylint: disable=W0622 persist=False): ''' .. versionchanged:: Neon Added pers...
def set_selinux_context(path, user=None, role=None, type=None, # pylint: disable=W0622 range=None, # pylint: disable=W0622 persist=False): ''' .. versionchanged:: Neon Added pers...
[ "..", "versionchanged", "::", "Neon" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3905-L3952
[ "def", "set_selinux_context", "(", "path", ",", "user", "=", "None", ",", "role", "=", "None", ",", "type", "=", "None", ",", "# pylint: disable=W0622", "range", "=", "None", ",", "# pylint: disable=W0622", "persist", "=", "False", ")", ":", "if", "not", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
source_list
Check the source list and return the source to use CLI Example: .. code-block:: bash salt '*' file.source_list salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' base
salt/modules/file.py
def source_list(source, source_hash, saltenv): ''' Check the source list and return the source to use CLI Example: .. code-block:: bash salt '*' file.source_list salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' base ''' contextkey = '{0}_|-{1}_|-{2}'.format(source, source...
def source_list(source, source_hash, saltenv): ''' Check the source list and return the source to use CLI Example: .. code-block:: bash salt '*' file.source_list salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' base ''' contextkey = '{0}_|-{1}_|-{2}'.format(source, source...
[ "Check", "the", "source", "list", "and", "return", "the", "source", "to", "use" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3955-L4062
[ "def", "source_list", "(", "source", ",", "source_hash", ",", "saltenv", ")", ":", "contextkey", "=", "'{0}_|-{1}_|-{2}'", ".", "format", "(", "source", ",", "source_hash", ",", "saltenv", ")", "if", "contextkey", "in", "__context__", ":", "return", "__context...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
apply_template_on_contents
Return the contents after applying the templating engine contents template string template template format context Overrides default context variables passed to the template. defaults Default context passed to the template. CLI Example: .. code-block:: bash ...
salt/modules/file.py
def apply_template_on_contents( contents, template, context, defaults, saltenv): ''' Return the contents after applying the templating engine contents template string template template format context Overrides default context variabl...
def apply_template_on_contents( contents, template, context, defaults, saltenv): ''' Return the contents after applying the templating engine contents template string template template format context Overrides default context variabl...
[ "Return", "the", "contents", "after", "applying", "the", "templating", "engine" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L4065-L4122
[ "def", "apply_template_on_contents", "(", "contents", ",", "template", ",", "context", ",", "defaults", ",", "saltenv", ")", ":", "if", "template", "in", "salt", ".", "utils", ".", "templates", ".", "TEMPLATE_REGISTRY", ":", "context_dict", "=", "defaults", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_managed
Return the managed file data for file.managed name location where the file lives on the server template template format source managed source file source_hash hash of the source file source_hash_name When ``source_hash`` refers to a remote file, this spec...
salt/modules/file.py
def get_managed( name, template, source, source_hash, source_hash_name, user, group, mode, attrs, saltenv, context, defaults, skip_verify=False, **kwargs): ''' Return the managed file data for file.ma...
def get_managed( name, template, source, source_hash, source_hash_name, user, group, mode, attrs, saltenv, context, defaults, skip_verify=False, **kwargs): ''' Return the managed file data for file.ma...
[ "Return", "the", "managed", "file", "data", "for", "file", ".", "managed" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L4125-L4333
[ "def", "get_managed", "(", "name", ",", "template", ",", "source", ",", "source_hash", ",", "source_hash_name", ",", "user", ",", "group", ",", "mode", ",", "attrs", ",", "saltenv", ",", "context", ",", "defaults", ",", "skip_verify", "=", "False", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
extract_hash
.. versionchanged:: 2016.3.5 Prior to this version, only the ``file_name`` argument was considered for filename matches in the hash file. This would be problematic for cases in which the user was relying on a remote checksum file that they do not control, and they wished to use a differe...
salt/modules/file.py
def extract_hash(hash_fn, hash_type='sha256', file_name='', source='', source_hash_name=None): ''' .. versionchanged:: 2016.3.5 Prior to this version, only the ``file_name`` argument was considered for filename matches in the ha...
def extract_hash(hash_fn, hash_type='sha256', file_name='', source='', source_hash_name=None): ''' .. versionchanged:: 2016.3.5 Prior to this version, only the ``file_name`` argument was considered for filename matches in the ha...
[ "..", "versionchanged", "::", "2016", ".", "3", ".", "5", "Prior", "to", "this", "version", "only", "the", "file_name", "argument", "was", "considered", "for", "filename", "matches", "in", "the", "hash", "file", ".", "This", "would", "be", "problematic", "...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L4336-L4563
[ "def", "extract_hash", "(", "hash_fn", ",", "hash_type", "=", "'sha256'", ",", "file_name", "=", "''", ",", "source", "=", "''", ",", "source_hash_name", "=", "None", ")", ":", "hash_len", "=", "HASHES", ".", "get", "(", "hash_type", ")", "if", "hash_len...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
check_perms
.. versionchanged:: Neon Added selinux options Check the permissions on files, modify attributes and chown if needed. File attributes are only verified if lsattr(1) is installed. CLI Example: .. code-block:: bash salt '*' file.check_perms /etc/sudoers '{}' root root 400 ai .. v...
salt/modules/file.py
def check_perms(name, ret, user, group, mode, attrs=None, follow_symlinks=False, seuser=None, serole=None, setype=None, serange=None): ''' .. versionchanged:: Neon Added selinux options Check the permissions on files, modify attributes and chown if needed. File attributes are o...
def check_perms(name, ret, user, group, mode, attrs=None, follow_symlinks=False, seuser=None, serole=None, setype=None, serange=None): ''' .. versionchanged:: Neon Added selinux options Check the permissions on files, modify attributes and chown if needed. File attributes are o...
[ "..", "versionchanged", "::", "Neon" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L4566-L4857
[ "def", "check_perms", "(", "name", ",", "ret", ",", "user", ",", "group", ",", "mode", ",", "attrs", "=", "None", ",", "follow_symlinks", "=", "False", ",", "seuser", "=", "None", ",", "serole", "=", "None", ",", "setype", "=", "None", ",", "serange"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
check_managed
Check to see what changes need to be made for a file CLI Example: .. code-block:: bash salt '*' file.check_managed /etc/httpd/conf.d/httpd.conf salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' root, root, '755' jinja True None None base
salt/modules/file.py
def check_managed( name, source, source_hash, source_hash_name, user, group, mode, attrs, template, context, defaults, saltenv, contents=None, skip_verify=False, seuser=None, serole=None, ...
def check_managed( name, source, source_hash, source_hash_name, user, group, mode, attrs, template, context, defaults, saltenv, contents=None, skip_verify=False, seuser=None, serole=None, ...
[ "Check", "to", "see", "what", "changes", "need", "to", "be", "made", "for", "a", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L4860-L4933
[ "def", "check_managed", "(", "name", ",", "source", ",", "source_hash", ",", "source_hash_name", ",", "user", ",", "group", ",", "mode", ",", "attrs", ",", "template", ",", "context", ",", "defaults", ",", "saltenv", ",", "contents", "=", "None", ",", "s...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
check_managed_changes
Return a dictionary of what changes need to be made for a file .. versionchanged:: Neon selinux attributes added CLI Example: .. code-block:: bash salt '*' file.check_managed_changes /etc/httpd/conf.d/httpd.conf salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' root, root, '...
salt/modules/file.py
def check_managed_changes( name, source, source_hash, source_hash_name, user, group, mode, attrs, template, context, defaults, saltenv, contents=None, skip_verify=False, keep_mode=False, seuse...
def check_managed_changes( name, source, source_hash, source_hash_name, user, group, mode, attrs, template, context, defaults, saltenv, contents=None, skip_verify=False, keep_mode=False, seuse...
[ "Return", "a", "dictionary", "of", "what", "changes", "need", "to", "be", "made", "for", "a", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L4936-L5014
[ "def", "check_managed_changes", "(", "name", ",", "source", ",", "source_hash", ",", "source_hash_name", ",", "user", ",", "group", ",", "mode", ",", "attrs", ",", "template", ",", "context", ",", "defaults", ",", "saltenv", ",", "contents", "=", "None", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
check_file_meta
Check for the changes in the file metadata. CLI Example: .. code-block:: bash salt '*' file.check_file_meta /etc/httpd/conf.d/httpd.conf salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' root, root, '755' base .. note:: Supported hash types include sha512, sha384, sha256, sh...
salt/modules/file.py
def check_file_meta( name, sfn, source, source_sum, user, group, mode, attrs, saltenv, contents=None, seuser=None, serole=None, setype=None, serange=None): ''' Check for the changes in the file metada...
def check_file_meta( name, sfn, source, source_sum, user, group, mode, attrs, saltenv, contents=None, seuser=None, serole=None, setype=None, serange=None): ''' Check for the changes in the file metada...
[ "Check", "for", "the", "changes", "in", "the", "file", "metadata", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L5017-L5202
[ "def", "check_file_meta", "(", "name", ",", "sfn", ",", "source", ",", "source_sum", ",", "user", ",", "group", ",", "mode", ",", "attrs", ",", "saltenv", ",", "contents", "=", "None", ",", "seuser", "=", "None", ",", "serole", "=", "None", ",", "set...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_diff
Return unified diff of two files file1 The first file to feed into the diff utility .. versionchanged:: 2018.3.0 Can now be either a local or remote file. In earlier releases, thuis had to be a file local to the minion. file2 The second file to feed into the di...
salt/modules/file.py
def get_diff(file1, file2, saltenv='base', show_filenames=True, show_changes=True, template=False, source_hash_file1=None, source_hash_file2=None): ''' Return unified diff of two files file1 The first file to...
def get_diff(file1, file2, saltenv='base', show_filenames=True, show_changes=True, template=False, source_hash_file1=None, source_hash_file2=None): ''' Return unified diff of two files file1 The first file to...
[ "Return", "unified", "diff", "of", "two", "files" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L5205-L5327
[ "def", "get_diff", "(", "file1", ",", "file2", ",", "saltenv", "=", "'base'", ",", "show_filenames", "=", "True", ",", "show_changes", "=", "True", ",", "template", "=", "False", ",", "source_hash_file1", "=", "None", ",", "source_hash_file2", "=", "None", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
manage_file
Checks the destination against what was retrieved with get_managed and makes the appropriate modifications (if necessary). name location to place the file sfn location of cached file on the minion This is the path to the file stored on the minion. This file is placed on th...
salt/modules/file.py
def manage_file(name, sfn, ret, source, source_sum, user, group, mode, attrs, saltenv, backup, makedirs=False, template=None, ...
def manage_file(name, sfn, ret, source, source_sum, user, group, mode, attrs, saltenv, backup, makedirs=False, template=None, ...
[ "Checks", "the", "destination", "against", "what", "was", "retrieved", "with", "get_managed", "and", "makes", "the", "appropriate", "modifications", "(", "if", "necessary", ")", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L5330-L5847
[ "def", "manage_file", "(", "name", ",", "sfn", ",", "ret", ",", "source", ",", "source_sum", ",", "user", ",", "group", ",", "mode", ",", "attrs", ",", "saltenv", ",", "backup", ",", "makedirs", "=", "False", ",", "template", "=", "None", ",", "# pyl...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mkdir
Ensure that a directory is available. CLI Example: .. code-block:: bash salt '*' file.mkdir /opt/jetty/context
salt/modules/file.py
def mkdir(dir_path, user=None, group=None, mode=None): ''' Ensure that a directory is available. CLI Example: .. code-block:: bash salt '*' file.mkdir /opt/jetty/context ''' dir_path = os.path.expanduser(dir_path) directory = os.path.normpath(dir_pat...
def mkdir(dir_path, user=None, group=None, mode=None): ''' Ensure that a directory is available. CLI Example: .. code-block:: bash salt '*' file.mkdir /opt/jetty/context ''' dir_path = os.path.expanduser(dir_path) directory = os.path.normpath(dir_pat...
[ "Ensure", "that", "a", "directory", "is", "available", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L5850-L5873
[ "def", "mkdir", "(", "dir_path", ",", "user", "=", "None", ",", "group", "=", "None", ",", "mode", "=", "None", ")", ":", "dir_path", "=", "os", ".", "path", ".", "expanduser", "(", "dir_path", ")", "directory", "=", "os", ".", "path", ".", "normpa...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
makedirs_
Ensure that the directory containing this path is available. .. note:: The path must end with a trailing slash otherwise the directory/directories will be created up to the parent directory. For example if path is ``/opt/code``, then it would be treated as ``/opt/`` but if the path ...
salt/modules/file.py
def makedirs_(path, user=None, group=None, mode=None): ''' Ensure that the directory containing this path is available. .. note:: The path must end with a trailing slash otherwise the directory/directories will be created up to the parent directory...
def makedirs_(path, user=None, group=None, mode=None): ''' Ensure that the directory containing this path is available. .. note:: The path must end with a trailing slash otherwise the directory/directories will be created up to the parent directory...
[ "Ensure", "that", "the", "directory", "containing", "this", "path", "is", "available", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L5876-L5939
[ "def", "makedirs_", "(", "path", ",", "user", "=", "None", ",", "group", "=", "None", ",", "mode", "=", "None", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "mode", ":", "mode", "=", "salt", ".", "utils", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
makedirs_perms
Taken and modified from os.makedirs to set user, group and mode for each directory created. CLI Example: .. code-block:: bash salt '*' file.makedirs_perms /opt/code
salt/modules/file.py
def makedirs_perms(name, user=None, group=None, mode='0755'): ''' Taken and modified from os.makedirs to set user, group and mode for each directory created. CLI Example: .. code-block:: bash salt '*' file.makedirs_perms /opt/code ...
def makedirs_perms(name, user=None, group=None, mode='0755'): ''' Taken and modified from os.makedirs to set user, group and mode for each directory created. CLI Example: .. code-block:: bash salt '*' file.makedirs_perms /opt/code ...
[ "Taken", "and", "modified", "from", "os", ".", "makedirs", "to", "set", "user", "group", "and", "mode", "for", "each", "directory", "created", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L5942-L5976
[ "def", "makedirs_perms", "(", "name", ",", "user", "=", "None", ",", "group", "=", "None", ",", "mode", "=", "'0755'", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "path", "=", "os", ".", "path", "head", ",", "ta...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_devmm
Get major/minor info from a device CLI Example: .. code-block:: bash salt '*' file.get_devmm /dev/chr
salt/modules/file.py
def get_devmm(name): ''' Get major/minor info from a device CLI Example: .. code-block:: bash salt '*' file.get_devmm /dev/chr ''' name = os.path.expanduser(name) if is_chrdev(name) or is_blkdev(name): stat_structure = os.stat(name) return ( os.majo...
def get_devmm(name): ''' Get major/minor info from a device CLI Example: .. code-block:: bash salt '*' file.get_devmm /dev/chr ''' name = os.path.expanduser(name) if is_chrdev(name) or is_blkdev(name): stat_structure = os.stat(name) return ( os.majo...
[ "Get", "major", "/", "minor", "info", "from", "a", "device" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L5979-L5997
[ "def", "get_devmm", "(", "name", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "if", "is_chrdev", "(", "name", ")", "or", "is_blkdev", "(", "name", ")", ":", "stat_structure", "=", "os", ".", "stat", "(", "name", ")...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
is_chrdev
Check if a file exists and is a character device. CLI Example: .. code-block:: bash salt '*' file.is_chrdev /dev/chr
salt/modules/file.py
def is_chrdev(name): ''' Check if a file exists and is a character device. CLI Example: .. code-block:: bash salt '*' file.is_chrdev /dev/chr ''' name = os.path.expanduser(name) stat_structure = None try: stat_structure = os.stat(name) except OSError as exc: ...
def is_chrdev(name): ''' Check if a file exists and is a character device. CLI Example: .. code-block:: bash salt '*' file.is_chrdev /dev/chr ''' name = os.path.expanduser(name) stat_structure = None try: stat_structure = os.stat(name) except OSError as exc: ...
[ "Check", "if", "a", "file", "exists", "and", "is", "a", "character", "device", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6000-L6021
[ "def", "is_chrdev", "(", "name", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "stat_structure", "=", "None", "try", ":", "stat_structure", "=", "os", ".", "stat", "(", "name", ")", "except", "OSError", "as", "exc", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mknod_chrdev
.. versionadded:: 0.17.0 Create a character device. CLI Example: .. code-block:: bash salt '*' file.mknod_chrdev /dev/chr 180 31
salt/modules/file.py
def mknod_chrdev(name, major, minor, user=None, group=None, mode='0660'): ''' .. versionadded:: 0.17.0 Create a character device. CLI Example: .. code-block:: bash salt '*' file.mknod_chrdev /dev/chr 180 ...
def mknod_chrdev(name, major, minor, user=None, group=None, mode='0660'): ''' .. versionadded:: 0.17.0 Create a character device. CLI Example: .. code-block:: bash salt '*' file.mknod_chrdev /dev/chr 180 ...
[ "..", "versionadded", "::", "0", ".", "17", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6024-L6072
[ "def", "mknod_chrdev", "(", "name", ",", "major", ",", "minor", ",", "user", "=", "None", ",", "group", "=", "None", ",", "mode", "=", "'0660'", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "ret", "=", "{", "'nam...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
is_blkdev
Check if a file exists and is a block device. CLI Example: .. code-block:: bash salt '*' file.is_blkdev /dev/blk
salt/modules/file.py
def is_blkdev(name): ''' Check if a file exists and is a block device. CLI Example: .. code-block:: bash salt '*' file.is_blkdev /dev/blk ''' name = os.path.expanduser(name) stat_structure = None try: stat_structure = os.stat(name) except OSError as exc: if...
def is_blkdev(name): ''' Check if a file exists and is a block device. CLI Example: .. code-block:: bash salt '*' file.is_blkdev /dev/blk ''' name = os.path.expanduser(name) stat_structure = None try: stat_structure = os.stat(name) except OSError as exc: if...
[ "Check", "if", "a", "file", "exists", "and", "is", "a", "block", "device", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6075-L6096
[ "def", "is_blkdev", "(", "name", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "stat_structure", "=", "None", "try", ":", "stat_structure", "=", "os", ".", "stat", "(", "name", ")", "except", "OSError", "as", "exc", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
is_fifo
Check if a file exists and is a FIFO. CLI Example: .. code-block:: bash salt '*' file.is_fifo /dev/fifo
salt/modules/file.py
def is_fifo(name): ''' Check if a file exists and is a FIFO. CLI Example: .. code-block:: bash salt '*' file.is_fifo /dev/fifo ''' name = os.path.expanduser(name) stat_structure = None try: stat_structure = os.stat(name) except OSError as exc: if exc.errno ...
def is_fifo(name): ''' Check if a file exists and is a FIFO. CLI Example: .. code-block:: bash salt '*' file.is_fifo /dev/fifo ''' name = os.path.expanduser(name) stat_structure = None try: stat_structure = os.stat(name) except OSError as exc: if exc.errno ...
[ "Check", "if", "a", "file", "exists", "and", "is", "a", "FIFO", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6150-L6171
[ "def", "is_fifo", "(", "name", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "stat_structure", "=", "None", "try", ":", "stat_structure", "=", "os", ".", "stat", "(", "name", ")", "except", "OSError", "as", "exc", ":"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mknod_fifo
.. versionadded:: 0.17.0 Create a FIFO pipe. CLI Example: .. code-block:: bash salt '*' file.mknod_fifo /dev/fifo
salt/modules/file.py
def mknod_fifo(name, user=None, group=None, mode='0660'): ''' .. versionadded:: 0.17.0 Create a FIFO pipe. CLI Example: .. code-block:: bash salt '*' file.mknod_fifo /dev/fifo ''' name = os.path.expanduser(name) ret = {'name': name...
def mknod_fifo(name, user=None, group=None, mode='0660'): ''' .. versionadded:: 0.17.0 Create a FIFO pipe. CLI Example: .. code-block:: bash salt '*' file.mknod_fifo /dev/fifo ''' name = os.path.expanduser(name) ret = {'name': name...
[ "..", "versionadded", "::", "0", ".", "17", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6174-L6216
[ "def", "mknod_fifo", "(", "name", ",", "user", "=", "None", ",", "group", "=", "None", ",", "mode", "=", "'0660'", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "ret", "=", "{", "'name'", ":", "name", ",", "'chang...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mknod
.. versionadded:: 0.17.0 Create a block device, character device, or fifo pipe. Identical to the gnu mknod. CLI Examples: .. code-block:: bash salt '*' file.mknod /dev/chr c 180 31 salt '*' file.mknod /dev/blk b 8 999 salt '*' file.nknod /dev/fifo p
salt/modules/file.py
def mknod(name, ntype, major=0, minor=0, user=None, group=None, mode='0600'): ''' .. versionadded:: 0.17.0 Create a block device, character device, or fifo pipe. Identical to the gnu mknod. CLI Examples: .. code-block:: bash ...
def mknod(name, ntype, major=0, minor=0, user=None, group=None, mode='0600'): ''' .. versionadded:: 0.17.0 Create a block device, character device, or fifo pipe. Identical to the gnu mknod. CLI Examples: .. code-block:: bash ...
[ "..", "versionadded", "::", "0", ".", "17", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6219-L6253
[ "def", "mknod", "(", "name", ",", "ntype", ",", "major", "=", "0", ",", "minor", "=", "0", ",", "user", "=", "None", ",", "group", "=", "None", ",", "mode", "=", "'0600'", ")", ":", "ret", "=", "False", "makedirs_", "(", "name", ",", "user", ",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_backups
.. versionadded:: 0.17.0 Lists the previous versions of a file backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The path on the minion to check for backups limit Limit the number of results to the most recent N backups CLI Example: .. code-blo...
salt/modules/file.py
def list_backups(path, limit=None): ''' .. versionadded:: 0.17.0 Lists the previous versions of a file backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The path on the minion to check for backups limit Limit the number of results to the most rec...
def list_backups(path, limit=None): ''' .. versionadded:: 0.17.0 Lists the previous versions of a file backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The path on the minion to check for backups limit Limit the number of results to the most rec...
[ "..", "versionadded", "::", "0", ".", "17", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6256-L6324
[ "def", "list_backups", "(", "path", ",", "limit", "=", "None", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "try", ":", "limit", "=", "int", "(", "limit", ")", "except", "TypeError", ":", "pass", "except", "ValueErro...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_backups_dir
Lists the previous versions of a directory backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The directory on the minion to check for backups limit Limit the number of results to the most recent N backups CLI Example: .. code-block:: bash s...
salt/modules/file.py
def list_backups_dir(path, limit=None): ''' Lists the previous versions of a directory backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The directory on the minion to check for backups limit Limit the number of results to the most recent N backups ...
def list_backups_dir(path, limit=None): ''' Lists the previous versions of a directory backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The directory on the minion to check for backups limit Limit the number of results to the most recent N backups ...
[ "Lists", "the", "previous", "versions", "of", "a", "directory", "backed", "up", "using", "Salt", "s", ":", "ref", ":", "file", "state", "backup", "<file", "-", "state", "-", "backups", ">", "system", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6330-L6388
[ "def", "list_backups_dir", "(", "path", ",", "limit", "=", "None", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "try", ":", "limit", "=", "int", "(", "limit", ")", "except", "TypeError", ":", "pass", "except", "Value...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
restore_backup
.. versionadded:: 0.17.0 Restore a previous version of a file that was backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The path on the minion to check for backups backup_id The numeric id for the backup you wish to restore, as found using :mod:...
salt/modules/file.py
def restore_backup(path, backup_id): ''' .. versionadded:: 0.17.0 Restore a previous version of a file that was backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The path on the minion to check for backups backup_id The numeric id for the backup ...
def restore_backup(path, backup_id): ''' .. versionadded:: 0.17.0 Restore a previous version of a file that was backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The path on the minion to check for backups backup_id The numeric id for the backup ...
[ "..", "versionadded", "::", "0", ".", "17", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6391-L6450
[ "def", "restore_backup", "(", "path", ",", "backup_id", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "# Note: This only supports minion backups, so this function will need to be", "# modified if/when master backups are implemented.", "ret", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete_backup
.. versionadded:: 0.17.0 Delete a previous version of a file that was backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The path on the minion to check for backups backup_id The numeric id for the backup you wish to delete, as found using :mod:`f...
salt/modules/file.py
def delete_backup(path, backup_id): ''' .. versionadded:: 0.17.0 Delete a previous version of a file that was backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The path on the minion to check for backups backup_id The numeric id for the backup yo...
def delete_backup(path, backup_id): ''' .. versionadded:: 0.17.0 Delete a previous version of a file that was backed up using Salt's :ref:`file state backup <file-state-backups>` system. path The path on the minion to check for backups backup_id The numeric id for the backup yo...
[ "..", "versionadded", "::", "0", ".", "17", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6453-L6497
[ "def", "delete_backup", "(", "path", ",", "backup_id", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "ret", "=", "{", "'result'", ":", "False", ",", "'comment'", ":", "'Invalid backup_id \\'{0}\\''", ".", "format", "(", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
grep
Grep for a string in the specified file .. note:: This function's return value is slated for refinement in future versions of Salt path Path to the file to be searched .. note:: Globbing is supported (i.e. ``/var/log/foo/*.log``, but if globbing is bein...
salt/modules/file.py
def grep(path, pattern, *opts): ''' Grep for a string in the specified file .. note:: This function's return value is slated for refinement in future versions of Salt path Path to the file to be searched .. note:: Globbing is supported (i....
def grep(path, pattern, *opts): ''' Grep for a string in the specified file .. note:: This function's return value is slated for refinement in future versions of Salt path Path to the file to be searched .. note:: Globbing is supported (i....
[ "Grep", "for", "a", "string", "in", "the", "specified", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6503-L6577
[ "def", "grep", "(", "path", ",", "pattern", ",", "*", "opts", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "# Backup the path in case the glob returns nothing", "_path", "=", "path", "path", "=", "glob", ".", "glob", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
open_files
Return a list of all physical open files on the system. CLI Examples: .. code-block:: bash salt '*' file.open_files salt '*' file.open_files by_pid=True
salt/modules/file.py
def open_files(by_pid=False): ''' Return a list of all physical open files on the system. CLI Examples: .. code-block:: bash salt '*' file.open_files salt '*' file.open_files by_pid=True ''' # First we collect valid PIDs pids = {} procfs = os.listdir('/proc/') for ...
def open_files(by_pid=False): ''' Return a list of all physical open files on the system. CLI Examples: .. code-block:: bash salt '*' file.open_files salt '*' file.open_files by_pid=True ''' # First we collect valid PIDs pids = {} procfs = os.listdir('/proc/') for ...
[ "Return", "a", "list", "of", "all", "physical", "open", "files", "on", "the", "system", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6580-L6657
[ "def", "open_files", "(", "by_pid", "=", "False", ")", ":", "# First we collect valid PIDs", "pids", "=", "{", "}", "procfs", "=", "os", ".", "listdir", "(", "'/proc/'", ")", "for", "pfile", "in", "procfs", ":", "try", ":", "pids", "[", "int", "(", "pf...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
move
Move a file or directory CLI Example: .. code-block:: bash salt '*' file.move /path/to/src /path/to/dst
salt/modules/file.py
def move(src, dst): ''' Move a file or directory CLI Example: .. code-block:: bash salt '*' file.move /path/to/src /path/to/dst ''' src = os.path.expanduser(src) dst = os.path.expanduser(dst) if not os.path.isabs(src): raise SaltInvocationError('Source path must be ab...
def move(src, dst): ''' Move a file or directory CLI Example: .. code-block:: bash salt '*' file.move /path/to/src /path/to/dst ''' src = os.path.expanduser(src) dst = os.path.expanduser(dst) if not os.path.isabs(src): raise SaltInvocationError('Source path must be ab...
[ "Move", "a", "file", "or", "directory" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6773-L6804
[ "def", "move", "(", "src", ",", "dst", ")", ":", "src", "=", "os", ".", "path", ".", "expanduser", "(", "src", ")", "dst", "=", "os", ".", "path", ".", "expanduser", "(", "dst", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "src", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
diskusage
Recursively calculate disk usage of path and return it in bytes CLI Example: .. code-block:: bash salt '*' file.diskusage /path/to/check
salt/modules/file.py
def diskusage(path): ''' Recursively calculate disk usage of path and return it in bytes CLI Example: .. code-block:: bash salt '*' file.diskusage /path/to/check ''' total_size = 0 seen = set() if os.path.isfile(path): stat_structure = os.stat(path) ret = ...
def diskusage(path): ''' Recursively calculate disk usage of path and return it in bytes CLI Example: .. code-block:: bash salt '*' file.diskusage /path/to/check ''' total_size = 0 seen = set() if os.path.isfile(path): stat_structure = os.stat(path) ret = ...
[ "Recursively", "calculate", "disk", "usage", "of", "path", "and", "return", "it", "in", "bytes" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L6807-L6843
[ "def", "diskusage", "(", "path", ")", ":", "total_size", "=", "0", "seen", "=", "set", "(", ")", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "stat_structure", "=", "os", ".", "stat", "(", "path", ")", "ret", "=", "stat_structure"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_
Set a key/value pair in sqlite3
salt/sdb/sqlite3.py
def set_(key, value, profile=None): ''' Set a key/value pair in sqlite3 ''' if not profile: return False conn, cur, table = _connect(profile) if six.PY2: value = buffer(salt.utils.msgpack.packb(value)) else: value = memoryview(salt.utils.msgpack.packb(value)) q = ...
def set_(key, value, profile=None): ''' Set a key/value pair in sqlite3 ''' if not profile: return False conn, cur, table = _connect(profile) if six.PY2: value = buffer(salt.utils.msgpack.packb(value)) else: value = memoryview(salt.utils.msgpack.packb(value)) q = ...
[ "Set", "a", "key", "/", "value", "pair", "in", "sqlite3" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/sqlite3.py#L119-L134
[ "def", "set_", "(", "key", ",", "value", ",", "profile", "=", "None", ")", ":", "if", "not", "profile", ":", "return", "False", "conn", ",", "cur", ",", "table", "=", "_connect", "(", "profile", ")", "if", "six", ".", "PY2", ":", "value", "=", "b...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get
Get a value from sqlite3
salt/sdb/sqlite3.py
def get(key, profile=None): ''' Get a value from sqlite3 ''' if not profile: return None _, cur, table = _connect(profile) q = profile.get('get_query', ('SELECT value FROM {0} WHERE ' 'key=:key'.format(table))) res = cur.execute(q, {'key': key}) ...
def get(key, profile=None): ''' Get a value from sqlite3 ''' if not profile: return None _, cur, table = _connect(profile) q = profile.get('get_query', ('SELECT value FROM {0} WHERE ' 'key=:key'.format(table))) res = cur.execute(q, {'key': key}) ...
[ "Get", "a", "value", "from", "sqlite3" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/sqlite3.py#L137-L150
[ "def", "get", "(", "key", ",", "profile", "=", "None", ")", ":", "if", "not", "profile", ":", "return", "None", "_", ",", "cur", ",", "table", "=", "_connect", "(", "profile", ")", "q", "=", "profile", ".", "get", "(", "'get_query'", ",", "(", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Delete a key/value pair from sqlite3
salt/sdb/sqlite3.py
def delete(key, profile=None): ''' Delete a key/value pair from sqlite3 ''' if not profile: return None conn, cur, table = _connect(profile) q = profile.get('delete_query', ('DELETE FROM {0} WHERE ' 'key=:key'.format(table))) res = cur.execute(q, ...
def delete(key, profile=None): ''' Delete a key/value pair from sqlite3 ''' if not profile: return None conn, cur, table = _connect(profile) q = profile.get('delete_query', ('DELETE FROM {0} WHERE ' 'key=:key'.format(table))) res = cur.execute(q, ...
[ "Delete", "a", "key", "/", "value", "pair", "from", "sqlite3" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/sdb/sqlite3.py#L153-L164
[ "def", "delete", "(", "key", ",", "profile", "=", "None", ")", ":", "if", "not", "profile", ":", "return", "None", "conn", ",", "cur", ",", "table", "=", "_connect", "(", "profile", ")", "q", "=", "profile", ".", "get", "(", "'delete_query'", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
show
Displays all details for a certain route learned via a specific protocol. If the protocol is not specified, will return all possible routes. .. note:: This function return the routes from the RIB. In case the destination prefix is too short, there may be too many routes matched. ...
salt/modules/napalm_route.py
def show(destination, protocol=None, **kwargs): # pylint: disable=unused-argument ''' Displays all details for a certain route learned via a specific protocol. If the protocol is not specified, will return all possible routes. .. note:: This function return the routes from the RIB. I...
def show(destination, protocol=None, **kwargs): # pylint: disable=unused-argument ''' Displays all details for a certain route learned via a specific protocol. If the protocol is not specified, will return all possible routes. .. note:: This function return the routes from the RIB. I...
[ "Displays", "all", "details", "for", "a", "certain", "route", "learned", "via", "a", "specific", "protocol", ".", "If", "the", "protocol", "is", "not", "specified", "will", "return", "all", "possible", "routes", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_route.py#L59-L158
[ "def", "show", "(", "destination", ",", "protocol", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "return", "salt", ".", "utils", ".", "napalm", ".", "call", "(", "napalm_device", ",", "# pylint: disable=undefined-variable", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
.. versionchanged:: 2018.3.0 Support added for network configuration options other than ``driver`` and ``driver_opts``, as well as IPAM configuration. Ensure that a network is present .. note:: This state supports all arguments for network and IPAM pool configuration which are ...
salt/states/docker_network.py
def present(name, skip_translate=None, ignore_collisions=False, validate_ip_addrs=True, containers=None, reconnect=True, **kwargs): ''' .. versionchanged:: 2018.3.0 Support added for network configuration options other than ``driver...
def present(name, skip_translate=None, ignore_collisions=False, validate_ip_addrs=True, containers=None, reconnect=True, **kwargs): ''' .. versionchanged:: 2018.3.0 Support added for network configuration options other than ``driver...
[ "..", "versionchanged", "::", "2018", ".", "3", ".", "0", "Support", "added", "for", "network", "configuration", "options", "other", "than", "driver", "and", "driver_opts", "as", "well", "as", "IPAM", "configuration", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_network.py#L95-L890
[ "def", "present", "(", "name", ",", "skip_translate", "=", "None", ",", "ignore_collisions", "=", "False", ",", "validate_ip_addrs", "=", "True", ",", "containers", "=", "None", ",", "reconnect", "=", "True", ",", "*", "*", "kwargs", ")", ":", "ret", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure that a network is absent. name Name of the network Usage Example: .. code-block:: yaml network_foo: docker_network.absent
salt/states/docker_network.py
def absent(name): ''' Ensure that a network is absent. name Name of the network Usage Example: .. code-block:: yaml network_foo: docker_network.absent ''' ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} t...
def absent(name): ''' Ensure that a network is absent. name Name of the network Usage Example: .. code-block:: yaml network_foo: docker_network.absent ''' ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} t...
[ "Ensure", "that", "a", "network", "is", "absent", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_network.py#L893-L933
[ "def", "absent", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", "}", "try", ":", "network", "=", "__salt__", "[", "'docker.inspect_network'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_remove_network
Remove network, including all connected containers
salt/states/docker_network.py
def _remove_network(network): ''' Remove network, including all connected containers ''' ret = {'name': network['Name'], 'changes': {}, 'result': False, 'comment': ''} errors = [] for cid in network['Containers']: try: cinfo = __salt__['docke...
def _remove_network(network): ''' Remove network, including all connected containers ''' ret = {'name': network['Name'], 'changes': {}, 'result': False, 'comment': ''} errors = [] for cid in network['Containers']: try: cinfo = __salt__['docke...
[ "Remove", "network", "including", "all", "connected", "containers" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/docker_network.py#L936-L978
[ "def", "_remove_network", "(", "network", ")", ":", "ret", "=", "{", "'name'", ":", "network", "[", "'Name'", "]", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", "}", "errors", "=", "[", "]", "for", "ci...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
AESReqServerMixin.pre_fork
Pre-fork we need to create the zmq router device
salt/transport/mixins/auth.py
def pre_fork(self, _): ''' Pre-fork we need to create the zmq router device ''' if 'aes' not in salt.master.SMaster.secrets: # TODO: This is still needed only for the unit tests # 'tcp_test.py' and 'zeromq_test.py'. Fix that. In normal # cases, 'aes' i...
def pre_fork(self, _): ''' Pre-fork we need to create the zmq router device ''' if 'aes' not in salt.master.SMaster.secrets: # TODO: This is still needed only for the unit tests # 'tcp_test.py' and 'zeromq_test.py'. Fix that. In normal # cases, 'aes' i...
[ "Pre", "-", "fork", "we", "need", "to", "create", "the", "zmq", "router", "device" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/mixins/auth.py#L75-L89
[ "def", "pre_fork", "(", "self", ",", "_", ")", ":", "if", "'aes'", "not", "in", "salt", ".", "master", ".", "SMaster", ".", "secrets", ":", "# TODO: This is still needed only for the unit tests", "# 'tcp_test.py' and 'zeromq_test.py'. Fix that. In normal", "# cases, 'aes'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
AESReqServerMixin._encrypt_private
The server equivalent of ReqChannel.crypted_transfer_decode_dictentry
salt/transport/mixins/auth.py
def _encrypt_private(self, ret, dictkey, target): ''' The server equivalent of ReqChannel.crypted_transfer_decode_dictentry ''' # encrypt with a specific AES key pubfn = os.path.join(self.opts['pki_dir'], 'minions', target...
def _encrypt_private(self, ret, dictkey, target): ''' The server equivalent of ReqChannel.crypted_transfer_decode_dictentry ''' # encrypt with a specific AES key pubfn = os.path.join(self.opts['pki_dir'], 'minions', target...
[ "The", "server", "equivalent", "of", "ReqChannel", ".", "crypted_transfer_decode_dictentry" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/mixins/auth.py#L110-L141
[ "def", "_encrypt_private", "(", "self", ",", "ret", ",", "dictkey", ",", "target", ")", ":", "# encrypt with a specific AES key", "pubfn", "=", "os", ".", "path", ".", "join", "(", "self", ".", "opts", "[", "'pki_dir'", "]", ",", "'minions'", ",", "target"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
AESReqServerMixin._update_aes
Check to see if a fresh AES key is available and update the components of the worker
salt/transport/mixins/auth.py
def _update_aes(self): ''' Check to see if a fresh AES key is available and update the components of the worker ''' if salt.master.SMaster.secrets['aes']['secret'].value != self.crypticle.key_string: self.crypticle = salt.crypt.Crypticle(self.opts, salt.master.SMaster...
def _update_aes(self): ''' Check to see if a fresh AES key is available and update the components of the worker ''' if salt.master.SMaster.secrets['aes']['secret'].value != self.crypticle.key_string: self.crypticle = salt.crypt.Crypticle(self.opts, salt.master.SMaster...
[ "Check", "to", "see", "if", "a", "fresh", "AES", "key", "is", "available", "and", "update", "the", "components", "of", "the", "worker" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/mixins/auth.py#L143-L151
[ "def", "_update_aes", "(", "self", ")", ":", "if", "salt", ".", "master", ".", "SMaster", ".", "secrets", "[", "'aes'", "]", "[", "'secret'", "]", ".", "value", "!=", "self", ".", "crypticle", ".", "key_string", ":", "self", ".", "crypticle", "=", "s...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
AESReqServerMixin._auth
Authenticate the client, use the sent public key to encrypt the AES key which was generated at start up. This method fires an event over the master event manager. The event is tagged "auth" and returns a dict with information about the auth event # Verify that the key we are re...
salt/transport/mixins/auth.py
def _auth(self, load): ''' Authenticate the client, use the sent public key to encrypt the AES key which was generated at start up. This method fires an event over the master event manager. The event is tagged "auth" and returns a dict with information about the auth eve...
def _auth(self, load): ''' Authenticate the client, use the sent public key to encrypt the AES key which was generated at start up. This method fires an event over the master event manager. The event is tagged "auth" and returns a dict with information about the auth eve...
[ "Authenticate", "the", "client", "use", "the", "sent", "public", "key", "to", "encrypt", "the", "AES", "key", "which", "was", "generated", "at", "start", "up", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/mixins/auth.py#L164-L520
[ "def", "_auth", "(", "self", ",", "load", ")", ":", "if", "not", "salt", ".", "utils", ".", "verify", ".", "valid_id", "(", "self", ".", "opts", ",", "load", "[", "'id'", "]", ")", ":", "log", ".", "info", "(", "'Authentication request from invalid id ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
which
Decorator wrapper for salt.utils.path.which
salt/utils/decorators/path.py
def which(exe): ''' Decorator wrapper for salt.utils.path.which ''' def wrapper(function): def wrapped(*args, **kwargs): if salt.utils.path.which(exe) is None: raise CommandNotFoundError( 'The \'{0}\' binary was not found in $PATH.'.format(exe) ...
def which(exe): ''' Decorator wrapper for salt.utils.path.which ''' def wrapper(function): def wrapped(*args, **kwargs): if salt.utils.path.which(exe) is None: raise CommandNotFoundError( 'The \'{0}\' binary was not found in $PATH.'.format(exe) ...
[ "Decorator", "wrapper", "for", "salt", ".", "utils", ".", "path", ".", "which" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/path.py#L13-L25
[ "def", "which", "(", "exe", ")", ":", "def", "wrapper", "(", "function", ")", ":", "def", "wrapped", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "salt", ".", "utils", ".", "path", ".", "which", "(", "exe", ")", "is", "None", ":",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
which_bin
Decorator wrapper for salt.utils.path.which_bin
salt/utils/decorators/path.py
def which_bin(exes): ''' Decorator wrapper for salt.utils.path.which_bin ''' def wrapper(function): def wrapped(*args, **kwargs): if salt.utils.path.which_bin(exes) is None: raise CommandNotFoundError( 'None of provided binaries({0}) was not found ...
def which_bin(exes): ''' Decorator wrapper for salt.utils.path.which_bin ''' def wrapper(function): def wrapped(*args, **kwargs): if salt.utils.path.which_bin(exes) is None: raise CommandNotFoundError( 'None of provided binaries({0}) was not found ...
[ "Decorator", "wrapper", "for", "salt", ".", "utils", ".", "path", ".", "which_bin" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/decorators/path.py#L28-L43
[ "def", "which_bin", "(", "exes", ")", ":", "def", "wrapper", "(", "function", ")", ":", "def", "wrapped", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "salt", ".", "utils", ".", "path", ".", "which_bin", "(", "exes", ")", "is", "Non...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
runner
Return all inline documentation for runner modules CLI Example: .. code-block:: bash salt-run doc.runner
salt/runners/doc.py
def runner(): ''' Return all inline documentation for runner modules CLI Example: .. code-block:: bash salt-run doc.runner ''' client = salt.runner.RunnerClient(__opts__) ret = client.get_docs() return ret
def runner(): ''' Return all inline documentation for runner modules CLI Example: .. code-block:: bash salt-run doc.runner ''' client = salt.runner.RunnerClient(__opts__) ret = client.get_docs() return ret
[ "Return", "all", "inline", "documentation", "for", "runner", "modules" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/doc.py#L27-L39
[ "def", "runner", "(", ")", ":", "client", "=", "salt", ".", "runner", ".", "RunnerClient", "(", "__opts__", ")", "ret", "=", "client", ".", "get_docs", "(", ")", "return", "ret" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
wheel
Return all inline documentation for wheel modules CLI Example: .. code-block:: bash salt-run doc.wheel
salt/runners/doc.py
def wheel(): ''' Return all inline documentation for wheel modules CLI Example: .. code-block:: bash salt-run doc.wheel ''' client = salt.wheel.Wheel(__opts__) ret = client.get_docs() return ret
def wheel(): ''' Return all inline documentation for wheel modules CLI Example: .. code-block:: bash salt-run doc.wheel ''' client = salt.wheel.Wheel(__opts__) ret = client.get_docs() return ret
[ "Return", "all", "inline", "documentation", "for", "wheel", "modules" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/doc.py#L42-L54
[ "def", "wheel", "(", ")", ":", "client", "=", "salt", ".", "wheel", ".", "Wheel", "(", "__opts__", ")", "ret", "=", "client", ".", "get_docs", "(", ")", "return", "ret" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
execution
Collect all the sys.doc output from each minion and return the aggregate CLI Example: .. code-block:: bash salt-run doc.execution
salt/runners/doc.py
def execution(): ''' Collect all the sys.doc output from each minion and return the aggregate CLI Example: .. code-block:: bash salt-run doc.execution ''' client = salt.client.get_local_client(__opts__['conf_file']) docs = {} try: for ret in client.cmd_iter('*', 'sys....
def execution(): ''' Collect all the sys.doc output from each minion and return the aggregate CLI Example: .. code-block:: bash salt-run doc.execution ''' client = salt.client.get_local_client(__opts__['conf_file']) docs = {} try: for ret in client.cmd_iter('*', 'sys....
[ "Collect", "all", "the", "sys", ".", "doc", "output", "from", "each", "minion", "and", "return", "the", "aggregate" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/doc.py#L57-L81
[ "def", "execution", "(", ")", ":", "client", "=", "salt", ".", "client", ".", "get_local_client", "(", "__opts__", "[", "'conf_file'", "]", ")", "docs", "=", "{", "}", "try", ":", "for", "ret", "in", "client", ".", "cmd_iter", "(", "'*'", ",", "'sys....
e8541fd6e744ab0df786c0f76102e41631f45d46
train
file
Create a temporary file CLI Example: .. code-block:: bash salt '*' temp.file salt '*' temp.file prefix='mytemp-' parent='/var/run/'
salt/modules/temp.py
def file(suffix='', prefix='tmp', parent=None): ''' Create a temporary file CLI Example: .. code-block:: bash salt '*' temp.file salt '*' temp.file prefix='mytemp-' parent='/var/run/' ''' fh_, tmp_ = tempfile.mkstemp(suffix, prefix, parent) os.close(fh_) return tmp_
def file(suffix='', prefix='tmp', parent=None): ''' Create a temporary file CLI Example: .. code-block:: bash salt '*' temp.file salt '*' temp.file prefix='mytemp-' parent='/var/run/' ''' fh_, tmp_ = tempfile.mkstemp(suffix, prefix, parent) os.close(fh_) return tmp_
[ "Create", "a", "temporary", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/temp.py#L33-L46
[ "def", "file", "(", "suffix", "=", "''", ",", "prefix", "=", "'tmp'", ",", "parent", "=", "None", ")", ":", "fh_", ",", "tmp_", "=", "tempfile", ".", "mkstemp", "(", "suffix", ",", "prefix", ",", "parent", ")", "os", ".", "close", "(", "fh_", ")"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RunnerClient._reformat_low
Format the low data for RunnerClient()'s master_call() function This also normalizes the following low data formats to a single, common low data structure. Old-style low: ``{'fun': 'jobs.lookup_jid', 'jid': '1234'}`` New-style: ``{'fun': 'jobs.lookup_jid', 'kwarg': {'jid': '1234'}}`` ...
salt/runner.py
def _reformat_low(self, low): ''' Format the low data for RunnerClient()'s master_call() function This also normalizes the following low data formats to a single, common low data structure. Old-style low: ``{'fun': 'jobs.lookup_jid', 'jid': '1234'}`` New-style: ``{'fun'...
def _reformat_low(self, low): ''' Format the low data for RunnerClient()'s master_call() function This also normalizes the following low data formats to a single, common low data structure. Old-style low: ``{'fun': 'jobs.lookup_jid', 'jid': '1234'}`` New-style: ``{'fun'...
[ "Format", "the", "low", "data", "for", "RunnerClient", "()", "s", "master_call", "()", "function" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runner.py#L66-L107
[ "def", "_reformat_low", "(", "self", ",", "low", ")", ":", "fun", "=", "low", ".", "pop", "(", "'fun'", ")", "verify_fun", "(", "self", ".", "functions", ",", "fun", ")", "eauth_creds", "=", "dict", "(", "[", "(", "i", ",", "low", ".", "pop", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RunnerClient.cmd_async
Execute a runner function asynchronously; eauth is respected This function requires that :conf_master:`external_auth` is configured and the user is authorized to execute runner functions: (``@runner``). .. code-block:: python runner.eauth_async({ 'fun': 'jobs.list_...
salt/runner.py
def cmd_async(self, low): ''' Execute a runner function asynchronously; eauth is respected This function requires that :conf_master:`external_auth` is configured and the user is authorized to execute runner functions: (``@runner``). .. code-block:: python runner.ea...
def cmd_async(self, low): ''' Execute a runner function asynchronously; eauth is respected This function requires that :conf_master:`external_auth` is configured and the user is authorized to execute runner functions: (``@runner``). .. code-block:: python runner.ea...
[ "Execute", "a", "runner", "function", "asynchronously", ";", "eauth", "is", "respected" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runner.py#L109-L127
[ "def", "cmd_async", "(", "self", ",", "low", ")", ":", "reformatted_low", "=", "self", ".", "_reformat_low", "(", "low", ")", "return", "mixins", ".", "AsyncClientMixin", ".", "cmd_async", "(", "self", ",", "reformatted_low", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RunnerClient.cmd_sync
Execute a runner function synchronously; eauth is respected This function requires that :conf_master:`external_auth` is configured and the user is authorized to execute runner functions: (``@runner``). .. code-block:: python runner.eauth_sync({ 'fun': 'jobs.list_jo...
salt/runner.py
def cmd_sync(self, low, timeout=None, full_return=False): ''' Execute a runner function synchronously; eauth is respected This function requires that :conf_master:`external_auth` is configured and the user is authorized to execute runner functions: (``@runner``). .. code-block:...
def cmd_sync(self, low, timeout=None, full_return=False): ''' Execute a runner function synchronously; eauth is respected This function requires that :conf_master:`external_auth` is configured and the user is authorized to execute runner functions: (``@runner``). .. code-block:...
[ "Execute", "a", "runner", "function", "synchronously", ";", "eauth", "is", "respected" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runner.py#L129-L146
[ "def", "cmd_sync", "(", "self", ",", "low", ",", "timeout", "=", "None", ",", "full_return", "=", "False", ")", ":", "reformatted_low", "=", "self", ".", "_reformat_low", "(", "low", ")", "return", "mixins", ".", "SyncClientMixin", ".", "cmd_sync", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Runner.print_docs
Print out the documentation!
salt/runner.py
def print_docs(self): ''' Print out the documentation! ''' arg = self.opts.get('fun', None) docs = super(Runner, self).get_docs(arg) for fun in sorted(docs): display_output('{0}:'.format(fun), 'text', self.opts) print(docs[fun])
def print_docs(self): ''' Print out the documentation! ''' arg = self.opts.get('fun', None) docs = super(Runner, self).get_docs(arg) for fun in sorted(docs): display_output('{0}:'.format(fun), 'text', self.opts) print(docs[fun])
[ "Print", "out", "the", "documentation!" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runner.py#L169-L177
[ "def", "print_docs", "(", "self", ")", ":", "arg", "=", "self", ".", "opts", ".", "get", "(", "'fun'", ",", "None", ")", "docs", "=", "super", "(", "Runner", ",", "self", ")", ".", "get_docs", "(", "arg", ")", "for", "fun", "in", "sorted", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Runner.run
Execute the runner sequence
salt/runner.py
def run(self): ''' Execute the runner sequence ''' # Print documentation only if self.opts.get('doc', False): self.print_docs() else: return self._run_runner()
def run(self): ''' Execute the runner sequence ''' # Print documentation only if self.opts.get('doc', False): self.print_docs() else: return self._run_runner()
[ "Execute", "the", "runner", "sequence" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runner.py#L180-L188
[ "def", "run", "(", "self", ")", ":", "# Print documentation only", "if", "self", ".", "opts", ".", "get", "(", "'doc'", ",", "False", ")", ":", "self", ".", "print_docs", "(", ")", "else", ":", "return", "self", ".", "_run_runner", "(", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Runner._run_runner
Actually execute specific runner :return:
salt/runner.py
def _run_runner(self): ''' Actually execute specific runner :return: ''' import salt.minion ret = {} low = {'fun': self.opts['fun']} try: # Allocate a jid async_pub = self._gen_async_pub() self.jid = async_pub['jid'] ...
def _run_runner(self): ''' Actually execute specific runner :return: ''' import salt.minion ret = {} low = {'fun': self.opts['fun']} try: # Allocate a jid async_pub = self._gen_async_pub() self.jid = async_pub['jid'] ...
[ "Actually", "execute", "specific", "runner", ":", "return", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runner.py#L190-L312
[ "def", "_run_runner", "(", "self", ")", ":", "import", "salt", ".", "minion", "ret", "=", "{", "}", "low", "=", "{", "'fun'", ":", "self", ".", "opts", "[", "'fun'", "]", "}", "try", ":", "# Allocate a jid", "async_pub", "=", "self", ".", "_gen_async...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
reg
Activate this register to turn on a minion status tracking register, this register keeps the current status beacon data and the time that each beacon was last checked in.
salt/thorium/status.py
def reg(name): ''' Activate this register to turn on a minion status tracking register, this register keeps the current status beacon data and the time that each beacon was last checked in. ''' ret = {'name': name, 'changes': {}, 'comment': '', 'result': True} ...
def reg(name): ''' Activate this register to turn on a minion status tracking register, this register keeps the current status beacon data and the time that each beacon was last checked in. ''' ret = {'name': name, 'changes': {}, 'comment': '', 'result': True} ...
[ "Activate", "this", "register", "to", "turn", "on", "a", "minion", "status", "tracking", "register", "this", "register", "keeps", "the", "current", "status", "beacon", "data", "and", "the", "time", "that", "each", "beacon", "was", "last", "checked", "in", "....
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/status.py#L14-L38
[ "def", "reg", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", ",", "'result'", ":", "True", "}", "now", "=", "time", ".", "time", "(", ")", "if", "'status'", "not", "i...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
top
Query |reclass| for the top data (states of the minions).
salt/tops/reclass_adapter.py
def top(**kwargs): ''' Query |reclass| for the top data (states of the minions). ''' # If reclass is installed, __virtual__ put it onto the search path, so we # don't need to protect against ImportError: # pylint: disable=3rd-party-module-not-gated from reclass.adapters.salt import top as r...
def top(**kwargs): ''' Query |reclass| for the top data (states of the minions). ''' # If reclass is installed, __virtual__ put it onto the search path, so we # don't need to protect against ImportError: # pylint: disable=3rd-party-module-not-gated from reclass.adapters.salt import top as r...
[ "Query", "|reclass|", "for", "the", "top", "data", "(", "states", "of", "the", "minions", ")", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tops/reclass_adapter.py#L82-L146
[ "def", "top", "(", "*", "*", "kwargs", ")", ":", "# If reclass is installed, __virtual__ put it onto the search path, so we", "# don't need to protect against ImportError:", "# pylint: disable=3rd-party-module-not-gated", "from", "reclass", ".", "adapters", ".", "salt", "import", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
create_pipeline
Create a new, empty pipeline. This function is idempotent. CLI example: .. code-block:: bash salt myminion boto_datapipeline.create_pipeline my_name my_unique_id
salt/modules/boto_datapipeline.py
def create_pipeline(name, unique_id, description='', region=None, key=None, keyid=None, profile=None): ''' Create a new, empty pipeline. This function is idempotent. CLI example: .. code-block:: bash salt myminion boto_datapipeline.create_pipeline my_name my_unique_id ...
def create_pipeline(name, unique_id, description='', region=None, key=None, keyid=None, profile=None): ''' Create a new, empty pipeline. This function is idempotent. CLI example: .. code-block:: bash salt myminion boto_datapipeline.create_pipeline my_name my_unique_id ...
[ "Create", "a", "new", "empty", "pipeline", ".", "This", "function", "is", "idempotent", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L57-L79
[ "def", "create_pipeline", "(", "name", ",", "unique_id", ",", "description", "=", "''", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "client", "=", "_get_client", "(", "region", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete_pipeline
Delete a pipeline, its pipeline definition, and its run history. This function is idempotent. CLI example: .. code-block:: bash salt myminion boto_datapipeline.delete_pipeline my_pipeline_id
salt/modules/boto_datapipeline.py
def delete_pipeline(pipeline_id, region=None, key=None, keyid=None, profile=None): ''' Delete a pipeline, its pipeline definition, and its run history. This function is idempotent. CLI example: .. code-block:: bash salt myminion boto_datapipeline.delete_pipeline my_pipeline_id ''' cli...
def delete_pipeline(pipeline_id, region=None, key=None, keyid=None, profile=None): ''' Delete a pipeline, its pipeline definition, and its run history. This function is idempotent. CLI example: .. code-block:: bash salt myminion boto_datapipeline.delete_pipeline my_pipeline_id ''' cli...
[ "Delete", "a", "pipeline", "its", "pipeline", "definition", "and", "its", "run", "history", ".", "This", "function", "is", "idempotent", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L82-L99
[ "def", "delete_pipeline", "(", "pipeline_id", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "client", "=", "_get_client", "(", "region", ",", "key", ",", "keyid", ",", "profile", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
describe_pipelines
Retrieve metadata about one or more pipelines. CLI example: .. code-block:: bash salt myminion boto_datapipeline.describe_pipelines ['my_pipeline_id']
salt/modules/boto_datapipeline.py
def describe_pipelines(pipeline_ids, region=None, key=None, keyid=None, profile=None): ''' Retrieve metadata about one or more pipelines. CLI example: .. code-block:: bash salt myminion boto_datapipeline.describe_pipelines ['my_pipeline_id'] ''' client = _get_client(region, key, keyid...
def describe_pipelines(pipeline_ids, region=None, key=None, keyid=None, profile=None): ''' Retrieve metadata about one or more pipelines. CLI example: .. code-block:: bash salt myminion boto_datapipeline.describe_pipelines ['my_pipeline_id'] ''' client = _get_client(region, key, keyid...
[ "Retrieve", "metadata", "about", "one", "or", "more", "pipelines", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L102-L118
[ "def", "describe_pipelines", "(", "pipeline_ids", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "client", "=", "_get_client", "(", "region", ",", "key", ",", "keyid", ",", "profil...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_pipelines
Get a list of pipeline ids and names for all pipelines. CLI Example: .. code-block:: bash salt myminion boto_datapipeline.list_pipelines profile=myprofile
salt/modules/boto_datapipeline.py
def list_pipelines(region=None, key=None, keyid=None, profile=None): ''' Get a list of pipeline ids and names for all pipelines. CLI Example: .. code-block:: bash salt myminion boto_datapipeline.list_pipelines profile=myprofile ''' client = _get_client(region, key, keyid, profile) ...
def list_pipelines(region=None, key=None, keyid=None, profile=None): ''' Get a list of pipeline ids and names for all pipelines. CLI Example: .. code-block:: bash salt myminion boto_datapipeline.list_pipelines profile=myprofile ''' client = _get_client(region, key, keyid, profile) ...
[ "Get", "a", "list", "of", "pipeline", "ids", "and", "names", "for", "all", "pipelines", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L144-L164
[ "def", "list_pipelines", "(", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "client", "=", "_get_client", "(", "region", ",", "key", ",", "keyid", ",", "profile", ")", "r", "=", "{...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
pipeline_id_from_name
Get the pipeline id, if it exists, for the given name. CLI example: .. code-block:: bash salt myminion boto_datapipeline.pipeline_id_from_name my_pipeline_name
salt/modules/boto_datapipeline.py
def pipeline_id_from_name(name, region=None, key=None, keyid=None, profile=None): ''' Get the pipeline id, if it exists, for the given name. CLI example: .. code-block:: bash salt myminion boto_datapipeline.pipeline_id_from_name my_pipeline_name ''' r = {} result_pipelines = list_...
def pipeline_id_from_name(name, region=None, key=None, keyid=None, profile=None): ''' Get the pipeline id, if it exists, for the given name. CLI example: .. code-block:: bash salt myminion boto_datapipeline.pipeline_id_from_name my_pipeline_name ''' r = {} result_pipelines = list_...
[ "Get", "the", "pipeline", "id", "if", "it", "exists", "for", "the", "given", "name", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L167-L187
[ "def", "pipeline_id_from_name", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "r", "=", "{", "}", "result_pipelines", "=", "list_pipelines", "(", ")", "if", "'error'"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
put_pipeline_definition
Add tasks, schedules, and preconditions to the specified pipeline. This function is idempotent and will replace an existing definition. CLI example: .. code-block:: bash salt myminion boto_datapipeline.put_pipeline_definition my_pipeline_id my_pipeline_objects
salt/modules/boto_datapipeline.py
def put_pipeline_definition(pipeline_id, pipeline_objects, parameter_objects=None, parameter_values=None, region=None, key=None, keyid=None, profile=None): ''' Add tasks, schedules, and preconditions to the specified pipeline. This function is idempotent and will replace an exist...
def put_pipeline_definition(pipeline_id, pipeline_objects, parameter_objects=None, parameter_values=None, region=None, key=None, keyid=None, profile=None): ''' Add tasks, schedules, and preconditions to the specified pipeline. This function is idempotent and will replace an exist...
[ "Add", "tasks", "schedules", "and", "preconditions", "to", "the", "specified", "pipeline", ".", "This", "function", "is", "idempotent", "and", "will", "replace", "an", "existing", "definition", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L190-L219
[ "def", "put_pipeline_definition", "(", "pipeline_id", ",", "pipeline_objects", ",", "parameter_objects", "=", "None", ",", "parameter_values", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_client
Get a boto connection to Data Pipeline.
salt/modules/boto_datapipeline.py
def _get_client(region, key, keyid, profile): ''' Get a boto connection to Data Pipeline. ''' session = _get_session(region, key, keyid, profile) if not session: log.error("Failed to get datapipeline client.") return None return session.client('datapipeline')
def _get_client(region, key, keyid, profile): ''' Get a boto connection to Data Pipeline. ''' session = _get_session(region, key, keyid, profile) if not session: log.error("Failed to get datapipeline client.") return None return session.client('datapipeline')
[ "Get", "a", "boto", "connection", "to", "Data", "Pipeline", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L222-L231
[ "def", "_get_client", "(", "region", ",", "key", ",", "keyid", ",", "profile", ")", ":", "session", "=", "_get_session", "(", "region", ",", "key", ",", "keyid", ",", "profile", ")", "if", "not", "session", ":", "log", ".", "error", "(", "\"Failed to g...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_session
Get a boto3 session
salt/modules/boto_datapipeline.py
def _get_session(region, key, keyid, profile): ''' Get a boto3 session ''' if profile: if isinstance(profile, six.string_types): _profile = __salt__['config.option'](profile) elif isinstance(profile, dict): _profile = profile key = _profile.get('key', None...
def _get_session(region, key, keyid, profile): ''' Get a boto3 session ''' if profile: if isinstance(profile, six.string_types): _profile = __salt__['config.option'](profile) elif isinstance(profile, dict): _profile = profile key = _profile.get('key', None...
[ "Get", "a", "boto3", "session" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_datapipeline.py#L234-L257
[ "def", "_get_session", "(", "region", ",", "key", ",", "keyid", ",", "profile", ")", ":", "if", "profile", ":", "if", "isinstance", "(", "profile", ",", "six", ".", "string_types", ")", ":", "_profile", "=", "__salt__", "[", "'config.option'", "]", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
make_image
Create a blank virtual machine image file of the specified size in megabytes. The image can be created in any format supported by qemu CLI Example: .. code-block:: bash salt '*' qemu_img.make_image /tmp/image.qcow 2048 qcow2 salt '*' qemu_img.make_image /tmp/image.raw 10240 raw
salt/modules/qemu_img.py
def make_image(location, size, fmt): ''' Create a blank virtual machine image file of the specified size in megabytes. The image can be created in any format supported by qemu CLI Example: .. code-block:: bash salt '*' qemu_img.make_image /tmp/image.qcow 2048 qcow2 salt '*' qemu_i...
def make_image(location, size, fmt): ''' Create a blank virtual machine image file of the specified size in megabytes. The image can be created in any format supported by qemu CLI Example: .. code-block:: bash salt '*' qemu_img.make_image /tmp/image.qcow 2048 qcow2 salt '*' qemu_i...
[ "Create", "a", "blank", "virtual", "machine", "image", "file", "of", "the", "specified", "size", "in", "megabytes", ".", "The", "image", "can", "be", "created", "in", "any", "format", "supported", "by", "qemu" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/qemu_img.py#L28-L51
[ "def", "make_image", "(", "location", ",", "size", ",", "fmt", ")", ":", "if", "not", "os", ".", "path", ".", "isabs", "(", "location", ")", ":", "return", "''", "if", "not", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "dirname"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
convert
Convert an existing disk image to another format using qemu-img CLI Example: .. code-block:: bash salt '*' qemu_img.convert /path/to/original.img /path/to/new.img qcow2
salt/modules/qemu_img.py
def convert(orig, dest, fmt): ''' Convert an existing disk image to another format using qemu-img CLI Example: .. code-block:: bash salt '*' qemu_img.convert /path/to/original.img /path/to/new.img qcow2 ''' cmd = ('qemu-img', 'convert', '-O', fmt, orig, dest) ret = __salt__['cmd.r...
def convert(orig, dest, fmt): ''' Convert an existing disk image to another format using qemu-img CLI Example: .. code-block:: bash salt '*' qemu_img.convert /path/to/original.img /path/to/new.img qcow2 ''' cmd = ('qemu-img', 'convert', '-O', fmt, orig, dest) ret = __salt__['cmd.r...
[ "Convert", "an", "existing", "disk", "image", "to", "another", "format", "using", "qemu", "-", "img" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/qemu_img.py#L54-L69
[ "def", "convert", "(", "orig", ",", "dest", ",", "fmt", ")", ":", "cmd", "=", "(", "'qemu-img'", ",", "'convert'", ",", "'-O'", ",", "fmt", ",", "orig", ",", "dest", ")", "ret", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "python_s...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ping
Performs a ping to a host CLI Example: .. code-block:: bash salt '*' network.ping archlinux.org .. versionadded:: 2016.11.0 Return a True or False instead of ping output. .. code-block:: bash salt '*' network.ping archlinux.org return_boolean=True Set the time to wait for...
salt/modules/win_network.py
def ping(host, timeout=False, return_boolean=False): ''' Performs a ping to a host CLI Example: .. code-block:: bash salt '*' network.ping archlinux.org .. versionadded:: 2016.11.0 Return a True or False instead of ping output. .. code-block:: bash salt '*' network.pin...
def ping(host, timeout=False, return_boolean=False): ''' Performs a ping to a host CLI Example: .. code-block:: bash salt '*' network.ping archlinux.org .. versionadded:: 2016.11.0 Return a True or False instead of ping output. .. code-block:: bash salt '*' network.pin...
[ "Performs", "a", "ping", "to", "a", "host" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L69-L107
[ "def", "ping", "(", "host", ",", "timeout", "=", "False", ",", "return_boolean", "=", "False", ")", ":", "if", "timeout", ":", "# Windows ping differs by having timeout be for individual echo requests.'", "# Divide timeout by tries to mimic BSD behaviour.", "timeout", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
netstat
Return information on open ports and states CLI Example: .. code-block:: bash salt '*' network.netstat
salt/modules/win_network.py
def netstat(): ''' Return information on open ports and states CLI Example: .. code-block:: bash salt '*' network.netstat ''' ret = [] cmd = ['netstat', '-nao'] lines = __salt__['cmd.run'](cmd, python_shell=False).splitlines() for line in lines: comps = line.split(...
def netstat(): ''' Return information on open ports and states CLI Example: .. code-block:: bash salt '*' network.netstat ''' ret = [] cmd = ['netstat', '-nao'] lines = __salt__['cmd.run'](cmd, python_shell=False).splitlines() for line in lines: comps = line.split(...
[ "Return", "information", "on", "open", "ports", "and", "states" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L110-L139
[ "def", "netstat", "(", ")", ":", "ret", "=", "[", "]", "cmd", "=", "[", "'netstat'", ",", "'-nao'", "]", "lines", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", ".", "splitlines", "(", ")", "for", "line"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
traceroute
Performs a traceroute to a 3rd party host CLI Example: .. code-block:: bash salt '*' network.traceroute archlinux.org
salt/modules/win_network.py
def traceroute(host): ''' Performs a traceroute to a 3rd party host CLI Example: .. code-block:: bash salt '*' network.traceroute archlinux.org ''' ret = [] cmd = ['tracert', salt.utils.network.sanitize_host(host)] lines = __salt__['cmd.run'](cmd, python_shell=False).splitline...
def traceroute(host): ''' Performs a traceroute to a 3rd party host CLI Example: .. code-block:: bash salt '*' network.traceroute archlinux.org ''' ret = [] cmd = ['tracert', salt.utils.network.sanitize_host(host)] lines = __salt__['cmd.run'](cmd, python_shell=False).splitline...
[ "Performs", "a", "traceroute", "to", "a", "3rd", "party", "host" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L142-L193
[ "def", "traceroute", "(", "host", ")", ":", "ret", "=", "[", "]", "cmd", "=", "[", "'tracert'", ",", "salt", ".", "utils", ".", "network", ".", "sanitize_host", "(", "host", ")", "]", "lines", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ","...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
nslookup
Query DNS for information about a domain or ip address CLI Example: .. code-block:: bash salt '*' network.nslookup archlinux.org
salt/modules/win_network.py
def nslookup(host): ''' Query DNS for information about a domain or ip address CLI Example: .. code-block:: bash salt '*' network.nslookup archlinux.org ''' ret = [] addresses = [] cmd = ['nslookup', salt.utils.network.sanitize_host(host)] lines = __salt__['cmd.run'](cmd, ...
def nslookup(host): ''' Query DNS for information about a domain or ip address CLI Example: .. code-block:: bash salt '*' network.nslookup archlinux.org ''' ret = [] addresses = [] cmd = ['nslookup', salt.utils.network.sanitize_host(host)] lines = __salt__['cmd.run'](cmd, ...
[ "Query", "DNS", "for", "information", "about", "a", "domain", "or", "ip", "address" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L196-L226
[ "def", "nslookup", "(", "host", ")", ":", "ret", "=", "[", "]", "addresses", "=", "[", "]", "cmd", "=", "[", "'nslookup'", ",", "salt", ".", "utils", ".", "network", ".", "sanitize_host", "(", "host", ")", "]", "lines", "=", "__salt__", "[", "'cmd....
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_route
Return routing information for given destination ip .. versionadded:: 2016.11.5 CLI Example:: salt '*' network.get_route 10.10.10.10
salt/modules/win_network.py
def get_route(ip): ''' Return routing information for given destination ip .. versionadded:: 2016.11.5 CLI Example:: salt '*' network.get_route 10.10.10.10 ''' cmd = 'Find-NetRoute -RemoteIPAddress {0}'.format(ip) out = __salt__['cmd.run'](cmd, shell='powershell', python_shell=Tru...
def get_route(ip): ''' Return routing information for given destination ip .. versionadded:: 2016.11.5 CLI Example:: salt '*' network.get_route 10.10.10.10 ''' cmd = 'Find-NetRoute -RemoteIPAddress {0}'.format(ip) out = __salt__['cmd.run'](cmd, shell='powershell', python_shell=Tru...
[ "Return", "routing", "information", "for", "given", "destination", "ip" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L229-L255
[ "def", "get_route", "(", "ip", ")", ":", "cmd", "=", "'Find-NetRoute -RemoteIPAddress {0}'", ".", "format", "(", "ip", ")", "out", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "shell", "=", "'powershell'", ",", "python_shell", "=", "True", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
dig
Performs a DNS lookup with dig Note: dig must be installed on the Windows minion CLI Example: .. code-block:: bash salt '*' network.dig archlinux.org
salt/modules/win_network.py
def dig(host): ''' Performs a DNS lookup with dig Note: dig must be installed on the Windows minion CLI Example: .. code-block:: bash salt '*' network.dig archlinux.org ''' cmd = ['dig', salt.utils.network.sanitize_host(host)] return __salt__['cmd.run'](cmd, python_shell=Fals...
def dig(host): ''' Performs a DNS lookup with dig Note: dig must be installed on the Windows minion CLI Example: .. code-block:: bash salt '*' network.dig archlinux.org ''' cmd = ['dig', salt.utils.network.sanitize_host(host)] return __salt__['cmd.run'](cmd, python_shell=Fals...
[ "Performs", "a", "DNS", "lookup", "with", "dig" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L258-L271
[ "def", "dig", "(", "host", ")", ":", "cmd", "=", "[", "'dig'", ",", "salt", ".", "utils", ".", "network", ".", "sanitize_host", "(", "host", ")", "]", "return", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
interfaces_names
Return a list of all the interfaces names CLI Example: .. code-block:: bash salt '*' network.interfaces_names
salt/modules/win_network.py
def interfaces_names(): ''' Return a list of all the interfaces names CLI Example: .. code-block:: bash salt '*' network.interfaces_names ''' ret = [] with salt.utils.winapi.Com(): c = wmi.WMI() for iface in c.Win32_NetworkAdapter(NetEnabled=True): ret...
def interfaces_names(): ''' Return a list of all the interfaces names CLI Example: .. code-block:: bash salt '*' network.interfaces_names ''' ret = [] with salt.utils.winapi.Com(): c = wmi.WMI() for iface in c.Win32_NetworkAdapter(NetEnabled=True): ret...
[ "Return", "a", "list", "of", "all", "the", "interfaces", "names" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L274-L290
[ "def", "interfaces_names", "(", ")", ":", "ret", "=", "[", "]", "with", "salt", ".", "utils", ".", "winapi", ".", "Com", "(", ")", ":", "c", "=", "wmi", ".", "WMI", "(", ")", "for", "iface", "in", "c", ".", "Win32_NetworkAdapter", "(", "NetEnabled"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ip_addrs
Returns a list of IPv4 addresses assigned to the host. interface Only IP addresses from that interface will be returned. include_loopback : False Include loopback 127.0.0.1 IPv4 address. cidr Describes subnet using CIDR notation and only IPv4 addresses that belong to this ...
salt/modules/win_network.py
def ip_addrs(interface=None, include_loopback=False, cidr=None, type=None): ''' Returns a list of IPv4 addresses assigned to the host. interface Only IP addresses from that interface will be returned. include_loopback : False Include loopback 127.0.0.1 IPv4 address. cidr D...
def ip_addrs(interface=None, include_loopback=False, cidr=None, type=None): ''' Returns a list of IPv4 addresses assigned to the host. interface Only IP addresses from that interface will be returned. include_loopback : False Include loopback 127.0.0.1 IPv4 address. cidr D...
[ "Returns", "a", "list", "of", "IPv4", "addresses", "assigned", "to", "the", "host", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L349-L389
[ "def", "ip_addrs", "(", "interface", "=", "None", ",", "include_loopback", "=", "False", ",", "cidr", "=", "None", ",", "type", "=", "None", ")", ":", "addrs", "=", "salt", ".", "utils", ".", "network", ".", "ip_addrs", "(", "interface", "=", "interfac...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ip_addrs6
Returns a list of IPv6 addresses assigned to the host. interface Only IP addresses from that interface will be returned. include_loopback : False Include loopback ::1 IPv6 address. cidr Describes subnet using CIDR notation and only IPv6 addresses that belong to this subnet...
salt/modules/win_network.py
def ip_addrs6(interface=None, include_loopback=False, cidr=None): ''' Returns a list of IPv6 addresses assigned to the host. interface Only IP addresses from that interface will be returned. include_loopback : False Include loopback ::1 IPv6 address. cidr Describes subnet ...
def ip_addrs6(interface=None, include_loopback=False, cidr=None): ''' Returns a list of IPv6 addresses assigned to the host. interface Only IP addresses from that interface will be returned. include_loopback : False Include loopback ::1 IPv6 address. cidr Describes subnet ...
[ "Returns", "a", "list", "of", "IPv6", "addresses", "assigned", "to", "the", "host", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L395-L423
[ "def", "ip_addrs6", "(", "interface", "=", "None", ",", "include_loopback", "=", "False", ",", "cidr", "=", "None", ")", ":", "addrs", "=", "salt", ".", "utils", ".", "network", ".", "ip_addrs6", "(", "interface", "=", "interface", ",", "include_loopback",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
connect
Test connectivity to a host using a particular port from the minion. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' network.connect archlinux.org 80 salt '*' network.connect archlinux.org 80 timeout=3 salt '*' network.connect archlinux.org 80 timeout=...
salt/modules/win_network.py
def connect(host, port=None, **kwargs): ''' Test connectivity to a host using a particular port from the minion. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' network.connect archlinux.org 80 salt '*' network.connect archlinux.org 80 timeout=3 ...
def connect(host, port=None, **kwargs): ''' Test connectivity to a host using a particular port from the minion. .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' network.connect archlinux.org 80 salt '*' network.connect archlinux.org 80 timeout=3 ...
[ "Test", "connectivity", "to", "a", "host", "using", "a", "particular", "port", "from", "the", "minion", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_network.py#L429-L518
[ "def", "connect", "(", "host", ",", "port", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "if", "not", "host", ":", "ret", "[", "'result'", "]", "=", "False", "ret", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_post_message
Send a message to a Pushover user or group. :param user: The user or group to send to, must be key of user or group not email address. :param message: The message to send to the PushOver user or group. :param title: Specify who the message is from. :param priority The priority of th...
salt/returners/pushover_returner.py
def _post_message(user, device, message, title, priority, expire, retry, sound, api_version=1, token=None): ''' Send a message to a Pushover user or g...
def _post_message(user, device, message, title, priority, expire, retry, sound, api_version=1, token=None): ''' Send a message to a Pushover user or g...
[ "Send", "a", "message", "to", "a", "Pushover", "user", "or", "group", ".", ":", "param", "user", ":", "The", "user", "or", "group", "to", "send", "to", "must", "be", "key", "of", "user", "or", "group", "not", "email", "address", ".", ":", "param", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pushover_returner.py#L151-L198
[ "def", "_post_message", "(", "user", ",", "device", ",", "message", ",", "title", ",", "priority", ",", "expire", ",", "retry", ",", "sound", ",", "api_version", "=", "1", ",", "token", "=", "None", ")", ":", "user_validate", "=", "salt", ".", "utils",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
returner
Send an PushOver message with the data
salt/returners/pushover_returner.py
def returner(ret): ''' Send an PushOver message with the data ''' _options = _get_options(ret) user = _options.get('user') device = _options.get('device') token = _options.get('token') title = _options.get('title') priority = _options.get('priority') expire = _options.get('expi...
def returner(ret): ''' Send an PushOver message with the data ''' _options = _get_options(ret) user = _options.get('user') device = _options.get('device') token = _options.get('token') title = _options.get('title') priority = _options.get('priority') expire = _options.get('expi...
[ "Send", "an", "PushOver", "message", "with", "the", "data" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/pushover_returner.py#L201-L251
[ "def", "returner", "(", "ret", ")", ":", "_options", "=", "_get_options", "(", "ret", ")", "user", "=", "_options", ".", "get", "(", "'user'", ")", "device", "=", "_options", ".", "get", "(", "'device'", ")", "token", "=", "_options", ".", "get", "("...
e8541fd6e744ab0df786c0f76102e41631f45d46