id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
33,600
saltstack/salt
salt/utils/network.py
_netbsd_remotes_on
def _netbsd_remotes_on(port, which_end): ''' Returns set of ipv4 host addresses of remote established connections on local tcp port port. Parses output of shell 'sockstat' (NetBSD) to get connections $ sudo sockstat -4 -n USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDR...
python
def _netbsd_remotes_on(port, which_end): ''' Returns set of ipv4 host addresses of remote established connections on local tcp port port. Parses output of shell 'sockstat' (NetBSD) to get connections $ sudo sockstat -4 -n USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDR...
[ "def", "_netbsd_remotes_on", "(", "port", ",", "which_end", ")", ":", "port", "=", "int", "(", "port", ")", "remotes", "=", "set", "(", ")", "try", ":", "cmd", "=", "salt", ".", "utils", ".", "args", ".", "shlex_split", "(", "'sockstat -4 -c -n -p {0}'",...
Returns set of ipv4 host addresses of remote established connections on local tcp port port. Parses output of shell 'sockstat' (NetBSD) to get connections $ sudo sockstat -4 -n USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS root python2.7 1456 29 tcp *.4505...
[ "Returns", "set", "of", "ipv4", "host", "addresses", "of", "remote", "established", "connections", "on", "local", "tcp", "port", "port", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1605-L1661
33,601
saltstack/salt
salt/utils/network.py
_openbsd_remotes_on
def _openbsd_remotes_on(port, which_end): ''' OpenBSD specific helper function. Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'netstat' to get connections $ netstat -nf inet Active Internet connections Proto R...
python
def _openbsd_remotes_on(port, which_end): ''' OpenBSD specific helper function. Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'netstat' to get connections $ netstat -nf inet Active Internet connections Proto R...
[ "def", "_openbsd_remotes_on", "(", "port", ",", "which_end", ")", ":", "remotes", "=", "set", "(", ")", "try", ":", "data", "=", "subprocess", ".", "check_output", "(", "[", "'netstat'", ",", "'-nf'", ",", "'inet'", "]", ")", "# pylint: disable=minimum-pytho...
OpenBSD specific helper function. Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'netstat' to get connections $ netstat -nf inet Active Internet connections Proto Recv-Q Send-Q Local Address Foreign Address ...
[ "OpenBSD", "specific", "helper", "function", ".", "Returns", "set", "of", "ipv4", "host", "addresses", "of", "remote", "established", "connections", "on", "local", "or", "remote", "tcp", "port", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1664-L1698
33,602
saltstack/salt
salt/utils/network.py
_windows_remotes_on
def _windows_remotes_on(port, which_end): r''' Windows specific helper function. Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'netstat' to get connections C:\>netstat -n Active Connections Proto Local Add...
python
def _windows_remotes_on(port, which_end): r''' Windows specific helper function. Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'netstat' to get connections C:\>netstat -n Active Connections Proto Local Add...
[ "def", "_windows_remotes_on", "(", "port", ",", "which_end", ")", ":", "remotes", "=", "set", "(", ")", "try", ":", "data", "=", "subprocess", ".", "check_output", "(", "[", "'netstat'", ",", "'-n'", "]", ")", "# pylint: disable=minimum-python-version", "excep...
r''' Windows specific helper function. Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'netstat' to get connections C:\>netstat -n Active Connections Proto Local Address Foreign Address State ...
[ "r", "Windows", "specific", "helper", "function", ".", "Returns", "set", "of", "ipv4", "host", "addresses", "of", "remote", "established", "connections", "on", "local", "or", "remote", "tcp", "port", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1701-L1736
33,603
saltstack/salt
salt/utils/network.py
_linux_remotes_on
def _linux_remotes_on(port, which_end): ''' Linux specific helper function. Returns set of ip host addresses of remote established connections on local tcp port port. Parses output of shell 'lsof' to get connections $ sudo lsof -iTCP:4505 -n COMMAND PID USER FD TYPE D...
python
def _linux_remotes_on(port, which_end): ''' Linux specific helper function. Returns set of ip host addresses of remote established connections on local tcp port port. Parses output of shell 'lsof' to get connections $ sudo lsof -iTCP:4505 -n COMMAND PID USER FD TYPE D...
[ "def", "_linux_remotes_on", "(", "port", ",", "which_end", ")", ":", "remotes", "=", "set", "(", ")", "try", ":", "data", "=", "subprocess", ".", "check_output", "(", "[", "'lsof'", ",", "'-iTCP:{0:d}'", ".", "format", "(", "port", ")", ",", "'-n'", ",...
Linux specific helper function. Returns set of ip host addresses of remote established connections on local tcp port port. Parses output of shell 'lsof' to get connections $ sudo lsof -iTCP:4505 -n COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME Python 9971 root 35...
[ "Linux", "specific", "helper", "function", ".", "Returns", "set", "of", "ip", "host", "addresses", "of", "remote", "established", "connections", "on", "local", "tcp", "port", "port", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1739-L1793
33,604
saltstack/salt
salt/utils/network.py
gen_mac
def gen_mac(prefix='AC:DE:48'): ''' Generates a MAC address with the defined OUI prefix. Common prefixes: - ``00:16:3E`` -- Xen - ``00:18:51`` -- OpenVZ - ``00:50:56`` -- VMware (manually generated) - ``52:54:00`` -- QEMU/KVM - ``AC:DE:48`` -- PRIVATE References: - http...
python
def gen_mac(prefix='AC:DE:48'): ''' Generates a MAC address with the defined OUI prefix. Common prefixes: - ``00:16:3E`` -- Xen - ``00:18:51`` -- OpenVZ - ``00:50:56`` -- VMware (manually generated) - ``52:54:00`` -- QEMU/KVM - ``AC:DE:48`` -- PRIVATE References: - http...
[ "def", "gen_mac", "(", "prefix", "=", "'AC:DE:48'", ")", ":", "return", "'{0}:{1:02X}:{2:02X}:{3:02X}'", ".", "format", "(", "prefix", ",", "random", ".", "randint", "(", "0", ",", "0xff", ")", ",", "random", ".", "randint", "(", "0", ",", "0xff", ")", ...
Generates a MAC address with the defined OUI prefix. Common prefixes: - ``00:16:3E`` -- Xen - ``00:18:51`` -- OpenVZ - ``00:50:56`` -- VMware (manually generated) - ``52:54:00`` -- QEMU/KVM - ``AC:DE:48`` -- PRIVATE References: - http://standards.ieee.org/develop/regauth/oui/ou...
[ "Generates", "a", "MAC", "address", "with", "the", "defined", "OUI", "prefix", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1847-L1868
33,605
saltstack/salt
salt/utils/network.py
connection_check
def connection_check(addr, port=80, safe=False, ipv6=None): ''' Provides a convenient alias for the dns_check filter. ''' return dns_check(addr, port, safe, ipv6)
python
def connection_check(addr, port=80, safe=False, ipv6=None): ''' Provides a convenient alias for the dns_check filter. ''' return dns_check(addr, port, safe, ipv6)
[ "def", "connection_check", "(", "addr", ",", "port", "=", "80", ",", "safe", "=", "False", ",", "ipv6", "=", "None", ")", ":", "return", "dns_check", "(", "addr", ",", "port", ",", "safe", ",", "ipv6", ")" ]
Provides a convenient alias for the dns_check filter.
[ "Provides", "a", "convenient", "alias", "for", "the", "dns_check", "filter", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L1904-L1908
33,606
saltstack/salt
salt/utils/network.py
is_fqdn
def is_fqdn(hostname): """ Verify if hostname conforms to be a FQDN. :param hostname: text string with the name of the host :return: bool, True if hostname is correct FQDN, False otherwise """ compliant = re.compile(r"(?!-)[A-Z\d\-\_]{1,63}(?<!-)$", re.IGNORECASE) return "." in hostname an...
python
def is_fqdn(hostname): """ Verify if hostname conforms to be a FQDN. :param hostname: text string with the name of the host :return: bool, True if hostname is correct FQDN, False otherwise """ compliant = re.compile(r"(?!-)[A-Z\d\-\_]{1,63}(?<!-)$", re.IGNORECASE) return "." in hostname an...
[ "def", "is_fqdn", "(", "hostname", ")", ":", "compliant", "=", "re", ".", "compile", "(", "r\"(?!-)[A-Z\\d\\-\\_]{1,63}(?<!-)$\"", ",", "re", ".", "IGNORECASE", ")", "return", "\".\"", "in", "hostname", "and", "len", "(", "hostname", ")", "<", "0xff", "and",...
Verify if hostname conforms to be a FQDN. :param hostname: text string with the name of the host :return: bool, True if hostname is correct FQDN, False otherwise
[ "Verify", "if", "hostname", "conforms", "to", "be", "a", "FQDN", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L2057-L2066
33,607
saltstack/salt
salt/modules/mount.py
_active_mounts
def _active_mounts(ret): ''' List active mounts on Linux systems ''' _list = _list_mounts() filename = '/proc/self/mounts' if not os.access(filename, os.R_OK): msg = 'File not readable {0}' raise CommandExecutionError(msg.format(filename)) with salt.utils.files.fopen(filenam...
python
def _active_mounts(ret): ''' List active mounts on Linux systems ''' _list = _list_mounts() filename = '/proc/self/mounts' if not os.access(filename, os.R_OK): msg = 'File not readable {0}' raise CommandExecutionError(msg.format(filename)) with salt.utils.files.fopen(filenam...
[ "def", "_active_mounts", "(", "ret", ")", ":", "_list", "=", "_list_mounts", "(", ")", "filename", "=", "'/proc/self/mounts'", "if", "not", "os", ".", "access", "(", "filename", ",", "os", ".", "R_OK", ")", ":", "msg", "=", "'File not readable {0}'", "rais...
List active mounts on Linux systems
[ "List", "active", "mounts", "on", "Linux", "systems" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L102-L119
33,608
saltstack/salt
salt/modules/mount.py
_active_mounts_aix
def _active_mounts_aix(ret): ''' List active mounts on AIX systems ''' for line in __salt__['cmd.run_stdout']('mount -p').split('\n'): comps = re.sub(r"\s+", " ", line).split() if comps: if comps[0] == 'node' or comps[0] == '--------': continue com...
python
def _active_mounts_aix(ret): ''' List active mounts on AIX systems ''' for line in __salt__['cmd.run_stdout']('mount -p').split('\n'): comps = re.sub(r"\s+", " ", line).split() if comps: if comps[0] == 'node' or comps[0] == '--------': continue com...
[ "def", "_active_mounts_aix", "(", "ret", ")", ":", "for", "line", "in", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "'mount -p'", ")", ".", "split", "(", "'\\n'", ")", ":", "comps", "=", "re", ".", "sub", "(", "r\"\\s+\"", ",", "\" \"", ",", "line",...
List active mounts on AIX systems
[ "List", "active", "mounts", "on", "AIX", "systems" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L122-L152
33,609
saltstack/salt
salt/modules/mount.py
_active_mounts_freebsd
def _active_mounts_freebsd(ret): ''' List active mounts on FreeBSD systems ''' for line in __salt__['cmd.run_stdout']('mount -p').split('\n'): comps = re.sub(r"\s+", " ", line).split() ret[comps[1]] = {'device': comps[0], 'fstype': comps[2], ...
python
def _active_mounts_freebsd(ret): ''' List active mounts on FreeBSD systems ''' for line in __salt__['cmd.run_stdout']('mount -p').split('\n'): comps = re.sub(r"\s+", " ", line).split() ret[comps[1]] = {'device': comps[0], 'fstype': comps[2], ...
[ "def", "_active_mounts_freebsd", "(", "ret", ")", ":", "for", "line", "in", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "'mount -p'", ")", ".", "split", "(", "'\\n'", ")", ":", "comps", "=", "re", ".", "sub", "(", "r\"\\s+\"", ",", "\" \"", ",", "li...
List active mounts on FreeBSD systems
[ "List", "active", "mounts", "on", "FreeBSD", "systems" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L155-L164
33,610
saltstack/salt
salt/modules/mount.py
_active_mounts_openbsd
def _active_mounts_openbsd(ret): ''' List active mounts on OpenBSD systems ''' for line in __salt__['cmd.run_stdout']('mount -v').split('\n'): comps = re.sub(r"\s+", " ", line).split() parens = re.findall(r'\((.*?)\)', line, re.DOTALL) if len(parens) > 1: nod = __salt...
python
def _active_mounts_openbsd(ret): ''' List active mounts on OpenBSD systems ''' for line in __salt__['cmd.run_stdout']('mount -v').split('\n'): comps = re.sub(r"\s+", " ", line).split() parens = re.findall(r'\((.*?)\)', line, re.DOTALL) if len(parens) > 1: nod = __salt...
[ "def", "_active_mounts_openbsd", "(", "ret", ")", ":", "for", "line", "in", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "'mount -v'", ")", ".", "split", "(", "'\\n'", ")", ":", "comps", "=", "re", ".", "sub", "(", "r\"\\s+\"", ",", "\" \"", ",", "li...
List active mounts on OpenBSD systems
[ "List", "active", "mounts", "on", "OpenBSD", "systems" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L179-L199
33,611
saltstack/salt
salt/modules/mount.py
_active_mounts_darwin
def _active_mounts_darwin(ret): ''' List active mounts on Mac OS systems ''' for line in __salt__['cmd.run_stdout']('mount').split('\n'): comps = re.sub(r"\s+", " ", line).split() parens = re.findall(r'\((.*?)\)', line, re.DOTALL)[0].split(", ") ret[comps[2]] = {'device': comps[0...
python
def _active_mounts_darwin(ret): ''' List active mounts on Mac OS systems ''' for line in __salt__['cmd.run_stdout']('mount').split('\n'): comps = re.sub(r"\s+", " ", line).split() parens = re.findall(r'\((.*?)\)', line, re.DOTALL)[0].split(", ") ret[comps[2]] = {'device': comps[0...
[ "def", "_active_mounts_darwin", "(", "ret", ")", ":", "for", "line", "in", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "'mount'", ")", ".", "split", "(", "'\\n'", ")", ":", "comps", "=", "re", ".", "sub", "(", "r\"\\s+\"", ",", "\" \"", ",", "line",...
List active mounts on Mac OS systems
[ "List", "active", "mounts", "on", "Mac", "OS", "systems" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L202-L212
33,612
saltstack/salt
salt/modules/mount.py
_resolve_user_group_names
def _resolve_user_group_names(opts): ''' Resolve user and group names in related opts ''' name_id_opts = {'uid': 'user.info', 'gid': 'group.info'} for ind, opt in enumerate(opts): if opt.split('=')[0] in name_id_opts: _givenid = opt.split('=')[1] _...
python
def _resolve_user_group_names(opts): ''' Resolve user and group names in related opts ''' name_id_opts = {'uid': 'user.info', 'gid': 'group.info'} for ind, opt in enumerate(opts): if opt.split('=')[0] in name_id_opts: _givenid = opt.split('=')[1] _...
[ "def", "_resolve_user_group_names", "(", "opts", ")", ":", "name_id_opts", "=", "{", "'uid'", ":", "'user.info'", ",", "'gid'", ":", "'group.info'", "}", "for", "ind", ",", "opt", "in", "enumerate", "(", "opts", ")", ":", "if", "opt", ".", "split", "(", ...
Resolve user and group names in related opts
[ "Resolve", "user", "and", "group", "names", "in", "related", "opts" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L215-L232
33,613
saltstack/salt
salt/modules/mount.py
active
def active(extended=False): ''' List the active mounts. CLI Example: .. code-block:: bash salt '*' mount.active ''' ret = {} if __grains__['os'] == 'FreeBSD': _active_mounts_freebsd(ret) elif 'AIX' in __grains__['kernel']: _active_mounts_aix(ret) elif __gra...
python
def active(extended=False): ''' List the active mounts. CLI Example: .. code-block:: bash salt '*' mount.active ''' ret = {} if __grains__['os'] == 'FreeBSD': _active_mounts_freebsd(ret) elif 'AIX' in __grains__['kernel']: _active_mounts_aix(ret) elif __gra...
[ "def", "active", "(", "extended", "=", "False", ")", ":", "ret", "=", "{", "}", "if", "__grains__", "[", "'os'", "]", "==", "'FreeBSD'", ":", "_active_mounts_freebsd", "(", "ret", ")", "elif", "'AIX'", "in", "__grains__", "[", "'kernel'", "]", ":", "_a...
List the active mounts. CLI Example: .. code-block:: bash salt '*' mount.active
[ "List", "the", "active", "mounts", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L235-L264
33,614
saltstack/salt
salt/modules/mount.py
set_fstab
def set_fstab( name, device, fstype, opts='defaults', dump=0, pass_num=0, config='/etc/fstab', test=False, match_on='auto', **kwargs): ''' Verify that this mount is represented in the fstab, change the mount to match the data pa...
python
def set_fstab( name, device, fstype, opts='defaults', dump=0, pass_num=0, config='/etc/fstab', test=False, match_on='auto', **kwargs): ''' Verify that this mount is represented in the fstab, change the mount to match the data pa...
[ "def", "set_fstab", "(", "name", ",", "device", ",", "fstype", ",", "opts", "=", "'defaults'", ",", "dump", "=", "0", ",", "pass_num", "=", "0", ",", "config", "=", "'/etc/fstab'", ",", "test", "=", "False", ",", "match_on", "=", "'auto'", ",", "*", ...
Verify that this mount is represented in the fstab, change the mount to match the data passed, or add the mount if it is not present. CLI Example: .. code-block:: bash salt '*' mount.set_fstab /mnt/foo /dev/sdz1 ext4
[ "Verify", "that", "this", "mount", "is", "represented", "in", "the", "fstab", "change", "the", "mount", "to", "match", "the", "data", "passed", "or", "add", "the", "mount", "if", "it", "is", "not", "present", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L704-L826
33,615
saltstack/salt
salt/modules/mount.py
rm_automaster
def rm_automaster(name, device, config='/etc/auto_salt'): ''' Remove the mount point from the auto_master CLI Example: .. code-block:: bash salt '*' mount.rm_automaster /mnt/foo /dev/sdg ''' contents = automaster(config) if name not in contents: return True # The entry...
python
def rm_automaster(name, device, config='/etc/auto_salt'): ''' Remove the mount point from the auto_master CLI Example: .. code-block:: bash salt '*' mount.rm_automaster /mnt/foo /dev/sdg ''' contents = automaster(config) if name not in contents: return True # The entry...
[ "def", "rm_automaster", "(", "name", ",", "device", ",", "config", "=", "'/etc/auto_salt'", ")", ":", "contents", "=", "automaster", "(", "config", ")", "if", "name", "not", "in", "contents", ":", "return", "True", "# The entry is present, get rid of it", "lines...
Remove the mount point from the auto_master CLI Example: .. code-block:: bash salt '*' mount.rm_automaster /mnt/foo /dev/sdg
[ "Remove", "the", "mount", "point", "from", "the", "auto_master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L958-L1016
33,616
saltstack/salt
salt/modules/mount.py
automaster
def automaster(config='/etc/auto_salt'): ''' List the contents of the auto master CLI Example: .. code-block:: bash salt '*' mount.automaster ''' ret = {} if not os.path.isfile(config): return ret with salt.utils.files.fopen(config) as ifile: for line in ifile:...
python
def automaster(config='/etc/auto_salt'): ''' List the contents of the auto master CLI Example: .. code-block:: bash salt '*' mount.automaster ''' ret = {} if not os.path.isfile(config): return ret with salt.utils.files.fopen(config) as ifile: for line in ifile:...
[ "def", "automaster", "(", "config", "=", "'/etc/auto_salt'", ")", ":", "ret", "=", "{", "}", "if", "not", "os", ".", "path", ".", "isfile", "(", "config", ")", ":", "return", "ret", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "co...
List the contents of the auto master CLI Example: .. code-block:: bash salt '*' mount.automaster
[ "List", "the", "contents", "of", "the", "auto", "master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1139-L1174
33,617
saltstack/salt
salt/modules/mount.py
mount
def mount(name, device, mkmnt=False, fstype='', opts='defaults', user=None, util='mount'): ''' Mount a device CLI Example: .. code-block:: bash salt '*' mount.mount /mnt/foo /dev/sdz1 True ''' if util != 'mount': # This functionality used to live in img.mount_image if ...
python
def mount(name, device, mkmnt=False, fstype='', opts='defaults', user=None, util='mount'): ''' Mount a device CLI Example: .. code-block:: bash salt '*' mount.mount /mnt/foo /dev/sdz1 True ''' if util != 'mount': # This functionality used to live in img.mount_image if ...
[ "def", "mount", "(", "name", ",", "device", ",", "mkmnt", "=", "False", ",", "fstype", "=", "''", ",", "opts", "=", "'defaults'", ",", "user", "=", "None", ",", "util", "=", "'mount'", ")", ":", "if", "util", "!=", "'mount'", ":", "# This functionali...
Mount a device CLI Example: .. code-block:: bash salt '*' mount.mount /mnt/foo /dev/sdz1 True
[ "Mount", "a", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1177-L1230
33,618
saltstack/salt
salt/modules/mount.py
remount
def remount(name, device, mkmnt=False, fstype='', opts='defaults', user=None): ''' Attempt to remount a device, if the device is not already mounted, mount is called CLI Example: .. code-block:: bash salt '*' mount.remount /mnt/foo /dev/sdz1 True ''' force_mount = False if __g...
python
def remount(name, device, mkmnt=False, fstype='', opts='defaults', user=None): ''' Attempt to remount a device, if the device is not already mounted, mount is called CLI Example: .. code-block:: bash salt '*' mount.remount /mnt/foo /dev/sdz1 True ''' force_mount = False if __g...
[ "def", "remount", "(", "name", ",", "device", ",", "mkmnt", "=", "False", ",", "fstype", "=", "''", ",", "opts", "=", "'defaults'", ",", "user", "=", "None", ")", ":", "force_mount", "=", "False", "if", "__grains__", "[", "'os'", "]", "in", "[", "'...
Attempt to remount a device, if the device is not already mounted, mount is called CLI Example: .. code-block:: bash salt '*' mount.remount /mnt/foo /dev/sdz1 True
[ "Attempt", "to", "remount", "a", "device", "if", "the", "device", "is", "not", "already", "mounted", "mount", "is", "called" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1233-L1288
33,619
saltstack/salt
salt/modules/mount.py
umount
def umount(name, device=None, user=None, util='mount'): ''' Attempt to unmount a device by specifying the directory it is mounted on CLI Example: .. code-block:: bash salt '*' mount.umount /mnt/foo .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' mount.umount /mnt/fo...
python
def umount(name, device=None, user=None, util='mount'): ''' Attempt to unmount a device by specifying the directory it is mounted on CLI Example: .. code-block:: bash salt '*' mount.umount /mnt/foo .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' mount.umount /mnt/fo...
[ "def", "umount", "(", "name", ",", "device", "=", "None", ",", "user", "=", "None", ",", "util", "=", "'mount'", ")", ":", "if", "util", "!=", "'mount'", ":", "# This functionality used to live in img.umount_image", "if", "'qemu_nbd.clear'", "in", "__salt__", ...
Attempt to unmount a device by specifying the directory it is mounted on CLI Example: .. code-block:: bash salt '*' mount.umount /mnt/foo .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' mount.umount /mnt/foo /dev/xvdc1
[ "Attempt", "to", "unmount", "a", "device", "by", "specifying", "the", "directory", "it", "is", "mounted", "on" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1291-L1324
33,620
saltstack/salt
salt/modules/mount.py
is_fuse_exec
def is_fuse_exec(cmd): ''' Returns true if the command passed is a fuse mountable application. CLI Example: .. code-block:: bash salt '*' mount.is_fuse_exec sshfs ''' cmd_path = salt.utils.path.which(cmd) # No point in running ldd on a command that doesn't exist if not cmd_pa...
python
def is_fuse_exec(cmd): ''' Returns true if the command passed is a fuse mountable application. CLI Example: .. code-block:: bash salt '*' mount.is_fuse_exec sshfs ''' cmd_path = salt.utils.path.which(cmd) # No point in running ldd on a command that doesn't exist if not cmd_pa...
[ "def", "is_fuse_exec", "(", "cmd", ")", ":", "cmd_path", "=", "salt", ".", "utils", ".", "path", ".", "which", "(", "cmd", ")", "# No point in running ldd on a command that doesn't exist", "if", "not", "cmd_path", ":", "return", "False", "elif", "not", "salt", ...
Returns true if the command passed is a fuse mountable application. CLI Example: .. code-block:: bash salt '*' mount.is_fuse_exec sshfs
[ "Returns", "true", "if", "the", "command", "passed", "is", "a", "fuse", "mountable", "application", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1327-L1346
33,621
saltstack/salt
salt/modules/mount.py
swaps
def swaps(): ''' Return a dict containing information on active swap .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swaps ''' ret = {} if __grains__['kernel'] == 'SunOS': for line in __salt__['cmd.run_stdout']('swap -l').splitlines(): ...
python
def swaps(): ''' Return a dict containing information on active swap .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swaps ''' ret = {} if __grains__['kernel'] == 'SunOS': for line in __salt__['cmd.run_stdout']('swap -l').splitlines(): ...
[ "def", "swaps", "(", ")", ":", "ret", "=", "{", "}", "if", "__grains__", "[", "'kernel'", "]", "==", "'SunOS'", ":", "for", "line", "in", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "'swap -l'", ")", ".", "splitlines", "(", ")", ":", "if", "line",...
Return a dict containing information on active swap .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swaps
[ "Return", "a", "dict", "containing", "information", "on", "active", "swap" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1349-L1405
33,622
saltstack/salt
salt/modules/mount.py
swapon
def swapon(name, priority=None): ''' Activate a swap disk .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swapon /root/swapfile ''' ret = {} on_ = swaps() if name in on_: ret['stats'] = on_[name] ret['new'] = False ret...
python
def swapon(name, priority=None): ''' Activate a swap disk .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swapon /root/swapfile ''' ret = {} on_ = swaps() if name in on_: ret['stats'] = on_[name] ret['new'] = False ret...
[ "def", "swapon", "(", "name", ",", "priority", "=", "None", ")", ":", "ret", "=", "{", "}", "on_", "=", "swaps", "(", ")", "if", "name", "in", "on_", ":", "ret", "[", "'stats'", "]", "=", "on_", "[", "name", "]", "ret", "[", "'new'", "]", "="...
Activate a swap disk .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swapon /root/swapfile
[ "Activate", "a", "swap", "disk" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1408-L1444
33,623
saltstack/salt
salt/modules/mount.py
swapoff
def swapoff(name): ''' Deactivate a named swap mount .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swapoff /root/swapfile ''' on_ = swaps() if name in on_: if __grains__['kernel'] == 'SunOS': if __grains__['virtual'] != 'zon...
python
def swapoff(name): ''' Deactivate a named swap mount .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swapoff /root/swapfile ''' on_ = swaps() if name in on_: if __grains__['kernel'] == 'SunOS': if __grains__['virtual'] != 'zon...
[ "def", "swapoff", "(", "name", ")", ":", "on_", "=", "swaps", "(", ")", "if", "name", "in", "on_", ":", "if", "__grains__", "[", "'kernel'", "]", "==", "'SunOS'", ":", "if", "__grains__", "[", "'virtual'", "]", "!=", "'zone'", ":", "__salt__", "[", ...
Deactivate a named swap mount .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swapoff /root/swapfile
[ "Deactivate", "a", "named", "swap", "mount" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1447-L1475
33,624
saltstack/salt
salt/modules/mount.py
_filesystems
def _filesystems(config='/etc/filesystems', leading_key=True): ''' Return the contents of the filesystems in an OrderedDict config File containing filesystem infomation leading_key True return dictionary keyed by 'name' and value as dictionary with other keys, values (name excluded)...
python
def _filesystems(config='/etc/filesystems', leading_key=True): ''' Return the contents of the filesystems in an OrderedDict config File containing filesystem infomation leading_key True return dictionary keyed by 'name' and value as dictionary with other keys, values (name excluded)...
[ "def", "_filesystems", "(", "config", "=", "'/etc/filesystems'", ",", "leading_key", "=", "True", ")", ":", "ret", "=", "OrderedDict", "(", ")", "lines", "=", "[", "]", "parsing_block", "=", "False", "if", "not", "os", ".", "path", ".", "isfile", "(", ...
Return the contents of the filesystems in an OrderedDict config File containing filesystem infomation leading_key True return dictionary keyed by 'name' and value as dictionary with other keys, values (name excluded) OrderedDict({ '/dir' : OrderedDict({'dev': '/dev/hd8', ......
[ "Return", "the", "contents", "of", "the", "filesystems", "in", "an", "OrderedDict" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1585-L1639
33,625
saltstack/salt
salt/modules/mount.py
_fstab_entry.pick
def pick(self, keys): ''' Returns an instance with just those keys ''' subset = dict([(key, self.criteria[key]) for key in keys]) return self.__class__(**subset)
python
def pick(self, keys): ''' Returns an instance with just those keys ''' subset = dict([(key, self.criteria[key]) for key in keys]) return self.__class__(**subset)
[ "def", "pick", "(", "self", ",", "keys", ")", ":", "subset", "=", "dict", "(", "[", "(", "key", ",", "self", ".", "criteria", "[", "key", "]", ")", "for", "key", "in", "keys", "]", ")", "return", "self", ".", "__class__", "(", "*", "*", "subset...
Returns an instance with just those keys
[ "Returns", "an", "instance", "with", "just", "those", "keys" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L323-L328
33,626
saltstack/salt
salt/modules/mount.py
_fstab_entry.match
def match(self, line): ''' Compare potentially partial criteria against line ''' entry = self.dict_from_line(line) for key, value in six.iteritems(self.criteria): if entry[key] != value: return False return True
python
def match(self, line): ''' Compare potentially partial criteria against line ''' entry = self.dict_from_line(line) for key, value in six.iteritems(self.criteria): if entry[key] != value: return False return True
[ "def", "match", "(", "self", ",", "line", ")", ":", "entry", "=", "self", ".", "dict_from_line", "(", "line", ")", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "self", ".", "criteria", ")", ":", "if", "entry", "[", "key", "]", ...
Compare potentially partial criteria against line
[ "Compare", "potentially", "partial", "criteria", "against", "line" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L345-L353
33,627
saltstack/salt
salt/modules/mount.py
_FileSystemsEntry.match
def match(self, fsys_view): ''' Compare potentially partial criteria against built filesystems entry dictionary ''' evalue_dict = fsys_view[1] for key, value in six.viewitems(self.criteria): if key in evalue_dict: if evalue_dict[key] != value: ...
python
def match(self, fsys_view): ''' Compare potentially partial criteria against built filesystems entry dictionary ''' evalue_dict = fsys_view[1] for key, value in six.viewitems(self.criteria): if key in evalue_dict: if evalue_dict[key] != value: ...
[ "def", "match", "(", "self", ",", "fsys_view", ")", ":", "evalue_dict", "=", "fsys_view", "[", "1", "]", "for", "key", ",", "value", "in", "six", ".", "viewitems", "(", "self", ".", "criteria", ")", ":", "if", "key", "in", "evalue_dict", ":", "if", ...
Compare potentially partial criteria against built filesystems entry dictionary
[ "Compare", "potentially", "partial", "criteria", "against", "built", "filesystems", "entry", "dictionary" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L557-L568
33,628
saltstack/salt
salt/utils/napalm.py
loaded_ret
def loaded_ret(ret, loaded, test, debug, compliance_report=False, opts=None): ''' Return the final state output. ret The initial state output structure. loaded The loaded dictionary. ''' # Always get the comment changes = {} ret['comment'] = loaded['comment'] if 'diff...
python
def loaded_ret(ret, loaded, test, debug, compliance_report=False, opts=None): ''' Return the final state output. ret The initial state output structure. loaded The loaded dictionary. ''' # Always get the comment changes = {} ret['comment'] = loaded['comment'] if 'diff...
[ "def", "loaded_ret", "(", "ret", ",", "loaded", ",", "test", ",", "debug", ",", "compliance_report", "=", "False", ",", "opts", "=", "None", ")", ":", "# Always get the comment", "changes", "=", "{", "}", "ret", "[", "'comment'", "]", "=", "loaded", "[",...
Return the final state output. ret The initial state output structure. loaded The loaded dictionary.
[ "Return", "the", "final", "state", "output", ".", "ret", "The", "initial", "state", "output", "structure", ".", "loaded", "The", "loaded", "dictionary", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/napalm.py#L502-L553
33,629
saltstack/salt
salt/engines/webhook.py
start
def start(address=None, port=5000, ssl_crt=None, ssl_key=None): ''' Api to listen for webhooks to send to the reactor. Implement the webhook behavior in an engine. :py:class:`rest_cherrypy Webhook docs <salt.netapi.rest_cherrypy.app.Webhook>` Unlike the rest_cherrypy Webhook, this is only an unaut...
python
def start(address=None, port=5000, ssl_crt=None, ssl_key=None): ''' Api to listen for webhooks to send to the reactor. Implement the webhook behavior in an engine. :py:class:`rest_cherrypy Webhook docs <salt.netapi.rest_cherrypy.app.Webhook>` Unlike the rest_cherrypy Webhook, this is only an unaut...
[ "def", "start", "(", "address", "=", "None", ",", "port", "=", "5000", ",", "ssl_crt", "=", "None", ",", "ssl_key", "=", "None", ")", ":", "if", "__opts__", ".", "get", "(", "'__role'", ")", "==", "'master'", ":", "fire_master", "=", "salt", ".", "...
Api to listen for webhooks to send to the reactor. Implement the webhook behavior in an engine. :py:class:`rest_cherrypy Webhook docs <salt.netapi.rest_cherrypy.app.Webhook>` Unlike the rest_cherrypy Webhook, this is only an unauthenticated webhook endpoint. If an authenticated webhook endpoint is ne...
[ "Api", "to", "listen", "for", "webhooks", "to", "send", "to", "the", "reactor", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/webhook.py#L17-L88
33,630
saltstack/salt
salt/states/win_wua.py
installed
def installed(name, updates=None): ''' Ensure Microsoft Updates are installed. Updates will be downloaded if needed. Args: name (str): The identifier of a single update to install. updates (list): A list of identifiers for updates to be installed. Overrides ...
python
def installed(name, updates=None): ''' Ensure Microsoft Updates are installed. Updates will be downloaded if needed. Args: name (str): The identifier of a single update to install. updates (list): A list of identifiers for updates to be installed. Overrides ...
[ "def", "installed", "(", "name", ",", "updates", "=", "None", ")", ":", "if", "isinstance", "(", "updates", ",", "six", ".", "string_types", ")", ":", "updates", "=", "[", "updates", "]", "if", "not", "updates", ":", "updates", "=", "name", "ret", "=...
Ensure Microsoft Updates are installed. Updates will be downloaded if needed. Args: name (str): The identifier of a single update to install. updates (list): A list of identifiers for updates to be installed. Overrides ``name``. Default is None. .. not...
[ "Ensure", "Microsoft", "Updates", "are", "installed", ".", "Updates", "will", "be", "downloaded", "if", "needed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_wua.py#L80-L211
33,631
saltstack/salt
salt/states/win_wua.py
removed
def removed(name, updates=None): ''' Ensure Microsoft Updates are uninstalled. Args: name (str): The identifier of a single update to uninstall. updates (list): A list of identifiers for updates to be removed. Overrides ``name``. Default is None. ....
python
def removed(name, updates=None): ''' Ensure Microsoft Updates are uninstalled. Args: name (str): The identifier of a single update to uninstall. updates (list): A list of identifiers for updates to be removed. Overrides ``name``. Default is None. ....
[ "def", "removed", "(", "name", ",", "updates", "=", "None", ")", ":", "if", "isinstance", "(", "updates", ",", "six", ".", "string_types", ")", ":", "updates", "=", "[", "updates", "]", "if", "not", "updates", ":", "updates", "=", "name", "ret", "=",...
Ensure Microsoft Updates are uninstalled. Args: name (str): The identifier of a single update to uninstall. updates (list): A list of identifiers for updates to be removed. Overrides ``name``. Default is None. .. note:: Identifiers can be the GUID, the KB ...
[ "Ensure", "Microsoft", "Updates", "are", "uninstalled", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_wua.py#L214-L335
33,632
saltstack/salt
salt/states/win_wua.py
uptodate
def uptodate(name, software=True, drivers=False, skip_hidden=False, skip_mandatory=False, skip_reboot=True, categories=None, severities=None,): ''' Ensure Microsoft Updates that match the passed criteria are installed. ...
python
def uptodate(name, software=True, drivers=False, skip_hidden=False, skip_mandatory=False, skip_reboot=True, categories=None, severities=None,): ''' Ensure Microsoft Updates that match the passed criteria are installed. ...
[ "def", "uptodate", "(", "name", ",", "software", "=", "True", ",", "drivers", "=", "False", ",", "skip_hidden", "=", "False", ",", "skip_mandatory", "=", "False", ",", "skip_reboot", "=", "True", ",", "categories", "=", "None", ",", "severities", "=", "N...
Ensure Microsoft Updates that match the passed criteria are installed. Updates will be downloaded if needed. This state allows you to update a system without specifying a specific update to apply. All matching updates will be installed. Args: name (str): The name has no functional...
[ "Ensure", "Microsoft", "Updates", "that", "match", "the", "passed", "criteria", "are", "installed", ".", "Updates", "will", "be", "downloaded", "if", "needed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_wua.py#L338-L504
33,633
saltstack/salt
salt/log/handlers/fluent_mod.py
MessageFormatter.format_graylog_v0
def format_graylog_v0(self, record): ''' Graylog 'raw' format is essentially the raw record, minimally munged to provide the bare minimum that td-agent requires to accept and route the event. This is well suited to a config where the client td-agents log directly to Graylog. '''...
python
def format_graylog_v0(self, record): ''' Graylog 'raw' format is essentially the raw record, minimally munged to provide the bare minimum that td-agent requires to accept and route the event. This is well suited to a config where the client td-agents log directly to Graylog. '''...
[ "def", "format_graylog_v0", "(", "self", ",", "record", ")", ":", "message_dict", "=", "{", "'message'", ":", "record", ".", "getMessage", "(", ")", ",", "'timestamp'", ":", "self", ".", "formatTime", "(", "record", ")", ",", "# Graylog uses syslog levels, not...
Graylog 'raw' format is essentially the raw record, minimally munged to provide the bare minimum that td-agent requires to accept and route the event. This is well suited to a config where the client td-agents log directly to Graylog.
[ "Graylog", "raw", "format", "is", "essentially", "the", "raw", "record", "minimally", "munged", "to", "provide", "the", "bare", "minimum", "that", "td", "-", "agent", "requires", "to", "accept", "and", "route", "the", "event", ".", "This", "is", "well", "s...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/fluent_mod.py#L218-L249
33,634
saltstack/salt
salt/log/handlers/fluent_mod.py
MessageFormatter.format_logstash_v0
def format_logstash_v0(self, record): ''' Messages are formatted in logstash's expected format. ''' host = salt.utils.network.get_fqhostname() message_dict = { '@timestamp': self.formatTime(record), '@fields': { 'levelname': record.levelnam...
python
def format_logstash_v0(self, record): ''' Messages are formatted in logstash's expected format. ''' host = salt.utils.network.get_fqhostname() message_dict = { '@timestamp': self.formatTime(record), '@fields': { 'levelname': record.levelnam...
[ "def", "format_logstash_v0", "(", "self", ",", "record", ")", ":", "host", "=", "salt", ".", "utils", ".", "network", ".", "get_fqhostname", "(", ")", "message_dict", "=", "{", "'@timestamp'", ":", "self", ".", "formatTime", "(", "record", ")", ",", "'@f...
Messages are formatted in logstash's expected format.
[ "Messages", "are", "formatted", "in", "logstash", "s", "expected", "format", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/fluent_mod.py#L286-L339
33,635
saltstack/salt
salt/wheel/minions.py
connected
def connected(): ''' List all connected minions on a salt-master ''' opts = salt.config.master_config(__opts__['conf_file']) if opts.get('con_cache'): cache_cli = CacheCli(opts) minions = cache_cli.get_cached() else: minions = list(salt.utils.minions.CkMinions(opts).conn...
python
def connected(): ''' List all connected minions on a salt-master ''' opts = salt.config.master_config(__opts__['conf_file']) if opts.get('con_cache'): cache_cli = CacheCli(opts) minions = cache_cli.get_cached() else: minions = list(salt.utils.minions.CkMinions(opts).conn...
[ "def", "connected", "(", ")", ":", "opts", "=", "salt", ".", "config", ".", "master_config", "(", "__opts__", "[", "'conf_file'", "]", ")", "if", "opts", ".", "get", "(", "'con_cache'", ")", ":", "cache_cli", "=", "CacheCli", "(", "opts", ")", "minions...
List all connected minions on a salt-master
[ "List", "all", "connected", "minions", "on", "a", "salt", "-", "master" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/wheel/minions.py#L15-L26
33,636
saltstack/salt
salt/cloud/clouds/digitalocean.py
query
def query(method='droplets', droplet_id=None, command=None, args=None, http_method='get'): ''' Make a web call to DigitalOcean ''' base_path = six.text_type(config.get_cloud_config_value( 'api_root', get_configured_provider(), __opts__, search_global=False, defaul...
python
def query(method='droplets', droplet_id=None, command=None, args=None, http_method='get'): ''' Make a web call to DigitalOcean ''' base_path = six.text_type(config.get_cloud_config_value( 'api_root', get_configured_provider(), __opts__, search_global=False, defaul...
[ "def", "query", "(", "method", "=", "'droplets'", ",", "droplet_id", "=", "None", ",", "command", "=", "None", ",", "args", "=", "None", ",", "http_method", "=", "'get'", ")", ":", "base_path", "=", "six", ".", "text_type", "(", "config", ".", "get_clo...
Make a web call to DigitalOcean
[ "Make", "a", "web", "call", "to", "DigitalOcean" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L549-L604
33,637
saltstack/salt
salt/cloud/clouds/digitalocean.py
show_instance
def show_instance(name, call=None): ''' Show the details from DigitalOcean concerning a droplet ''' if call != 'action': raise SaltCloudSystemExit( 'The show_instance action must be called with -a or --action.' ) node = _get_node(name) __utils__['cloud.cache_node'](no...
python
def show_instance(name, call=None): ''' Show the details from DigitalOcean concerning a droplet ''' if call != 'action': raise SaltCloudSystemExit( 'The show_instance action must be called with -a or --action.' ) node = _get_node(name) __utils__['cloud.cache_node'](no...
[ "def", "show_instance", "(", "name", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_instance action must be called with -a or --action.'", ")", "node", "=", "_get_node", "(", "name", ")", "_...
Show the details from DigitalOcean concerning a droplet
[ "Show", "the", "details", "from", "DigitalOcean", "concerning", "a", "droplet" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L622-L632
33,638
saltstack/salt
salt/cloud/clouds/digitalocean.py
show_keypair
def show_keypair(kwargs=None, call=None): ''' Show the details of an SSH keypair ''' if call != 'function': log.error( 'The show_keypair function must be called with -f or --function.' ) return False if not kwargs: kwargs = {} if 'keyname' not in kwa...
python
def show_keypair(kwargs=None, call=None): ''' Show the details of an SSH keypair ''' if call != 'function': log.error( 'The show_keypair function must be called with -f or --function.' ) return False if not kwargs: kwargs = {} if 'keyname' not in kwa...
[ "def", "show_keypair", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "log", ".", "error", "(", "'The show_keypair function must be called with -f or --function.'", ")", "return", "False", "if", "not", "kwa...
Show the details of an SSH keypair
[ "Show", "the", "details", "of", "an", "SSH", "keypair" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L694-L717
33,639
saltstack/salt
salt/cloud/clouds/digitalocean.py
import_keypair
def import_keypair(kwargs=None, call=None): ''' Upload public key to cloud provider. Similar to EC2 import_keypair. .. versionadded:: 2016.11.0 kwargs file(mandatory): public key file-name keyname(mandatory): public key name in the provider ''' with salt.utils.files.fopen(k...
python
def import_keypair(kwargs=None, call=None): ''' Upload public key to cloud provider. Similar to EC2 import_keypair. .. versionadded:: 2016.11.0 kwargs file(mandatory): public key file-name keyname(mandatory): public key name in the provider ''' with salt.utils.files.fopen(k...
[ "def", "import_keypair", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "kwargs", "[", "'file'", "]", ",", "'r'", ")", "as", "public_key_filename", ":", "public_key_content",...
Upload public key to cloud provider. Similar to EC2 import_keypair. .. versionadded:: 2016.11.0 kwargs file(mandatory): public key file-name keyname(mandatory): public key name in the provider
[ "Upload", "public", "key", "to", "cloud", "provider", ".", "Similar", "to", "EC2", "import_keypair", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L720-L740
33,640
saltstack/salt
salt/cloud/clouds/digitalocean.py
create_key
def create_key(kwargs=None, call=None): ''' Upload a public key ''' if call != 'function': log.error( 'The create_key function must be called with -f or --function.' ) return False try: result = query( method='account', command='ke...
python
def create_key(kwargs=None, call=None): ''' Upload a public key ''' if call != 'function': log.error( 'The create_key function must be called with -f or --function.' ) return False try: result = query( method='account', command='ke...
[ "def", "create_key", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "log", ".", "error", "(", "'The create_key function must be called with -f or --function.'", ")", "return", "False", "try", ":", "result",...
Upload a public key
[ "Upload", "a", "public", "key" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L743-L765
33,641
saltstack/salt
salt/cloud/clouds/digitalocean.py
get_keyid
def get_keyid(keyname): ''' Return the ID of the keyname ''' if not keyname: return None keypairs = list_keypairs(call='function') keyid = keypairs[keyname]['id'] if keyid: return keyid raise SaltCloudNotFound('The specified ssh key could not be found.')
python
def get_keyid(keyname): ''' Return the ID of the keyname ''' if not keyname: return None keypairs = list_keypairs(call='function') keyid = keypairs[keyname]['id'] if keyid: return keyid raise SaltCloudNotFound('The specified ssh key could not be found.')
[ "def", "get_keyid", "(", "keyname", ")", ":", "if", "not", "keyname", ":", "return", "None", "keypairs", "=", "list_keypairs", "(", "call", "=", "'function'", ")", "keyid", "=", "keypairs", "[", "keyname", "]", "[", "'id'", "]", "if", "keyid", ":", "re...
Return the ID of the keyname
[ "Return", "the", "ID", "of", "the", "keyname" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L791-L801
33,642
saltstack/salt
salt/cloud/clouds/digitalocean.py
post_dns_record
def post_dns_record(**kwargs): ''' Creates a DNS record for the given name if the domain is managed with DO. ''' if 'kwargs' in kwargs: # flatten kwargs if called via salt-cloud -f f_kwargs = kwargs['kwargs'] del kwargs['kwargs'] kwargs.update(f_kwargs) mandatory_kwargs = ('...
python
def post_dns_record(**kwargs): ''' Creates a DNS record for the given name if the domain is managed with DO. ''' if 'kwargs' in kwargs: # flatten kwargs if called via salt-cloud -f f_kwargs = kwargs['kwargs'] del kwargs['kwargs'] kwargs.update(f_kwargs) mandatory_kwargs = ('...
[ "def", "post_dns_record", "(", "*", "*", "kwargs", ")", ":", "if", "'kwargs'", "in", "kwargs", ":", "# flatten kwargs if called via salt-cloud -f", "f_kwargs", "=", "kwargs", "[", "'kwargs'", "]", "del", "kwargs", "[", "'kwargs'", "]", "kwargs", ".", "update", ...
Creates a DNS record for the given name if the domain is managed with DO.
[ "Creates", "a", "DNS", "record", "for", "the", "given", "name", "if", "the", "domain", "is", "managed", "with", "DO", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L874-L902
33,643
saltstack/salt
salt/cloud/clouds/digitalocean.py
destroy_dns_records
def destroy_dns_records(fqdn): ''' Deletes DNS records for the given hostname if the domain is managed with DO. ''' domain = '.'.join(fqdn.split('.')[-2:]) hostname = '.'.join(fqdn.split('.')[:-2]) # TODO: remove this when the todo on 754 is available try: response = query(method='do...
python
def destroy_dns_records(fqdn): ''' Deletes DNS records for the given hostname if the domain is managed with DO. ''' domain = '.'.join(fqdn.split('.')[-2:]) hostname = '.'.join(fqdn.split('.')[:-2]) # TODO: remove this when the todo on 754 is available try: response = query(method='do...
[ "def", "destroy_dns_records", "(", "fqdn", ")", ":", "domain", "=", "'.'", ".", "join", "(", "fqdn", ".", "split", "(", "'.'", ")", "[", "-", "2", ":", "]", ")", "hostname", "=", "'.'", ".", "join", "(", "fqdn", ".", "split", "(", "'.'", ")", "...
Deletes DNS records for the given hostname if the domain is managed with DO.
[ "Deletes", "DNS", "records", "for", "the", "given", "hostname", "if", "the", "domain", "is", "managed", "with", "DO", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L905-L936
33,644
saltstack/salt
salt/cloud/clouds/digitalocean.py
show_floating_ip
def show_floating_ip(kwargs=None, call=None): ''' Show the details of a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f show_floating_ip my-digitalocean-config floating_ip='45.55.96.47' ''' if call != 'function': log.error( ...
python
def show_floating_ip(kwargs=None, call=None): ''' Show the details of a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f show_floating_ip my-digitalocean-config floating_ip='45.55.96.47' ''' if call != 'function': log.error( ...
[ "def", "show_floating_ip", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "log", ".", "error", "(", "'The show_floating_ip function must be called with -f or --function.'", ")", "return", "False", "if", "not"...
Show the details of a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f show_floating_ip my-digitalocean-config floating_ip='45.55.96.47'
[ "Show", "the", "details", "of", "a", "floating", "IP" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1018-L1048
33,645
saltstack/salt
salt/cloud/clouds/digitalocean.py
create_floating_ip
def create_floating_ip(kwargs=None, call=None): ''' Create a new floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f create_floating_ip my-digitalocean-config region='NYC2' salt-cloud -f create_floating_ip my-digitalocean-config droplet_id='12...
python
def create_floating_ip(kwargs=None, call=None): ''' Create a new floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f create_floating_ip my-digitalocean-config region='NYC2' salt-cloud -f create_floating_ip my-digitalocean-config droplet_id='12...
[ "def", "create_floating_ip", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "log", ".", "error", "(", "'The create_floating_ip function must be called with -f or --function.'", ")", "return", "False", "if", "...
Create a new floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f create_floating_ip my-digitalocean-config region='NYC2' salt-cloud -f create_floating_ip my-digitalocean-config droplet_id='1234567'
[ "Create", "a", "new", "floating", "IP" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1051-L1090
33,646
saltstack/salt
salt/cloud/clouds/digitalocean.py
delete_floating_ip
def delete_floating_ip(kwargs=None, call=None): ''' Delete a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f delete_floating_ip my-digitalocean-config floating_ip='45.55.96.47' ''' if call != 'function': log.error( 'The ...
python
def delete_floating_ip(kwargs=None, call=None): ''' Delete a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f delete_floating_ip my-digitalocean-config floating_ip='45.55.96.47' ''' if call != 'function': log.error( 'The ...
[ "def", "delete_floating_ip", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "log", ".", "error", "(", "'The delete_floating_ip function must be called with -f or --function.'", ")", "return", "False", "if", "...
Delete a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f delete_floating_ip my-digitalocean-config floating_ip='45.55.96.47'
[ "Delete", "a", "floating", "IP" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1093-L1125
33,647
saltstack/salt
salt/cloud/clouds/digitalocean.py
unassign_floating_ip
def unassign_floating_ip(kwargs=None, call=None): ''' Unassign a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f unassign_floating_ip my-digitalocean-config floating_ip='45.55.96.47' ''' if call != 'function': log.error( ...
python
def unassign_floating_ip(kwargs=None, call=None): ''' Unassign a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f unassign_floating_ip my-digitalocean-config floating_ip='45.55.96.47' ''' if call != 'function': log.error( ...
[ "def", "unassign_floating_ip", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "log", ".", "error", "(", "'The inassign_floating_ip function must be called with -f or --function.'", ")", "return", "False", "if",...
Unassign a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f unassign_floating_ip my-digitalocean-config floating_ip='45.55.96.47'
[ "Unassign", "a", "floating", "IP" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1161-L1191
33,648
saltstack/salt
salt/cloud/clouds/digitalocean.py
_list_nodes
def _list_nodes(full=False, for_output=False): ''' Helper function to format and parse node data. ''' fetch = True page = 1 ret = {} while fetch: items = query(method='droplets', command='?page=' + six.text_type(page) + '&per_page=200') for node in item...
python
def _list_nodes(full=False, for_output=False): ''' Helper function to format and parse node data. ''' fetch = True page = 1 ret = {} while fetch: items = query(method='droplets', command='?page=' + six.text_type(page) + '&per_page=200') for node in item...
[ "def", "_list_nodes", "(", "full", "=", "False", ",", "for_output", "=", "False", ")", ":", "fetch", "=", "True", "page", "=", "1", "ret", "=", "{", "}", "while", "fetch", ":", "items", "=", "query", "(", "method", "=", "'droplets'", ",", "command", ...
Helper function to format and parse node data.
[ "Helper", "function", "to", "format", "and", "parse", "node", "data", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1194-L1228
33,649
saltstack/salt
salt/cloud/clouds/digitalocean.py
reboot
def reboot(name, call=None): ''' Reboot a droplet in DigitalOcean. .. versionadded:: 2015.8.8 name The name of the droplet to restart. CLI Example: .. code-block:: bash salt-cloud -a reboot droplet_name ''' if call != 'action': raise SaltCloudSystemExit( ...
python
def reboot(name, call=None): ''' Reboot a droplet in DigitalOcean. .. versionadded:: 2015.8.8 name The name of the droplet to restart. CLI Example: .. code-block:: bash salt-cloud -a reboot droplet_name ''' if call != 'action': raise SaltCloudSystemExit( ...
[ "def", "reboot", "(", "name", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The restart action must be called with -a or --action.'", ")", "data", "=", "show_instance", "(", "name", ",", "call", "...
Reboot a droplet in DigitalOcean. .. versionadded:: 2015.8.8 name The name of the droplet to restart. CLI Example: .. code-block:: bash salt-cloud -a reboot droplet_name
[ "Reboot", "a", "droplet", "in", "DigitalOcean", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1231-L1265
33,650
saltstack/salt
salt/cloud/clouds/digitalocean.py
_get_full_output
def _get_full_output(node, for_output=False): ''' Helper function for _list_nodes to loop through all node information. Returns a dictionary containing the full information of a node. ''' ret = {} for item in six.iterkeys(node): value = node[item] if value is not None and for_out...
python
def _get_full_output(node, for_output=False): ''' Helper function for _list_nodes to loop through all node information. Returns a dictionary containing the full information of a node. ''' ret = {} for item in six.iterkeys(node): value = node[item] if value is not None and for_out...
[ "def", "_get_full_output", "(", "node", ",", "for_output", "=", "False", ")", ":", "ret", "=", "{", "}", "for", "item", "in", "six", ".", "iterkeys", "(", "node", ")", ":", "value", "=", "node", "[", "item", "]", "if", "value", "is", "not", "None",...
Helper function for _list_nodes to loop through all node information. Returns a dictionary containing the full information of a node.
[ "Helper", "function", "for", "_list_nodes", "to", "loop", "through", "all", "node", "information", ".", "Returns", "a", "dictionary", "containing", "the", "full", "information", "of", "a", "node", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1342-L1353
33,651
saltstack/salt
salt/cloud/clouds/digitalocean.py
_get_ips
def _get_ips(networks): ''' Helper function for list_nodes. Returns public and private ip lists based on a given network dictionary. ''' v4s = networks.get('v4') v6s = networks.get('v6') public_ips = [] private_ips = [] if v4s: for item in v4s: ip_type = item.get...
python
def _get_ips(networks): ''' Helper function for list_nodes. Returns public and private ip lists based on a given network dictionary. ''' v4s = networks.get('v4') v6s = networks.get('v6') public_ips = [] private_ips = [] if v4s: for item in v4s: ip_type = item.get...
[ "def", "_get_ips", "(", "networks", ")", ":", "v4s", "=", "networks", ".", "get", "(", "'v4'", ")", "v6s", "=", "networks", ".", "get", "(", "'v6'", ")", "public_ips", "=", "[", "]", "private_ips", "=", "[", "]", "if", "v4s", ":", "for", "item", ...
Helper function for list_nodes. Returns public and private ip lists based on a given network dictionary.
[ "Helper", "function", "for", "list_nodes", ".", "Returns", "public", "and", "private", "ip", "lists", "based", "on", "a", "given", "network", "dictionary", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/digitalocean.py#L1356-L1384
33,652
saltstack/salt
salt/modules/deb_postgres.py
cluster_create
def cluster_create(version, name='main', port=None, locale=None, encoding=None, datadir=None, allow_group_access=None, data_checksums=None, wal_segsize=None): ''' ...
python
def cluster_create(version, name='main', port=None, locale=None, encoding=None, datadir=None, allow_group_access=None, data_checksums=None, wal_segsize=None): ''' ...
[ "def", "cluster_create", "(", "version", ",", "name", "=", "'main'", ",", "port", "=", "None", ",", "locale", "=", "None", ",", "encoding", "=", "None", ",", "datadir", "=", "None", ",", "allow_group_access", "=", "None", ",", "data_checksums", "=", "Non...
Adds a cluster to the Postgres server. .. warning: Only works for debian family distros so far. CLI Example: .. code-block:: bash salt '*' postgres.cluster_create '9.3' salt '*' postgres.cluster_create '9.3' 'main' salt '*' postgres.cluster_create '9.3' locale='fr_FR' ...
[ "Adds", "a", "cluster", "to", "the", "Postgres", "server", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_postgres.py#L32-L85
33,653
saltstack/salt
salt/modules/deb_postgres.py
cluster_remove
def cluster_remove(version, name='main', stop=False): ''' Remove a cluster on a Postgres server. By default it doesn't try to stop the cluster. CLI Example: .. code-block:: bash salt '*' postgres.cluster_remove '9.3' salt '*' postgres.cluster...
python
def cluster_remove(version, name='main', stop=False): ''' Remove a cluster on a Postgres server. By default it doesn't try to stop the cluster. CLI Example: .. code-block:: bash salt '*' postgres.cluster_remove '9.3' salt '*' postgres.cluster...
[ "def", "cluster_remove", "(", "version", ",", "name", "=", "'main'", ",", "stop", "=", "False", ")", ":", "cmd", "=", "[", "salt", ".", "utils", ".", "path", ".", "which", "(", "'pg_dropcluster'", ")", "]", "if", "stop", ":", "cmd", "+=", "[", "'--...
Remove a cluster on a Postgres server. By default it doesn't try to stop the cluster. CLI Example: .. code-block:: bash salt '*' postgres.cluster_remove '9.3' salt '*' postgres.cluster_remove '9.3' 'main' salt '*' postgres.cluster_remove '9.3' 'main' stop=True
[ "Remove", "a", "cluster", "on", "a", "Postgres", "server", ".", "By", "default", "it", "doesn", "t", "try", "to", "stop", "the", "cluster", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_postgres.py#L126-L156
33,654
saltstack/salt
salt/modules/deb_postgres.py
_parse_pg_lscluster
def _parse_pg_lscluster(output): ''' Helper function to parse the output of pg_lscluster ''' cluster_dict = {} for line in output.splitlines(): version, name, port, status, user, datadir, log = ( line.split()) cluster_dict['{0}/{1}'.format(version, name)] = { ...
python
def _parse_pg_lscluster(output): ''' Helper function to parse the output of pg_lscluster ''' cluster_dict = {} for line in output.splitlines(): version, name, port, status, user, datadir, log = ( line.split()) cluster_dict['{0}/{1}'.format(version, name)] = { ...
[ "def", "_parse_pg_lscluster", "(", "output", ")", ":", "cluster_dict", "=", "{", "}", "for", "line", "in", "output", ".", "splitlines", "(", ")", ":", "version", ",", "name", ",", "port", ",", "status", ",", "user", ",", "datadir", ",", "log", "=", "...
Helper function to parse the output of pg_lscluster
[ "Helper", "function", "to", "parse", "the", "output", "of", "pg_lscluster" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/deb_postgres.py#L159-L173
33,655
saltstack/salt
salt/grains/esxi.py
_grains
def _grains(): ''' Get the grains from the proxied device. ''' try: host = __pillar__['proxy']['host'] if host: username, password = _find_credentials(host) protocol = __pillar__['proxy'].get('protocol') port = __pillar__['proxy'].get('port') ...
python
def _grains(): ''' Get the grains from the proxied device. ''' try: host = __pillar__['proxy']['host'] if host: username, password = _find_credentials(host) protocol = __pillar__['proxy'].get('protocol') port = __pillar__['proxy'].get('port') ...
[ "def", "_grains", "(", ")", ":", "try", ":", "host", "=", "__pillar__", "[", "'proxy'", "]", "[", "'host'", "]", "if", "host", ":", "username", ",", "password", "=", "_find_credentials", "(", "host", ")", "protocol", "=", "__pillar__", "[", "'proxy'", ...
Get the grains from the proxied device.
[ "Get", "the", "grains", "from", "the", "proxied", "device", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/esxi.py#L83-L102
33,656
saltstack/salt
salt/pillar/etcd_pillar.py
ext_pillar
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 conf): ''' Check etcd for all data ''' comps = conf.split() profile = None if comps[0]: profile = comps[0] client = salt.utils.etcd_util.get_conn(__opts__, profile) path = '/' if len(co...
python
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 conf): ''' Check etcd for all data ''' comps = conf.split() profile = None if comps[0]: profile = comps[0] client = salt.utils.etcd_util.get_conn(__opts__, profile) path = '/' if len(co...
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "# pylint: disable=W0613", "conf", ")", ":", "comps", "=", "conf", ".", "split", "(", ")", "profile", "=", "None", "if", "comps", "[", "0", "]", ":", "profile", "=", "comps", "[", "0", "]", "...
Check etcd for all data
[ "Check", "etcd", "for", "all", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/etcd_pillar.py#L86-L114
33,657
saltstack/salt
salt/states/csf.py
rule_absent
def rule_absent(name, method, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='s', ttl=None, reload=False): ''' Ensure iptable is not present. name The ...
python
def rule_absent(name, method, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='s', ttl=None, reload=False): ''' Ensure iptable is not present. name The ...
[ "def", "rule_absent", "(", "name", ",", "method", ",", "port", "=", "None", ",", "proto", "=", "'tcp'", ",", "direction", "=", "'in'", ",", "port_origin", "=", "'d'", ",", "ip_origin", "=", "'s'", ",", "ttl", "=", "None", ",", "reload", "=", "False",...
Ensure iptable is not present. name The ip address or CIDR for the rule. method The type of rule. Either 'allow' or 'deny'. port Optional port to be open or closed for the iptables rule. proto The protocol. Either 'tcp', 'udp'. Only applicable if port...
[ "Ensure", "iptable", "is", "not", "present", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/csf.py#L131-L217
33,658
saltstack/salt
salt/states/csf.py
nics_skipped
def nics_skipped(name, nics, ipv6=False): ''' name Meaningless arg, but required for state. nics A list of nics to skip. ipv6 Boolean. Set to true if you want to skip the ipv6 interface. Default false (ipv4). ''' ret = {'name': ','.join(nics), 'change...
python
def nics_skipped(name, nics, ipv6=False): ''' name Meaningless arg, but required for state. nics A list of nics to skip. ipv6 Boolean. Set to true if you want to skip the ipv6 interface. Default false (ipv4). ''' ret = {'name': ','.join(nics), 'change...
[ "def", "nics_skipped", "(", "name", ",", "nics", ",", "ipv6", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "','", ".", "join", "(", "nics", ")", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "'NI...
name Meaningless arg, but required for state. nics A list of nics to skip. ipv6 Boolean. Set to true if you want to skip the ipv6 interface. Default false (ipv4).
[ "name", "Meaningless", "arg", "but", "required", "for", "state", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/csf.py#L268-L290
33,659
saltstack/salt
salt/pillar/stack.py
_parse_stack_cfg
def _parse_stack_cfg(content): ''' Allow top level cfg to be YAML ''' try: obj = salt.utils.yaml.safe_load(content) if isinstance(obj, list): return obj except Exception as e: pass return content.splitlines()
python
def _parse_stack_cfg(content): ''' Allow top level cfg to be YAML ''' try: obj = salt.utils.yaml.safe_load(content) if isinstance(obj, list): return obj except Exception as e: pass return content.splitlines()
[ "def", "_parse_stack_cfg", "(", "content", ")", ":", "try", ":", "obj", "=", "salt", ".", "utils", ".", "yaml", ".", "safe_load", "(", "content", ")", "if", "isinstance", "(", "obj", ",", "list", ")", ":", "return", "obj", "except", "Exception", "as", ...
Allow top level cfg to be YAML
[ "Allow", "top", "level", "cfg", "to", "be", "YAML" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/stack.py#L529-L539
33,660
saltstack/salt
salt/modules/pip.py
_clear_context
def _clear_context(bin_env=None): ''' Remove the cached pip version ''' contextkey = 'pip.version' if bin_env is not None: contextkey = '{0}.{1}'.format(contextkey, bin_env) __context__.pop(contextkey, None)
python
def _clear_context(bin_env=None): ''' Remove the cached pip version ''' contextkey = 'pip.version' if bin_env is not None: contextkey = '{0}.{1}'.format(contextkey, bin_env) __context__.pop(contextkey, None)
[ "def", "_clear_context", "(", "bin_env", "=", "None", ")", ":", "contextkey", "=", "'pip.version'", "if", "bin_env", "is", "not", "None", ":", "contextkey", "=", "'{0}.{1}'", ".", "format", "(", "contextkey", ",", "bin_env", ")", "__context__", ".", "pop", ...
Remove the cached pip version
[ "Remove", "the", "cached", "pip", "version" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L131-L138
33,661
saltstack/salt
salt/modules/pip.py
_get_pip_bin
def _get_pip_bin(bin_env): ''' Locate the pip binary, either from `bin_env` as a virtualenv, as the executable itself, or from searching conventional filesystem locations ''' if not bin_env: logger.debug('pip: Using pip from currently-running Python') return [os.path.normpath(sys.exe...
python
def _get_pip_bin(bin_env): ''' Locate the pip binary, either from `bin_env` as a virtualenv, as the executable itself, or from searching conventional filesystem locations ''' if not bin_env: logger.debug('pip: Using pip from currently-running Python') return [os.path.normpath(sys.exe...
[ "def", "_get_pip_bin", "(", "bin_env", ")", ":", "if", "not", "bin_env", ":", "logger", ".", "debug", "(", "'pip: Using pip from currently-running Python'", ")", "return", "[", "os", ".", "path", ".", "normpath", "(", "sys", ".", "executable", ")", ",", "'-m...
Locate the pip binary, either from `bin_env` as a virtualenv, as the executable itself, or from searching conventional filesystem locations
[ "Locate", "the", "pip", "binary", "either", "from", "bin_env", "as", "a", "virtualenv", "as", "the", "executable", "itself", "or", "from", "searching", "conventional", "filesystem", "locations" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L141-L193
33,662
saltstack/salt
salt/modules/pip.py
_get_cached_requirements
def _get_cached_requirements(requirements, saltenv): ''' Get the location of a cached requirements file; caching if necessary. ''' req_file, senv = salt.utils.url.parse(requirements) if senv: saltenv = senv if req_file not in __salt__['cp.list_master'](saltenv): # Requirements ...
python
def _get_cached_requirements(requirements, saltenv): ''' Get the location of a cached requirements file; caching if necessary. ''' req_file, senv = salt.utils.url.parse(requirements) if senv: saltenv = senv if req_file not in __salt__['cp.list_master'](saltenv): # Requirements ...
[ "def", "_get_cached_requirements", "(", "requirements", ",", "saltenv", ")", ":", "req_file", ",", "senv", "=", "salt", ".", "utils", ".", "url", ".", "parse", "(", "requirements", ")", "if", "senv", ":", "saltenv", "=", "senv", "if", "req_file", "not", ...
Get the location of a cached requirements file; caching if necessary.
[ "Get", "the", "location", "of", "a", "cached", "requirements", "file", ";", "caching", "if", "necessary", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L196-L224
33,663
saltstack/salt
salt/modules/pip.py
_get_env_activate
def _get_env_activate(bin_env): ''' Return the path to the activate binary ''' if not bin_env: raise CommandNotFoundError('Could not find a `activate` binary') if os.path.isdir(bin_env): if salt.utils.platform.is_windows(): activate_bin = os.path.join(bin_env, 'Scripts',...
python
def _get_env_activate(bin_env): ''' Return the path to the activate binary ''' if not bin_env: raise CommandNotFoundError('Could not find a `activate` binary') if os.path.isdir(bin_env): if salt.utils.platform.is_windows(): activate_bin = os.path.join(bin_env, 'Scripts',...
[ "def", "_get_env_activate", "(", "bin_env", ")", ":", "if", "not", "bin_env", ":", "raise", "CommandNotFoundError", "(", "'Could not find a `activate` binary'", ")", "if", "os", ".", "path", ".", "isdir", "(", "bin_env", ")", ":", "if", "salt", ".", "utils", ...
Return the path to the activate binary
[ "Return", "the", "path", "to", "the", "activate", "binary" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L227-L241
33,664
saltstack/salt
salt/modules/pip.py
_resolve_requirements_chain
def _resolve_requirements_chain(requirements): ''' Return an array of requirements file paths that can be used to complete the no_chown==False && user != None conundrum ''' chain = [] if isinstance(requirements, six.string_types): requirements = [requirements] for req_file in requ...
python
def _resolve_requirements_chain(requirements): ''' Return an array of requirements file paths that can be used to complete the no_chown==False && user != None conundrum ''' chain = [] if isinstance(requirements, six.string_types): requirements = [requirements] for req_file in requ...
[ "def", "_resolve_requirements_chain", "(", "requirements", ")", ":", "chain", "=", "[", "]", "if", "isinstance", "(", "requirements", ",", "six", ".", "string_types", ")", ":", "requirements", "=", "[", "requirements", "]", "for", "req_file", "in", "requiremen...
Return an array of requirements file paths that can be used to complete the no_chown==False && user != None conundrum
[ "Return", "an", "array", "of", "requirements", "file", "paths", "that", "can", "be", "used", "to", "complete", "the", "no_chown", "==", "False", "&&", "user", "!", "=", "None", "conundrum" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L259-L274
33,665
saltstack/salt
salt/modules/pip.py
uninstall
def uninstall(pkgs=None, requirements=None, bin_env=None, log=None, proxy=None, timeout=None, user=None, cwd=None, saltenv='base', use_vt=False): ''' Uninstall packages individually or f...
python
def uninstall(pkgs=None, requirements=None, bin_env=None, log=None, proxy=None, timeout=None, user=None, cwd=None, saltenv='base', use_vt=False): ''' Uninstall packages individually or f...
[ "def", "uninstall", "(", "pkgs", "=", "None", ",", "requirements", "=", "None", ",", "bin_env", "=", "None", ",", "log", "=", "None", ",", "proxy", "=", "None", ",", "timeout", "=", "None", ",", "user", "=", "None", ",", "cwd", "=", "None", ",", ...
Uninstall packages individually or from a pip requirements file pkgs comma separated list of packages to install requirements Path to requirements file bin_env Path to pip (or to a virtualenv). This can be used to specify the path to the pip to use when more than one Pytho...
[ "Uninstall", "packages", "individually", "or", "from", "a", "pip", "requirements", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L964-L1086
33,666
saltstack/salt
salt/modules/pip.py
freeze
def freeze(bin_env=None, user=None, cwd=None, use_vt=False, env_vars=None, **kwargs): ''' Return a list of installed packages either globally or in the specified virtualenv bin_env Path to pip (or to a virtualenv). This can be used to speci...
python
def freeze(bin_env=None, user=None, cwd=None, use_vt=False, env_vars=None, **kwargs): ''' Return a list of installed packages either globally or in the specified virtualenv bin_env Path to pip (or to a virtualenv). This can be used to speci...
[ "def", "freeze", "(", "bin_env", "=", "None", ",", "user", "=", "None", ",", "cwd", "=", "None", ",", "use_vt", "=", "False", ",", "env_vars", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cmd", "=", "_get_pip_bin", "(", "bin_env", ")", "cmd", ...
Return a list of installed packages either globally or in the specified virtualenv bin_env Path to pip (or to a virtualenv). This can be used to specify the path to the pip to use when more than one Python release is installed (e.g. ``/usr/bin/pip-2.7`` or ``/usr/bin/pip-2.6``. If a dir...
[ "Return", "a", "list", "of", "installed", "packages", "either", "globally", "or", "in", "the", "specified", "virtualenv" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1089-L1149
33,667
saltstack/salt
salt/modules/pip.py
list_
def list_(prefix=None, bin_env=None, user=None, cwd=None, env_vars=None, **kwargs): ''' Filter list of installed apps from ``freeze`` and check to see if ``prefix`` exists in the list of packages installed. .. note:: If the version of pip avail...
python
def list_(prefix=None, bin_env=None, user=None, cwd=None, env_vars=None, **kwargs): ''' Filter list of installed apps from ``freeze`` and check to see if ``prefix`` exists in the list of packages installed. .. note:: If the version of pip avail...
[ "def", "list_", "(", "prefix", "=", "None", ",", "bin_env", "=", "None", ",", "user", "=", "None", ",", "cwd", "=", "None", ",", "env_vars", "=", "None", ",", "*", "*", "kwargs", ")", ":", "packages", "=", "{", "}", "if", "prefix", "is", "None", ...
Filter list of installed apps from ``freeze`` and check to see if ``prefix`` exists in the list of packages installed. .. note:: If the version of pip available is older than 8.0.3, the packages ``wheel``, ``setuptools``, and ``distribute`` will not be reported by this function even if...
[ "Filter", "list", "of", "installed", "apps", "from", "freeze", "and", "check", "to", "see", "if", "prefix", "exists", "in", "the", "list", "of", "packages", "installed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pip.py#L1152-L1220
33,668
saltstack/salt
salt/netapi/rest_cherrypy/__init__.py
verify_certs
def verify_certs(*args): ''' Sanity checking for the specified SSL certificates ''' msg = ("Could not find a certificate: {0}\n" "If you want to quickly generate a self-signed certificate, " "use the tls.create_self_signed_cert function in Salt") for arg in args: if ...
python
def verify_certs(*args): ''' Sanity checking for the specified SSL certificates ''' msg = ("Could not find a certificate: {0}\n" "If you want to quickly generate a self-signed certificate, " "use the tls.create_self_signed_cert function in Salt") for arg in args: if ...
[ "def", "verify_certs", "(", "*", "args", ")", ":", "msg", "=", "(", "\"Could not find a certificate: {0}\\n\"", "\"If you want to quickly generate a self-signed certificate, \"", "\"use the tls.create_self_signed_cert function in Salt\"", ")", "for", "arg", "in", "args", ":", "...
Sanity checking for the specified SSL certificates
[ "Sanity", "checking", "for", "the", "specified", "SSL", "certificates" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/__init__.py#L62-L72
33,669
saltstack/salt
salt/netapi/rest_cherrypy/__init__.py
start
def start(): ''' Start the server loop ''' from . import app root, apiopts, conf = app.get_app(__opts__) if not apiopts.get('disable_ssl', False): if 'ssl_crt' not in apiopts or 'ssl_key' not in apiopts: logger.error("Not starting '%s'. Options 'ssl_crt' and " ...
python
def start(): ''' Start the server loop ''' from . import app root, apiopts, conf = app.get_app(__opts__) if not apiopts.get('disable_ssl', False): if 'ssl_crt' not in apiopts or 'ssl_key' not in apiopts: logger.error("Not starting '%s'. Options 'ssl_crt' and " ...
[ "def", "start", "(", ")", ":", "from", ".", "import", "app", "root", ",", "apiopts", ",", "conf", "=", "app", ".", "get_app", "(", "__opts__", ")", "if", "not", "apiopts", ".", "get", "(", "'disable_ssl'", ",", "False", ")", ":", "if", "'ssl_crt'", ...
Start the server loop
[ "Start", "the", "server", "loop" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/__init__.py#L75-L98
33,670
saltstack/salt
salt/utils/pkg/rpm.py
check_32
def check_32(arch, osarch=None): ''' Returns True if both the OS arch and the passed arch are 32-bit ''' if osarch is None: osarch = get_osarch() return all(x in ARCHES_32 for x in (osarch, arch))
python
def check_32(arch, osarch=None): ''' Returns True if both the OS arch and the passed arch are 32-bit ''' if osarch is None: osarch = get_osarch() return all(x in ARCHES_32 for x in (osarch, arch))
[ "def", "check_32", "(", "arch", ",", "osarch", "=", "None", ")", ":", "if", "osarch", "is", "None", ":", "osarch", "=", "get_osarch", "(", ")", "return", "all", "(", "x", "in", "ARCHES_32", "for", "x", "in", "(", "osarch", ",", "arch", ")", ")" ]
Returns True if both the OS arch and the passed arch are 32-bit
[ "Returns", "True", "if", "both", "the", "OS", "arch", "and", "the", "passed", "arch", "are", "32", "-", "bit" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L63-L69
33,671
saltstack/salt
salt/utils/pkg/rpm.py
pkginfo
def pkginfo(name, version, arch, repoid, install_date=None, install_date_time_t=None): ''' Build and return a pkginfo namedtuple ''' pkginfo_tuple = collections.namedtuple( 'PkgInfo', ('name', 'version', 'arch', 'repoid', 'install_date', 'install_date_time_t') ) return p...
python
def pkginfo(name, version, arch, repoid, install_date=None, install_date_time_t=None): ''' Build and return a pkginfo namedtuple ''' pkginfo_tuple = collections.namedtuple( 'PkgInfo', ('name', 'version', 'arch', 'repoid', 'install_date', 'install_date_time_t') ) return p...
[ "def", "pkginfo", "(", "name", ",", "version", ",", "arch", ",", "repoid", ",", "install_date", "=", "None", ",", "install_date_time_t", "=", "None", ")", ":", "pkginfo_tuple", "=", "collections", ".", "namedtuple", "(", "'PkgInfo'", ",", "(", "'name'", ",...
Build and return a pkginfo namedtuple
[ "Build", "and", "return", "a", "pkginfo", "namedtuple" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L72-L82
33,672
saltstack/salt
salt/utils/pkg/rpm.py
resolve_name
def resolve_name(name, arch, osarch=None): ''' Resolve the package name and arch into a unique name referred to by salt. For example, on a 64-bit OS, a 32-bit package will be pkgname.i386. ''' if osarch is None: osarch = get_osarch() if not check_32(arch, osarch) and arch not in (ARCHMA...
python
def resolve_name(name, arch, osarch=None): ''' Resolve the package name and arch into a unique name referred to by salt. For example, on a 64-bit OS, a 32-bit package will be pkgname.i386. ''' if osarch is None: osarch = get_osarch() if not check_32(arch, osarch) and arch not in (ARCHMA...
[ "def", "resolve_name", "(", "name", ",", "arch", ",", "osarch", "=", "None", ")", ":", "if", "osarch", "is", "None", ":", "osarch", "=", "get_osarch", "(", ")", "if", "not", "check_32", "(", "arch", ",", "osarch", ")", "and", "arch", "not", "in", "...
Resolve the package name and arch into a unique name referred to by salt. For example, on a 64-bit OS, a 32-bit package will be pkgname.i386.
[ "Resolve", "the", "package", "name", "and", "arch", "into", "a", "unique", "name", "referred", "to", "by", "salt", ".", "For", "example", "on", "a", "64", "-", "bit", "OS", "a", "32", "-", "bit", "package", "will", "be", "pkgname", ".", "i386", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L85-L95
33,673
saltstack/salt
salt/utils/pkg/rpm.py
version_to_evr
def version_to_evr(verstring): ''' Split the package version string into epoch, version and release. Return this as tuple. The epoch is always not empty. The version and the release can be an empty string if such a component could not be found in the version string. "2:1.0-1.2" => ('2', '1.0',...
python
def version_to_evr(verstring): ''' Split the package version string into epoch, version and release. Return this as tuple. The epoch is always not empty. The version and the release can be an empty string if such a component could not be found in the version string. "2:1.0-1.2" => ('2', '1.0',...
[ "def", "version_to_evr", "(", "verstring", ")", ":", "if", "verstring", "in", "[", "None", ",", "''", "]", ":", "return", "'0'", ",", "''", ",", "''", "idx_e", "=", "verstring", ".", "find", "(", "':'", ")", "if", "idx_e", "!=", "-", "1", ":", "t...
Split the package version string into epoch, version and release. Return this as tuple. The epoch is always not empty. The version and the release can be an empty string if such a component could not be found in the version string. "2:1.0-1.2" => ('2', '1.0', '1.2) "1.0" => ('0', '1.0', '') ""...
[ "Split", "the", "package", "version", "string", "into", "epoch", "version", "and", "release", ".", "Return", "this", "as", "tuple", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L143-L175
33,674
saltstack/salt
salt/states/boto_secgroup.py
present
def present( name, description, vpc_id=None, vpc_name=None, rules=None, rules_egress=None, delete_ingress_rules=True, delete_egress_rules=True, region=None, key=None, keyid=None, profile=None, tags=None): ''' ...
python
def present( name, description, vpc_id=None, vpc_name=None, rules=None, rules_egress=None, delete_ingress_rules=True, delete_egress_rules=True, region=None, key=None, keyid=None, profile=None, tags=None): ''' ...
[ "def", "present", "(", "name", ",", "description", ",", "vpc_id", "=", "None", ",", "vpc_name", "=", "None", ",", "rules", "=", "None", ",", "rules_egress", "=", "None", ",", "delete_ingress_rules", "=", "True", ",", "delete_egress_rules", "=", "True", ","...
Ensure the security group exists with the specified rules. name Name of the security group. description A description of this security group. vpc_id The ID of the VPC to create the security group in, if any. Exclusive with vpc_name. vpc_name The name of the VPC to cre...
[ "Ensure", "the", "security", "group", "exists", "with", "the", "specified", "rules", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L127-L235
33,675
saltstack/salt
salt/states/boto_secgroup.py
_split_rules
def _split_rules(rules): ''' Split rules with lists into individual rules. We accept some attributes as lists or strings. The data we get back from the execution module lists rules as individual rules. We need to split the provided rules into individual rules to compare them. ''' split = []...
python
def _split_rules(rules): ''' Split rules with lists into individual rules. We accept some attributes as lists or strings. The data we get back from the execution module lists rules as individual rules. We need to split the provided rules into individual rules to compare them. ''' split = []...
[ "def", "_split_rules", "(", "rules", ")", ":", "split", "=", "[", "]", "for", "rule", "in", "rules", ":", "cidr_ip", "=", "rule", ".", "get", "(", "'cidr_ip'", ")", "group_name", "=", "rule", ".", "get", "(", "'source_group_name'", ")", "group_id", "="...
Split rules with lists into individual rules. We accept some attributes as lists or strings. The data we get back from the execution module lists rules as individual rules. We need to split the provided rules into individual rules to compare them.
[ "Split", "rules", "with", "lists", "into", "individual", "rules", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L273-L303
33,676
saltstack/salt
salt/states/boto_secgroup.py
_check_rule
def _check_rule(rule, _rule): ''' Check to see if two rules are the same. Needed to compare rules fetched from boto, since they may not completely match rules defined in sls files but may be functionally equivalent. ''' # We need to alter what Boto returns if no ports are specified # so tha...
python
def _check_rule(rule, _rule): ''' Check to see if two rules are the same. Needed to compare rules fetched from boto, since they may not completely match rules defined in sls files but may be functionally equivalent. ''' # We need to alter what Boto returns if no ports are specified # so tha...
[ "def", "_check_rule", "(", "rule", ",", "_rule", ")", ":", "# We need to alter what Boto returns if no ports are specified", "# so that we can compare rules fairly.", "#", "# Boto returns None for from_port and to_port where we're required", "# to pass in \"-1\" instead.", "if", "_rule",...
Check to see if two rules are the same. Needed to compare rules fetched from boto, since they may not completely match rules defined in sls files but may be functionally equivalent.
[ "Check", "to", "see", "if", "two", "rules", "are", "the", "same", ".", "Needed", "to", "compare", "rules", "fetched", "from", "boto", "since", "they", "may", "not", "completely", "match", "rules", "defined", "in", "sls", "files", "but", "may", "be", "fun...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L306-L338
33,677
saltstack/salt
salt/states/boto_secgroup.py
absent
def absent( name, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' Ensure a security group with the specified name does not exist. name Name of the security group. vpc_id The ID of the VPC to remov...
python
def absent( name, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' Ensure a security group with the specified name does not exist. name Name of the security group. vpc_id The ID of the VPC to remov...
[ "def", "absent", "(", "name", ",", "vpc_id", "=", "None", ",", "vpc_name", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name",...
Ensure a security group with the specified name does not exist. name Name of the security group. vpc_id The ID of the VPC to remove the security group from, if any. Exclusive with vpc_name. vpc_name The name of the VPC to remove the security group from, if any. Exclusive with vpc_...
[ "Ensure", "a", "security", "group", "with", "the", "specified", "name", "does", "not", "exist", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L603-L663
33,678
saltstack/salt
salt/states/ceph.py
_ordereddict2dict
def _ordereddict2dict(input_ordered_dict): ''' Convert ordered dictionary to a dictionary ''' return salt.utils.json.loads(salt.utils.json.dumps(input_ordered_dict))
python
def _ordereddict2dict(input_ordered_dict): ''' Convert ordered dictionary to a dictionary ''' return salt.utils.json.loads(salt.utils.json.dumps(input_ordered_dict))
[ "def", "_ordereddict2dict", "(", "input_ordered_dict", ")", ":", "return", "salt", ".", "utils", ".", "json", ".", "loads", "(", "salt", ".", "utils", ".", "json", ".", "dumps", "(", "input_ordered_dict", ")", ")" ]
Convert ordered dictionary to a dictionary
[ "Convert", "ordered", "dictionary", "to", "a", "dictionary" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ceph.py#L47-L51
33,679
saltstack/salt
salt/pillar/consul_pillar.py
fetch_tree
def fetch_tree(client, path, expand_keys): ''' Grab data from consul, trim base path and remove any keys which are folders. Take the remaining data and send it to be formatted in such a way as to be used as pillar data. ''' _, items = consul_fetch(client, path) ret = {} has_children = re...
python
def fetch_tree(client, path, expand_keys): ''' Grab data from consul, trim base path and remove any keys which are folders. Take the remaining data and send it to be formatted in such a way as to be used as pillar data. ''' _, items = consul_fetch(client, path) ret = {} has_children = re...
[ "def", "fetch_tree", "(", "client", ",", "path", ",", "expand_keys", ")", ":", "_", ",", "items", "=", "consul_fetch", "(", "client", ",", "path", ")", "ret", "=", "{", "}", "has_children", "=", "re", ".", "compile", "(", "r'/$'", ")", "log", ".", ...
Grab data from consul, trim base path and remove any keys which are folders. Take the remaining data and send it to be formatted in such a way as to be used as pillar data.
[ "Grab", "data", "from", "consul", "trim", "base", "path", "and", "remove", "any", "keys", "which", "are", "folders", ".", "Take", "the", "remaining", "data", "and", "send", "it", "to", "be", "formatted", "in", "such", "a", "way", "as", "to", "be", "use...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L266-L289
33,680
saltstack/salt
salt/pillar/consul_pillar.py
pillar_format
def pillar_format(ret, keys, value, expand_keys): ''' Perform data formatting to be used as pillar data and merge it with the current pillar data ''' # if value is empty in Consul then it's None here - skip it if value is None: return ret # If value is not None then it's a string ...
python
def pillar_format(ret, keys, value, expand_keys): ''' Perform data formatting to be used as pillar data and merge it with the current pillar data ''' # if value is empty in Consul then it's None here - skip it if value is None: return ret # If value is not None then it's a string ...
[ "def", "pillar_format", "(", "ret", ",", "keys", ",", "value", ",", "expand_keys", ")", ":", "# if value is empty in Consul then it's None here - skip it", "if", "value", "is", "None", ":", "return", "ret", "# If value is not None then it's a string", "# YAML strips whitesp...
Perform data formatting to be used as pillar data and merge it with the current pillar data
[ "Perform", "data", "formatting", "to", "be", "used", "as", "pillar", "data", "and", "merge", "it", "with", "the", "current", "pillar", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L292-L315
33,681
saltstack/salt
salt/pillar/consul_pillar.py
_resolve_datacenter
def _resolve_datacenter(dc, pillarenv): ''' If ``dc`` is a string - return it as is. If it's a dict then sort it in descending order by key length and try to use keys as RegEx patterns to match against ``pillarenv``. The value for matched pattern should be a string (that can use ``str.format`` ...
python
def _resolve_datacenter(dc, pillarenv): ''' If ``dc`` is a string - return it as is. If it's a dict then sort it in descending order by key length and try to use keys as RegEx patterns to match against ``pillarenv``. The value for matched pattern should be a string (that can use ``str.format`` ...
[ "def", "_resolve_datacenter", "(", "dc", ",", "pillarenv", ")", ":", "log", ".", "debug", "(", "'Resolving Consul datacenter based on: %s'", ",", "dc", ")", "try", ":", "mappings", "=", "dc", ".", "items", "(", ")", "# is it a dict?", "except", "AttributeError",...
If ``dc`` is a string - return it as is. If it's a dict then sort it in descending order by key length and try to use keys as RegEx patterns to match against ``pillarenv``. The value for matched pattern should be a string (that can use ``str.format`` syntax togetehr with captured variables from pattern...
[ "If", "dc", "is", "a", "string", "-", "return", "it", "as", "is", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/consul_pillar.py#L358-L397
33,682
saltstack/salt
salt/beacons/btmp.py
_gather_group_members
def _gather_group_members(group, groups, users): ''' Gather group members ''' _group = __salt__['group.info'](group) if not _group: log.warning('Group %s does not exist, ignoring.', group) return for member in _group['members']: if member not in users: users...
python
def _gather_group_members(group, groups, users): ''' Gather group members ''' _group = __salt__['group.info'](group) if not _group: log.warning('Group %s does not exist, ignoring.', group) return for member in _group['members']: if member not in users: users...
[ "def", "_gather_group_members", "(", "group", ",", "groups", ",", "users", ")", ":", "_group", "=", "__salt__", "[", "'group.info'", "]", "(", "group", ")", "if", "not", "_group", ":", "log", ".", "warning", "(", "'Group %s does not exist, ignoring.'", ",", ...
Gather group members
[ "Gather", "group", "members" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/btmp.py#L168-L180
33,683
saltstack/salt
salt/beacons/btmp.py
beacon
def beacon(config): ''' Read the last btmp file and return information on the failed logins ''' ret = [] users = {} groups = {} defaults = None for config_item in config: if 'users' in config_item: users = config_item['users'] if 'groups' in config_item: ...
python
def beacon(config): ''' Read the last btmp file and return information on the failed logins ''' ret = [] users = {} groups = {} defaults = None for config_item in config: if 'users' in config_item: users = config_item['users'] if 'groups' in config_item: ...
[ "def", "beacon", "(", "config", ")", ":", "ret", "=", "[", "]", "users", "=", "{", "}", "groups", "=", "{", "}", "defaults", "=", "None", "for", "config_item", "in", "config", ":", "if", "'users'", "in", "config_item", ":", "users", "=", "config_item...
Read the last btmp file and return information on the failed logins
[ "Read", "the", "last", "btmp", "file", "and", "return", "information", "on", "the", "failed", "logins" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/btmp.py#L266-L331
33,684
saltstack/salt
salt/modules/lxc.py
version
def version(): ''' Return the actual lxc client version .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.version ''' k = 'lxc.version' if not __context__.get(k, None): cversion = __salt__['cmd.run_all']('lxc-info --version') if not cv...
python
def version(): ''' Return the actual lxc client version .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.version ''' k = 'lxc.version' if not __context__.get(k, None): cversion = __salt__['cmd.run_all']('lxc-info --version') if not cv...
[ "def", "version", "(", ")", ":", "k", "=", "'lxc.version'", "if", "not", "__context__", ".", "get", "(", "k", ",", "None", ")", ":", "cversion", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "'lxc-info --version'", ")", "if", "not", "cversion", "[", ...
Return the actual lxc client version .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.version
[ "Return", "the", "actual", "lxc", "client", "version" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L111-L132
33,685
saltstack/salt
salt/modules/lxc.py
search_lxc_bridges
def search_lxc_bridges(): ''' Search which bridges are potentially available as LXC bridges CLI Example: .. code-block:: bash salt '*' lxc.search_lxc_bridges ''' bridges = __context__.get('lxc.bridges', None) # either match not yet called or no bridges were found # to handle ...
python
def search_lxc_bridges(): ''' Search which bridges are potentially available as LXC bridges CLI Example: .. code-block:: bash salt '*' lxc.search_lxc_bridges ''' bridges = __context__.get('lxc.bridges', None) # either match not yet called or no bridges were found # to handle ...
[ "def", "search_lxc_bridges", "(", ")", ":", "bridges", "=", "__context__", ".", "get", "(", "'lxc.bridges'", ",", "None", ")", "# either match not yet called or no bridges were found", "# to handle the case where lxc was not installed on the first", "# call", "if", "not", "br...
Search which bridges are potentially available as LXC bridges CLI Example: .. code-block:: bash salt '*' lxc.search_lxc_bridges
[ "Search", "which", "bridges", "are", "potentially", "available", "as", "LXC", "bridges" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L156-L205
33,686
saltstack/salt
salt/modules/lxc.py
_rand_cpu_str
def _rand_cpu_str(cpu): ''' Return a random subset of cpus for the cpuset config ''' cpu = int(cpu) avail = __salt__['status.nproc']() if cpu < avail: return '0-{0}'.format(avail) to_set = set() while len(to_set) < cpu: choice = random.randint(0, avail - 1) if cho...
python
def _rand_cpu_str(cpu): ''' Return a random subset of cpus for the cpuset config ''' cpu = int(cpu) avail = __salt__['status.nproc']() if cpu < avail: return '0-{0}'.format(avail) to_set = set() while len(to_set) < cpu: choice = random.randint(0, avail - 1) if cho...
[ "def", "_rand_cpu_str", "(", "cpu", ")", ":", "cpu", "=", "int", "(", "cpu", ")", "avail", "=", "__salt__", "[", "'status.nproc'", "]", "(", ")", "if", "cpu", "<", "avail", ":", "return", "'0-{0}'", ".", "format", "(", "avail", ")", "to_set", "=", ...
Return a random subset of cpus for the cpuset config
[ "Return", "a", "random", "subset", "of", "cpus", "for", "the", "cpuset", "config" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L686-L699
33,687
saltstack/salt
salt/modules/lxc.py
_config_list
def _config_list(conf_tuples=None, only_net=False, **kwargs): ''' Return a list of dicts from the salt level configurations conf_tuples _LXCConfig compatible list of entries which can contain - string line - tuple (lxc config param,value) - dict of one entry: {l...
python
def _config_list(conf_tuples=None, only_net=False, **kwargs): ''' Return a list of dicts from the salt level configurations conf_tuples _LXCConfig compatible list of entries which can contain - string line - tuple (lxc config param,value) - dict of one entry: {l...
[ "def", "_config_list", "(", "conf_tuples", "=", "None", ",", "only_net", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# explicit cast", "only_net", "=", "bool", "(", "only_net", ")", "if", "not", "conf_tuples", ":", "conf_tuples", "=", "[", "]", "kw...
Return a list of dicts from the salt level configurations conf_tuples _LXCConfig compatible list of entries which can contain - string line - tuple (lxc config param,value) - dict of one entry: {lxc config param: value) only_net by default we add to the tup...
[ "Return", "a", "list", "of", "dicts", "from", "the", "salt", "level", "configurations" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L915-L951
33,688
saltstack/salt
salt/modules/lxc.py
_get_veths
def _get_veths(net_data): ''' Parse the nic setup inside lxc conf tuples back to a dictionary indexed by network interface ''' if isinstance(net_data, dict): net_data = list(net_data.items()) nics = salt.utils.odict.OrderedDict() current_nic = salt.utils.odict.OrderedDict() no_na...
python
def _get_veths(net_data): ''' Parse the nic setup inside lxc conf tuples back to a dictionary indexed by network interface ''' if isinstance(net_data, dict): net_data = list(net_data.items()) nics = salt.utils.odict.OrderedDict() current_nic = salt.utils.odict.OrderedDict() no_na...
[ "def", "_get_veths", "(", "net_data", ")", ":", "if", "isinstance", "(", "net_data", ",", "dict", ")", ":", "net_data", "=", "list", "(", "net_data", ".", "items", "(", ")", ")", "nics", "=", "salt", ".", "utils", ".", "odict", ".", "OrderedDict", "(...
Parse the nic setup inside lxc conf tuples back to a dictionary indexed by network interface
[ "Parse", "the", "nic", "setup", "inside", "lxc", "conf", "tuples", "back", "to", "a", "dictionary", "indexed", "by", "network", "interface" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L954-L985
33,689
saltstack/salt
salt/modules/lxc.py
_get_base
def _get_base(**kwargs): ''' If the needed base does not exist, then create it, if it does exist create nothing and return the name of the base lxc container so it can be cloned. ''' profile = get_container_profile(copy.deepcopy(kwargs.get('profile'))) kw_overrides = copy.deepcopy(kwargs) ...
python
def _get_base(**kwargs): ''' If the needed base does not exist, then create it, if it does exist create nothing and return the name of the base lxc container so it can be cloned. ''' profile = get_container_profile(copy.deepcopy(kwargs.get('profile'))) kw_overrides = copy.deepcopy(kwargs) ...
[ "def", "_get_base", "(", "*", "*", "kwargs", ")", ":", "profile", "=", "get_container_profile", "(", "copy", ".", "deepcopy", "(", "kwargs", ".", "get", "(", "'profile'", ")", ")", ")", "kw_overrides", "=", "copy", ".", "deepcopy", "(", "kwargs", ")", ...
If the needed base does not exist, then create it, if it does exist create nothing and return the name of the base lxc container so it can be cloned.
[ "If", "the", "needed", "base", "does", "not", "exist", "then", "create", "it", "if", "it", "does", "exist", "create", "nothing", "and", "return", "the", "name", "of", "the", "base", "lxc", "container", "so", "it", "can", "be", "cloned", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1070-L1122
33,690
saltstack/salt
salt/modules/lxc.py
cloud_init
def cloud_init(name, vm_=None, **kwargs): ''' Thin wrapper to lxc.init to be used from the saltcloud lxc driver name Name of the container may be None and then guessed from saltcloud mapping `vm_` saltcloud mapping defaults for the vm CLI Example: .. code-block:: bash ...
python
def cloud_init(name, vm_=None, **kwargs): ''' Thin wrapper to lxc.init to be used from the saltcloud lxc driver name Name of the container may be None and then guessed from saltcloud mapping `vm_` saltcloud mapping defaults for the vm CLI Example: .. code-block:: bash ...
[ "def", "cloud_init", "(", "name", ",", "vm_", "=", "None", ",", "*", "*", "kwargs", ")", ":", "init_interface", "=", "cloud_init_interface", "(", "name", ",", "vm_", ",", "*", "*", "kwargs", ")", "name", "=", "init_interface", ".", "pop", "(", "'name'"...
Thin wrapper to lxc.init to be used from the saltcloud lxc driver name Name of the container may be None and then guessed from saltcloud mapping `vm_` saltcloud mapping defaults for the vm CLI Example: .. code-block:: bash salt '*' lxc.cloud_init foo
[ "Thin", "wrapper", "to", "lxc", ".", "init", "to", "be", "used", "from", "the", "saltcloud", "lxc", "driver" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1645-L1663
33,691
saltstack/salt
salt/modules/lxc.py
clone
def clone(name, orig, profile=None, network_profile=None, nic_opts=None, **kwargs): ''' Create a new container as a clone of another container name Name of the container orig Name of the original container to be cloned profile ...
python
def clone(name, orig, profile=None, network_profile=None, nic_opts=None, **kwargs): ''' Create a new container as a clone of another container name Name of the container orig Name of the original container to be cloned profile ...
[ "def", "clone", "(", "name", ",", "orig", ",", "profile", "=", "None", ",", "network_profile", "=", "None", ",", "nic_opts", "=", "None", ",", "*", "*", "kwargs", ")", ":", "profile", "=", "get_container_profile", "(", "copy", ".", "deepcopy", "(", "pr...
Create a new container as a clone of another container name Name of the container orig Name of the original container to be cloned profile Profile to use in container cloning (see :mod:`lxc.get_container_profile <salt.modules.lxc.get_container_profile>`). Values in...
[ "Create", "a", "new", "container", "as", "a", "clone", "of", "another", "container" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L1987-L2106
33,692
saltstack/salt
salt/modules/lxc.py
ls_
def ls_(active=None, cache=True, path=None): ''' Return a list of the containers available on the minion path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 active If ``True``, return only active (i.e. running) containe...
python
def ls_(active=None, cache=True, path=None): ''' Return a list of the containers available on the minion path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 active If ``True``, return only active (i.e. running) containe...
[ "def", "ls_", "(", "active", "=", "None", ",", "cache", "=", "True", ",", "path", "=", "None", ")", ":", "contextvar", "=", "'lxc.ls{0}'", ".", "format", "(", "path", ")", "if", "active", ":", "contextvar", "+=", "'.active'", "if", "cache", "and", "(...
Return a list of the containers available on the minion path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 active If ``True``, return only active (i.e. running) containers .. versionadded:: 2015.5.0 CLI Example: ...
[ "Return", "a", "list", "of", "the", "containers", "available", "on", "the", "minion" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2109-L2147
33,693
saltstack/salt
salt/modules/lxc.py
list_
def list_(extra=False, limit=None, path=None): ''' List containers classified by state extra Also get per-container specific info. This will change the return data. Instead of returning a list of containers, a dictionary of containers and each container's output from :mod:`lxc.info ...
python
def list_(extra=False, limit=None, path=None): ''' List containers classified by state extra Also get per-container specific info. This will change the return data. Instead of returning a list of containers, a dictionary of containers and each container's output from :mod:`lxc.info ...
[ "def", "list_", "(", "extra", "=", "False", ",", "limit", "=", "None", ",", "path", "=", "None", ")", ":", "ctnrs", "=", "ls_", "(", "path", "=", "path", ")", "if", "extra", ":", "stopped", "=", "{", "}", "frozen", "=", "{", "}", "running", "="...
List containers classified by state extra Also get per-container specific info. This will change the return data. Instead of returning a list of containers, a dictionary of containers and each container's output from :mod:`lxc.info <salt.modules.lxc.info>`. path path to...
[ "List", "containers", "classified", "by", "state" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2150-L2235
33,694
saltstack/salt
salt/modules/lxc.py
_ensure_exists
def _ensure_exists(name, path=None): ''' Raise an exception if the container does not exist ''' if not exists(name, path=path): raise CommandExecutionError( 'Container \'{0}\' does not exist'.format(name) )
python
def _ensure_exists(name, path=None): ''' Raise an exception if the container does not exist ''' if not exists(name, path=path): raise CommandExecutionError( 'Container \'{0}\' does not exist'.format(name) )
[ "def", "_ensure_exists", "(", "name", ",", "path", "=", "None", ")", ":", "if", "not", "exists", "(", "name", ",", "path", "=", "path", ")", ":", "raise", "CommandExecutionError", "(", "'Container \\'{0}\\' does not exist'", ".", "format", "(", "name", ")", ...
Raise an exception if the container does not exist
[ "Raise", "an", "exception", "if", "the", "container", "does", "not", "exist" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2302-L2309
33,695
saltstack/salt
salt/modules/lxc.py
_ensure_running
def _ensure_running(name, no_start=False, path=None): ''' If the container is not currently running, start it. This function returns the state that the container was in before changing path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: ...
python
def _ensure_running(name, no_start=False, path=None): ''' If the container is not currently running, start it. This function returns the state that the container was in before changing path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: ...
[ "def", "_ensure_running", "(", "name", ",", "no_start", "=", "False", ",", "path", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "pre", "=", "state", "(", "name", ",", "path", "=", "path", ")", "if", "pre", "=...
If the container is not currently running, start it. This function returns the state that the container was in before changing path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0
[ "If", "the", "container", "is", "not", "currently", "running", "start", "it", ".", "This", "function", "returns", "the", "state", "that", "the", "container", "was", "in", "before", "changing" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2312-L2340
33,696
saltstack/salt
salt/modules/lxc.py
stop
def stop(name, kill=False, path=None, use_vt=None): ''' Stop the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 kill: False Do not wait for the container to stop, kill all tasks in the container. ...
python
def stop(name, kill=False, path=None, use_vt=None): ''' Stop the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 kill: False Do not wait for the container to stop, kill all tasks in the container. ...
[ "def", "stop", "(", "name", ",", "kill", "=", "False", ",", "path", "=", "None", ",", "use_vt", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "orig_state", "=", "state", "(", "name", ",", "path", "=", "path", ...
Stop the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 kill: False Do not wait for the container to stop, kill all tasks in the container. Older LXC versions will stop containers like this irrespec...
[ "Stop", "the", "named", "container" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2440-L2481
33,697
saltstack/salt
salt/modules/lxc.py
freeze
def freeze(name, **kwargs): ''' Freeze the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 start : False If ``True`` and the container is stopped, the container will be started before attempt...
python
def freeze(name, **kwargs): ''' Freeze the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 start : False If ``True`` and the container is stopped, the container will be started before attempt...
[ "def", "freeze", "(", "name", ",", "*", "*", "kwargs", ")", ":", "use_vt", "=", "kwargs", ".", "get", "(", "'use_vt'", ",", "None", ")", "path", "=", "kwargs", ".", "get", "(", "'path'", ",", "None", ")", "_ensure_exists", "(", "name", ",", "path",...
Freeze the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 start : False If ``True`` and the container is stopped, the container will be started before attempting to freeze. .. versionadded:...
[ "Freeze", "the", "named", "container" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2484-L2530
33,698
saltstack/salt
salt/modules/lxc.py
unfreeze
def unfreeze(name, path=None, use_vt=None): ''' Unfreeze the named container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 use_vt run the command through VT .. versionadded:: 2015.8.0 CLI Example: ...
python
def unfreeze(name, path=None, use_vt=None): ''' Unfreeze the named container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 use_vt run the command through VT .. versionadded:: 2015.8.0 CLI Example: ...
[ "def", "unfreeze", "(", "name", ",", "path", "=", "None", ",", "use_vt", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "if", "state", "(", "name", ",", "path", "=", "path", ")", "==", "'stopped'", ":", "raise"...
Unfreeze the named container. path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 use_vt run the command through VT .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt '*' lxc.unfreeze ...
[ "Unfreeze", "the", "named", "container", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2533-L2562
33,699
saltstack/salt
salt/modules/lxc.py
destroy
def destroy(name, stop=False, path=None): ''' Destroy the named container. .. warning:: Destroys all data associated with the container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 stop : False If ``True``, the c...
python
def destroy(name, stop=False, path=None): ''' Destroy the named container. .. warning:: Destroys all data associated with the container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 stop : False If ``True``, the c...
[ "def", "destroy", "(", "name", ",", "stop", "=", "False", ",", "path", "=", "None", ")", ":", "_ensure_exists", "(", "name", ",", "path", "=", "path", ")", "if", "not", "stop", "and", "state", "(", "name", ",", "path", "=", "path", ")", "!=", "'s...
Destroy the named container. .. warning:: Destroys all data associated with the container. path path to the container parent directory (default: /var/lib/lxc) .. versionadded:: 2015.8.0 stop : False If ``True``, the container will be destroyed even if it is runni...
[ "Destroy", "the", "named", "container", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2565-L2600