partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
diff
Returns the difference between the candidate and the current configuration id : 0 The rollback ID value (0-49) CLI Example: .. code-block:: bash salt 'device_name' junos.diff 3
salt/modules/junos.py
def diff(**kwargs): ''' Returns the difference between the candidate and the current configuration id : 0 The rollback ID value (0-49) CLI Example: .. code-block:: bash salt 'device_name' junos.diff 3 ''' kwargs = salt.utils.args.clean_kwargs(**kwargs) id_ = kwargs.po...
def diff(**kwargs): ''' Returns the difference between the candidate and the current configuration id : 0 The rollback ID value (0-49) CLI Example: .. code-block:: bash salt 'device_name' junos.diff 3 ''' kwargs = salt.utils.args.clean_kwargs(**kwargs) id_ = kwargs.po...
[ "Returns", "the", "difference", "between", "the", "candidate", "and", "the", "current", "configuration" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L534-L562
[ "def", "diff", "(", "*", "*", "kwargs", ")", ":", "kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "kwargs", ")", "id_", "=", "kwargs", ".", "pop", "(", "'id'", ",", "0", ")", "if", "kwargs", ":", "salt", "....
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ping
Send a ping RPC to a device dest_ip The IP of the device to ping dev_timeout : 30 The NETCONF RPC timeout (in seconds) rapid : False When ``True``, executes ping at 100pps instead of 1pps ttl Maximum number of IP routers (IP hops) allowed between source and dest...
salt/modules/junos.py
def ping(dest_ip=None, **kwargs): ''' Send a ping RPC to a device dest_ip The IP of the device to ping dev_timeout : 30 The NETCONF RPC timeout (in seconds) rapid : False When ``True``, executes ping at 100pps instead of 1pps ttl Maximum number of IP routers (IP...
def ping(dest_ip=None, **kwargs): ''' Send a ping RPC to a device dest_ip The IP of the device to ping dev_timeout : 30 The NETCONF RPC timeout (in seconds) rapid : False When ``True``, executes ping at 100pps instead of 1pps ttl Maximum number of IP routers (IP...
[ "Send", "a", "ping", "RPC", "to", "a", "device" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L566-L625
[ "def", "ping", "(", "dest_ip", "=", "None", ",", "*", "*", "kwargs", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "ret", "=", "{", "}", "if", "dest_ip", "is", "None", ":", "ret", "[", "'message'", "]", "=", "'Please speci...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
cli
Executes the CLI commands and returns the output in specified format. \ (default is text) The output can also be stored in a file. command (required) The command to execute on the Junos CLI format : text Format in which to get the CLI output (either ``text`` or ``xml``) dev_timeout : ...
salt/modules/junos.py
def cli(command=None, **kwargs): ''' Executes the CLI commands and returns the output in specified format. \ (default is text) The output can also be stored in a file. command (required) The command to execute on the Junos CLI format : text Format in which to get the CLI output (ei...
def cli(command=None, **kwargs): ''' Executes the CLI commands and returns the output in specified format. \ (default is text) The output can also be stored in a file. command (required) The command to execute on the Junos CLI format : text Format in which to get the CLI output (ei...
[ "Executes", "the", "CLI", "commands", "and", "returns", "the", "output", "in", "specified", "format", ".", "\\", "(", "default", "is", "text", ")", "The", "output", "can", "also", "be", "stored", "in", "a", "file", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L629-L693
[ "def", "cli", "(", "command", "=", "None", ",", "*", "*", "kwargs", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "format_", "=", "kwargs", ".", "pop", "(", "'format'", ",", "'text'", ")", "if", "not", "format_", ":", "for...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
shutdown
Shut down (power off) or reboot a device running Junos OS. This includes all Routing Engines in a Virtual Chassis or a dual Routing Engine system. .. note:: One of ``shutdown`` or ``reboot`` must be set to ``True`` or no action will be taken. shutdown : False Set this to ``True...
salt/modules/junos.py
def shutdown(**kwargs): ''' Shut down (power off) or reboot a device running Junos OS. This includes all Routing Engines in a Virtual Chassis or a dual Routing Engine system. .. note:: One of ``shutdown`` or ``reboot`` must be set to ``True`` or no action will be taken. shutd...
def shutdown(**kwargs): ''' Shut down (power off) or reboot a device running Junos OS. This includes all Routing Engines in a Virtual Chassis or a dual Routing Engine system. .. note:: One of ``shutdown`` or ``reboot`` must be set to ``True`` or no action will be taken. shutd...
[ "Shut", "down", "(", "power", "off", ")", "or", "reboot", "a", "device", "running", "Junos", "OS", ".", "This", "includes", "all", "Routing", "Engines", "in", "a", "Virtual", "Chassis", "or", "a", "dual", "Routing", "Engine", "system", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L696-L768
[ "def", "shutdown", "(", "*", "*", "kwargs", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "ret", "=", "{", "}", "sw", "=", "SW", "(", "conn", ")", "op", "=", "{", "}", "if", "'__pub_arg'", "in", "kwargs", ":", "if", "k...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
install_config
Installs the given configuration file into the candidate configuration. Commits the changes if the commit checks or throws an error. path (required) Path where the configuration/template file is present. If the file has a ``.conf`` extension, the content is treated as text format. If the ...
salt/modules/junos.py
def install_config(path=None, **kwargs): ''' Installs the given configuration file into the candidate configuration. Commits the changes if the commit checks or throws an error. path (required) Path where the configuration/template file is present. If the file has a ``.conf`` extension,...
def install_config(path=None, **kwargs): ''' Installs the given configuration file into the candidate configuration. Commits the changes if the commit checks or throws an error. path (required) Path where the configuration/template file is present. If the file has a ``.conf`` extension,...
[ "Installs", "the", "given", "configuration", "file", "into", "the", "candidate", "configuration", ".", "Commits", "the", "changes", "if", "the", "commit", "checks", "or", "throws", "an", "error", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L772-L975
[ "def", "install_config", "(", "path", "=", "None", ",", "*", "*", "kwargs", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "ret", "=", "{", "}", "ret", "[", "'out'", "]", "=", "True", "if", "path", "is", "None", ":", "ret...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
zeroize
Resets the device to default factory settings CLI Example: .. code-block:: bash salt 'device_name' junos.zeroize
salt/modules/junos.py
def zeroize(): ''' Resets the device to default factory settings CLI Example: .. code-block:: bash salt 'device_name' junos.zeroize ''' conn = __proxy__['junos.conn']() ret = {} ret['out'] = True try: conn.cli('request system zeroize') ret['message'] = 'Com...
def zeroize(): ''' Resets the device to default factory settings CLI Example: .. code-block:: bash salt 'device_name' junos.zeroize ''' conn = __proxy__['junos.conn']() ret = {} ret['out'] = True try: conn.cli('request system zeroize') ret['message'] = 'Com...
[ "Resets", "the", "device", "to", "default", "factory", "settings" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L978-L998
[ "def", "zeroize", "(", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "ret", "=", "{", "}", "ret", "[", "'out'", "]", "=", "True", "try", ":", "conn", ".", "cli", "(", "'request system zeroize'", ")", "ret", "[", "'message'",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
install_os
Installs the given image on the device. After the installation is complete\ the device is rebooted, if reboot=True is given as a keyworded argument. path (required) Path where the image file is present on the proxy minion remote_path : If the value of path is a file path on the local...
salt/modules/junos.py
def install_os(path=None, **kwargs): ''' Installs the given image on the device. After the installation is complete\ the device is rebooted, if reboot=True is given as a keyworded argument. path (required) Path where the image file is present on the proxy minion remote_path : ...
def install_os(path=None, **kwargs): ''' Installs the given image on the device. After the installation is complete\ the device is rebooted, if reboot=True is given as a keyworded argument. path (required) Path where the image file is present on the proxy minion remote_path : ...
[ "Installs", "the", "given", "image", "on", "the", "device", ".", "After", "the", "installation", "is", "complete", "\\", "the", "device", "is", "rebooted", "if", "reboot", "=", "True", "is", "given", "as", "a", "keyworded", "argument", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L1002-L1112
[ "def", "install_os", "(", "path", "=", "None", ",", "*", "*", "kwargs", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "ret", "=", "{", "}", "ret", "[", "'out'", "]", "=", "True", "op", "=", "{", "}", "if", "'__pub_arg'",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
file_copy
Copies the file from the local device to the junos device src The source path where the file is kept. dest The destination path on the where the file will be copied CLI Example: .. code-block:: bash salt 'device_name' junos.file_copy /home/m2/info.txt info_copy.txt
salt/modules/junos.py
def file_copy(src=None, dest=None): ''' Copies the file from the local device to the junos device src The source path where the file is kept. dest The destination path on the where the file will be copied CLI Example: .. code-block:: bash salt 'device_name' junos.fil...
def file_copy(src=None, dest=None): ''' Copies the file from the local device to the junos device src The source path where the file is kept. dest The destination path on the where the file will be copied CLI Example: .. code-block:: bash salt 'device_name' junos.fil...
[ "Copies", "the", "file", "from", "the", "local", "device", "to", "the", "junos", "device" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L1115-L1160
[ "def", "file_copy", "(", "src", "=", "None", ",", "dest", "=", "None", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "ret", "=", "{", "}", "ret", "[", "'out'", "]", "=", "True", "if", "src", "is", "None", ":", "ret", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
lock
Attempts an exclusive lock on the candidate configuration. This is a non-blocking call. .. note:: When locking, it is important to remember to call :py:func:`junos.unlock <salt.modules.junos.unlock>` once finished. If locking during orchestration, remember to include a step in the ...
salt/modules/junos.py
def lock(): ''' Attempts an exclusive lock on the candidate configuration. This is a non-blocking call. .. note:: When locking, it is important to remember to call :py:func:`junos.unlock <salt.modules.junos.unlock>` once finished. If locking during orchestration, remember to inc...
def lock(): ''' Attempts an exclusive lock on the candidate configuration. This is a non-blocking call. .. note:: When locking, it is important to remember to call :py:func:`junos.unlock <salt.modules.junos.unlock>` once finished. If locking during orchestration, remember to inc...
[ "Attempts", "an", "exclusive", "lock", "on", "the", "candidate", "configuration", ".", "This", "is", "a", "non", "-", "blocking", "call", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L1163-L1190
[ "def", "lock", "(", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "ret", "=", "{", "}", "ret", "[", "'out'", "]", "=", "True", "try", ":", "conn", ".", "cu", ".", "lock", "(", ")", "ret", "[", "'message'", "]", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
unlock
Unlocks the candidate configuration. CLI Example: .. code-block:: bash salt 'device_name' junos.unlock
salt/modules/junos.py
def unlock(): ''' Unlocks the candidate configuration. CLI Example: .. code-block:: bash salt 'device_name' junos.unlock ''' conn = __proxy__['junos.conn']() ret = {} ret['out'] = True try: conn.cu.unlock() ret['message'] = "Successfully unlocked the config...
def unlock(): ''' Unlocks the candidate configuration. CLI Example: .. code-block:: bash salt 'device_name' junos.unlock ''' conn = __proxy__['junos.conn']() ret = {} ret['out'] = True try: conn.cu.unlock() ret['message'] = "Successfully unlocked the config...
[ "Unlocks", "the", "candidate", "configuration", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L1193-L1214
[ "def", "unlock", "(", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "ret", "=", "{", "}", "ret", "[", "'out'", "]", "=", "True", "try", ":", "conn", ".", "cu", ".", "unlock", "(", ")", "ret", "[", "'message'", "]", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
load
Loads the configuration from the file provided onto the device. path (required) Path where the configuration/template file is present. If the file has a ``.conf`` extension, the content is treated as text format. If the file has a ``.xml`` extension, the content is treated as XML format. If...
salt/modules/junos.py
def load(path=None, **kwargs): ''' Loads the configuration from the file provided onto the device. path (required) Path where the configuration/template file is present. If the file has a ``.conf`` extension, the content is treated as text format. If the file has a ``.xml`` extensio...
def load(path=None, **kwargs): ''' Loads the configuration from the file provided onto the device. path (required) Path where the configuration/template file is present. If the file has a ``.conf`` extension, the content is treated as text format. If the file has a ``.xml`` extensio...
[ "Loads", "the", "configuration", "from", "the", "file", "provided", "onto", "the", "device", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L1217-L1341
[ "def", "load", "(", "path", "=", "None", ",", "*", "*", "kwargs", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "ret", "=", "{", "}", "ret", "[", "'out'", "]", "=", "True", "if", "path", "is", "None", ":", "ret", "[", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
commit_check
Perform a commit check on the configuration CLI Example: .. code-block:: bash salt 'device_name' junos.commit_check
salt/modules/junos.py
def commit_check(): ''' Perform a commit check on the configuration CLI Example: .. code-block:: bash salt 'device_name' junos.commit_check ''' conn = __proxy__['junos.conn']() ret = {} ret['out'] = True try: conn.cu.commit_check() ret['message'] = 'Commit ...
def commit_check(): ''' Perform a commit check on the configuration CLI Example: .. code-block:: bash salt 'device_name' junos.commit_check ''' conn = __proxy__['junos.conn']() ret = {} ret['out'] = True try: conn.cu.commit_check() ret['message'] = 'Commit ...
[ "Perform", "a", "commit", "check", "on", "the", "configuration" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L1344-L1364
[ "def", "commit_check", "(", ")", ":", "conn", "=", "__proxy__", "[", "'junos.conn'", "]", "(", ")", "ret", "=", "{", "}", "ret", "[", "'out'", "]", "=", "True", "try", ":", "conn", ".", "cu", ".", "commit_check", "(", ")", "ret", "[", "'message'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_table
Retrieve data from a Junos device using Tables/Views table (required) Name of PyEZ Table table_file (required) YAML file that has the table specified in table parameter path: Path of location of the YAML file. defaults to op directory in jnpr.junos.op target: ...
salt/modules/junos.py
def get_table(table, table_file, path=None, target=None, key=None, key_items=None, filters=None, template_args=None): ''' Retrieve data from a Junos device using Tables/Views table (required) Name of PyEZ Table table_file (required) YAML file that has the table specified ...
def get_table(table, table_file, path=None, target=None, key=None, key_items=None, filters=None, template_args=None): ''' Retrieve data from a Junos device using Tables/Views table (required) Name of PyEZ Table table_file (required) YAML file that has the table specified ...
[ "Retrieve", "data", "from", "a", "Junos", "device", "using", "Tables", "/", "Views" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/junos.py#L1367-L1478
[ "def", "get_table", "(", "table", ",", "table_file", ",", "path", "=", "None", ",", "target", "=", "None", ",", "key", "=", "None", ",", "key_items", "=", "None", ",", "filters", "=", "None", ",", "template_args", "=", "None", ")", ":", "conn", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
mount
Mount an image CLI Example: .. code-block:: bash salt '*' guest.mount /srv/images/fedora.qcow
salt/modules/guestfs.py
def mount(location, access='rw', root=None): ''' Mount an image CLI Example: .. code-block:: bash salt '*' guest.mount /srv/images/fedora.qcow ''' if root is None: root = os.path.join( tempfile.gettempdir(), 'guest', location.lstrip(os.sep)....
def mount(location, access='rw', root=None): ''' Mount an image CLI Example: .. code-block:: bash salt '*' guest.mount /srv/images/fedora.qcow ''' if root is None: root = os.path.join( tempfile.gettempdir(), 'guest', location.lstrip(os.sep)....
[ "Mount", "an", "image" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/guestfs.py#L30-L68
[ "def", "mount", "(", "location", ",", "access", "=", "'rw'", ",", "root", "=", "None", ")", ":", "if", "root", "is", "None", ":", "root", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "(", ")", ",", "'guest'", ",", "loc...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure the user exists on the Dell DRAC name: The users username password The password used to authenticate permission The permissions that should be assigned to a user
salt/states/drac.py
def present(name, password, permission): ''' Ensure the user exists on the Dell DRAC name: The users username password The password used to authenticate permission The permissions that should be assigned to a user ''' ret = {'name': name, 'result': True,...
def present(name, password, permission): ''' Ensure the user exists on the Dell DRAC name: The users username password The password used to authenticate permission The permissions that should be assigned to a user ''' ret = {'name': name, 'result': True,...
[ "Ensure", "the", "user", "exists", "on", "the", "Dell", "DRAC" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/drac.py#L55-L94
[ "def", "present", "(", "name", ",", "password", ",", "permission", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", "}", "users", "=", "__salt__", "[", "'d...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
network
Ensure the DRAC network settings are consistent
salt/states/drac.py
def network(ip, netmask, gateway): ''' Ensure the DRAC network settings are consistent ''' ret = {'name': ip, 'result': True, 'changes': {}, 'comment': ''} current_network = __salt__['drac.network_info']() new_network = {} if ip != current_network['IPv4 set...
def network(ip, netmask, gateway): ''' Ensure the DRAC network settings are consistent ''' ret = {'name': ip, 'result': True, 'changes': {}, 'comment': ''} current_network = __salt__['drac.network_info']() new_network = {} if ip != current_network['IPv4 set...
[ "Ensure", "the", "DRAC", "network", "settings", "are", "consistent" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/drac.py#L133-L173
[ "def", "network", "(", "ip", ",", "netmask", ",", "gateway", ")", ":", "ret", "=", "{", "'name'", ":", "ip", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", "}", "current_network", "=", "__salt__", "[", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
AsyncPushChannel.factory
If we have additional IPC transports other than UxD and TCP, add them here
salt/transport/client.py
def factory(opts, **kwargs): ''' If we have additional IPC transports other than UxD and TCP, add them here ''' # FIXME for now, just UXD # Obviously, this makes the factory approach pointless, but we'll extend later import salt.transport.ipc return salt.transport...
def factory(opts, **kwargs): ''' If we have additional IPC transports other than UxD and TCP, add them here ''' # FIXME for now, just UXD # Obviously, this makes the factory approach pointless, but we'll extend later import salt.transport.ipc return salt.transport...
[ "If", "we", "have", "additional", "IPC", "transports", "other", "than", "UxD", "and", "TCP", "add", "them", "here" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/client.py#L193-L200
[ "def", "factory", "(", "opts", ",", "*", "*", "kwargs", ")", ":", "# FIXME for now, just UXD", "# Obviously, this makes the factory approach pointless, but we'll extend later", "import", "salt", ".", "transport", ".", "ipc", "return", "salt", ".", "transport", ".", "ipc...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
AsyncPullChannel.factory
If we have additional IPC transports other than UXD and TCP, add them here
salt/transport/client.py
def factory(opts, **kwargs): ''' If we have additional IPC transports other than UXD and TCP, add them here ''' import salt.transport.ipc return salt.transport.ipc.IPCMessageServer(opts, **kwargs)
def factory(opts, **kwargs): ''' If we have additional IPC transports other than UXD and TCP, add them here ''' import salt.transport.ipc return salt.transport.ipc.IPCMessageServer(opts, **kwargs)
[ "If", "we", "have", "additional", "IPC", "transports", "other", "than", "UXD", "and", "TCP", "add", "them", "here" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/client.py#L208-L213
[ "def", "factory", "(", "opts", ",", "*", "*", "kwargs", ")", ":", "import", "salt", ".", "transport", ".", "ipc", "return", "salt", ".", "transport", ".", "ipc", ".", "IPCMessageServer", "(", "opts", ",", "*", "*", "kwargs", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_
List currently configured reactors CLI Example: .. code-block:: bash salt-run reactor.list
salt/runners/reactor.py
def list_(saltenv='base', test=None): ''' List currently configured reactors CLI Example: .. code-block:: bash salt-run reactor.list ''' sevent = salt.utils.event.get_event( 'master', __opts__['sock_dir'], __opts__['transport'], opts=__o...
def list_(saltenv='base', test=None): ''' List currently configured reactors CLI Example: .. code-block:: bash salt-run reactor.list ''' sevent = salt.utils.event.get_event( 'master', __opts__['sock_dir'], __opts__['transport'], opts=__o...
[ "List", "currently", "configured", "reactors" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/reactor.py#L36-L59
[ "def", "list_", "(", "saltenv", "=", "'base'", ",", "test", "=", "None", ")", ":", "sevent", "=", "salt", ".", "utils", ".", "event", ".", "get_event", "(", "'master'", ",", "__opts__", "[", "'sock_dir'", "]", ",", "__opts__", "[", "'transport'", "]", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
add
Add a new reactor CLI Example: .. code-block:: bash salt-run reactor.add 'salt/cloud/*/destroyed' reactors='/srv/reactor/destroy/*.sls'
salt/runners/reactor.py
def add(event, reactors, saltenv='base', test=None): ''' Add a new reactor CLI Example: .. code-block:: bash salt-run reactor.add 'salt/cloud/*/destroyed' reactors='/srv/reactor/destroy/*.sls' ''' if isinstance(reactors, string_types): reactors = [reactors] sevent = salt....
def add(event, reactors, saltenv='base', test=None): ''' Add a new reactor CLI Example: .. code-block:: bash salt-run reactor.add 'salt/cloud/*/destroyed' reactors='/srv/reactor/destroy/*.sls' ''' if isinstance(reactors, string_types): reactors = [reactors] sevent = salt....
[ "Add", "a", "new", "reactor" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/reactor.py#L62-L90
[ "def", "add", "(", "event", ",", "reactors", ",", "saltenv", "=", "'base'", ",", "test", "=", "None", ")", ":", "if", "isinstance", "(", "reactors", ",", "string_types", ")", ":", "reactors", "=", "[", "reactors", "]", "sevent", "=", "salt", ".", "ut...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Delete a reactor CLI Example: .. code-block:: bash salt-run reactor.delete 'salt/cloud/*/destroyed'
salt/runners/reactor.py
def delete(event, saltenv='base', test=None): ''' Delete a reactor CLI Example: .. code-block:: bash salt-run reactor.delete 'salt/cloud/*/destroyed' ''' sevent = salt.utils.event.get_event( 'master', __opts__['sock_dir'], __opts__['transport'], ...
def delete(event, saltenv='base', test=None): ''' Delete a reactor CLI Example: .. code-block:: bash salt-run reactor.delete 'salt/cloud/*/destroyed' ''' sevent = salt.utils.event.get_event( 'master', __opts__['sock_dir'], __opts__['transport'], ...
[ "Delete", "a", "reactor" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/reactor.py#L93-L115
[ "def", "delete", "(", "event", ",", "saltenv", "=", "'base'", ",", "test", "=", "None", ")", ":", "sevent", "=", "salt", ".", "utils", ".", "event", ".", "get_event", "(", "'master'", ",", "__opts__", "[", "'sock_dir'", "]", ",", "__opts__", "[", "'t...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ip_bracket
Convert IP address representation to ZMQ (URL) format. ZMQ expects brackets around IPv6 literals, since they are used in URLs.
salt/utils/zeromq.py
def ip_bracket(addr): ''' Convert IP address representation to ZMQ (URL) format. ZMQ expects brackets around IPv6 literals, since they are used in URLs. ''' addr = ipaddress.ip_address(addr) return ('[{}]' if addr.version == 6 else '{}').format(addr)
def ip_bracket(addr): ''' Convert IP address representation to ZMQ (URL) format. ZMQ expects brackets around IPv6 literals, since they are used in URLs. ''' addr = ipaddress.ip_address(addr) return ('[{}]' if addr.version == 6 else '{}').format(addr)
[ "Convert", "IP", "address", "representation", "to", "ZMQ", "(", "URL", ")", "format", ".", "ZMQ", "expects", "brackets", "around", "IPv6", "literals", "since", "they", "are", "used", "in", "URLs", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/zeromq.py#L81-L87
[ "def", "ip_bracket", "(", "addr", ")", ":", "addr", "=", "ipaddress", ".", "ip_address", "(", "addr", ")", "return", "(", "'[{}]'", "if", "addr", ".", "version", "==", "6", "else", "'{}'", ")", ".", "format", "(", "addr", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
output
Display output for the salt-run virt.query function
salt/output/virt_query.py
def output(data, **kwargs): # pylint: disable=unused-argument ''' Display output for the salt-run virt.query function ''' out = '' for id_ in data['data']: out += '{0}\n'.format(id_) for vm_ in data['data'][id_]['vm_info']: out += ' {0}\n'.format(vm_) vm_dat...
def output(data, **kwargs): # pylint: disable=unused-argument ''' Display output for the salt-run virt.query function ''' out = '' for id_ in data['data']: out += '{0}\n'.format(id_) for vm_ in data['data'][id_]['vm_info']: out += ' {0}\n'.format(vm_) vm_dat...
[ "Display", "output", "for", "the", "salt", "-", "run", "virt", ".", "query", "function" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/virt_query.py#L17-L50
[ "def", "output", "(", "data", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "out", "=", "''", "for", "id_", "in", "data", "[", "'data'", "]", ":", "out", "+=", "'{0}\\n'", ".", "format", "(", "id_", ")", "for", "vm_", "in", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_interface_configs
Return all interface configs
salt/modules/win_ip.py
def _interface_configs(): ''' Return all interface configs ''' cmd = ['netsh', 'interface', 'ip', 'show', 'config'] lines = __salt__['cmd.run'](cmd, python_shell=False).splitlines() ret = {} current_iface = None current_ip_list = None for line in lines: line = line.strip() ...
def _interface_configs(): ''' Return all interface configs ''' cmd = ['netsh', 'interface', 'ip', 'show', 'config'] lines = __salt__['cmd.run'](cmd, python_shell=False).splitlines() ret = {} current_iface = None current_ip_list = None for line in lines: line = line.strip() ...
[ "Return", "all", "interface", "configs" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_ip.py#L37-L90
[ "def", "_interface_configs", "(", ")", ":", "cmd", "=", "[", "'netsh'", ",", "'interface'", ",", "'ip'", ",", "'show'", ",", "'config'", "]", "lines", "=", "__salt__", "[", "'cmd.run'", "]", "(", "cmd", ",", "python_shell", "=", "False", ")", ".", "spl...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
is_enabled
Returns ``True`` if interface is enabled, otherwise ``False`` CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.is_enabled 'Local Area Connection #2'
salt/modules/win_ip.py
def is_enabled(iface): ''' Returns ``True`` if interface is enabled, otherwise ``False`` CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.is_enabled 'Local Area Connection #2' ''' cmd = ['netsh', 'interface', 'show', 'interface', 'name={0}'.format(iface)] iface_fou...
def is_enabled(iface): ''' Returns ``True`` if interface is enabled, otherwise ``False`` CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.is_enabled 'Local Area Connection #2' ''' cmd = ['netsh', 'interface', 'show', 'interface', 'name={0}'.format(iface)] iface_fou...
[ "Returns", "True", "if", "interface", "is", "enabled", "otherwise", "False" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_ip.py#L133-L153
[ "def", "is_enabled", "(", "iface", ")", ":", "cmd", "=", "[", "'netsh'", ",", "'interface'", ",", "'show'", ",", "'interface'", ",", "'name={0}'", ".", "format", "(", "iface", ")", "]", "iface_found", "=", "False", "for", "line", "in", "__salt__", "[", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
enable
Enable an interface CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.enable 'Local Area Connection #2'
salt/modules/win_ip.py
def enable(iface): ''' Enable an interface CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.enable 'Local Area Connection #2' ''' if is_enabled(iface): return True cmd = ['netsh', 'interface', 'set', 'interface', 'name={0}'.format(iface), ...
def enable(iface): ''' Enable an interface CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.enable 'Local Area Connection #2' ''' if is_enabled(iface): return True cmd = ['netsh', 'interface', 'set', 'interface', 'name={0}'.format(iface), ...
[ "Enable", "an", "interface" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_ip.py#L169-L185
[ "def", "enable", "(", "iface", ")", ":", "if", "is_enabled", "(", "iface", ")", ":", "return", "True", "cmd", "=", "[", "'netsh'", ",", "'interface'", ",", "'set'", ",", "'interface'", ",", "'name={0}'", ".", "format", "(", "iface", ")", ",", "'admin=E...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
disable
Disable an interface CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.disable 'Local Area Connection #2'
salt/modules/win_ip.py
def disable(iface): ''' Disable an interface CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.disable 'Local Area Connection #2' ''' if is_disabled(iface): return True cmd = ['netsh', 'interface', 'set', 'interface', 'name={0}'.format(iface), ...
def disable(iface): ''' Disable an interface CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.disable 'Local Area Connection #2' ''' if is_disabled(iface): return True cmd = ['netsh', 'interface', 'set', 'interface', 'name={0}'.format(iface), ...
[ "Disable", "an", "interface" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_ip.py#L188-L204
[ "def", "disable", "(", "iface", ")", ":", "if", "is_disabled", "(", "iface", ")", ":", "return", "True", "cmd", "=", "[", "'netsh'", ",", "'interface'", ",", "'set'", ",", "'interface'", ",", "'name={0}'", ".", "format", "(", "iface", ")", ",", "'admin...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_subnet_length
Convenience function to convert the netmask to the CIDR subnet length CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.get_subnet_length 255.255.255.0
salt/modules/win_ip.py
def get_subnet_length(mask): ''' Convenience function to convert the netmask to the CIDR subnet length CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.get_subnet_length 255.255.255.0 ''' if not salt.utils.validate.net.netmask(mask): raise SaltInvocationError( ...
def get_subnet_length(mask): ''' Convenience function to convert the netmask to the CIDR subnet length CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.get_subnet_length 255.255.255.0 ''' if not salt.utils.validate.net.netmask(mask): raise SaltInvocationError( ...
[ "Convenience", "function", "to", "convert", "the", "netmask", "to", "the", "CIDR", "subnet", "length" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_ip.py#L207-L221
[ "def", "get_subnet_length", "(", "mask", ")", ":", "if", "not", "salt", ".", "utils", ".", "validate", ".", "net", ".", "netmask", "(", "mask", ")", ":", "raise", "SaltInvocationError", "(", "'\\'{0}\\' is not a valid netmask'", ".", "format", "(", "mask", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_static_ip
Set static IP configuration on a Windows NIC iface The name of the interface to manage addr IP address with subnet length (ex. ``10.1.2.3/24``). The :mod:`ip.get_subnet_length <salt.modules.win_ip.get_subnet_length>` function can be used to calculate the subnet length from a ne...
salt/modules/win_ip.py
def set_static_ip(iface, addr, gateway=None, append=False): ''' Set static IP configuration on a Windows NIC iface The name of the interface to manage addr IP address with subnet length (ex. ``10.1.2.3/24``). The :mod:`ip.get_subnet_length <salt.modules.win_ip.get_subnet_length...
def set_static_ip(iface, addr, gateway=None, append=False): ''' Set static IP configuration on a Windows NIC iface The name of the interface to manage addr IP address with subnet length (ex. ``10.1.2.3/24``). The :mod:`ip.get_subnet_length <salt.modules.win_ip.get_subnet_length...
[ "Set", "static", "IP", "configuration", "on", "a", "Windows", "NIC" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_ip.py#L224-L304
[ "def", "set_static_ip", "(", "iface", ",", "addr", ",", "gateway", "=", "None", ",", "append", "=", "False", ")", ":", "def", "_find_addr", "(", "iface", ",", "addr", ",", "timeout", "=", "1", ")", ":", "ip", ",", "cidr", "=", "addr", ".", "rsplit"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
set_static_dns
Set static DNS configuration on a Windows NIC Args: iface (str): The name of the interface to set addrs (*): One or more DNS servers to be added. To clear the list of DNS servers pass an empty list (``[]``). If undefined or ``None`` no changes will be made. ...
salt/modules/win_ip.py
def set_static_dns(iface, *addrs): ''' Set static DNS configuration on a Windows NIC Args: iface (str): The name of the interface to set addrs (*): One or more DNS servers to be added. To clear the list of DNS servers pass an empty list (``[]``). If undefined or ``...
def set_static_dns(iface, *addrs): ''' Set static DNS configuration on a Windows NIC Args: iface (str): The name of the interface to set addrs (*): One or more DNS servers to be added. To clear the list of DNS servers pass an empty list (``[]``). If undefined or ``...
[ "Set", "static", "DNS", "configuration", "on", "a", "Windows", "NIC" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_ip.py#L322-L373
[ "def", "set_static_dns", "(", "iface", ",", "*", "addrs", ")", ":", "if", "addrs", "is", "(", ")", "or", "str", "(", "addrs", "[", "0", "]", ")", ".", "lower", "(", ")", "==", "'none'", ":", "return", "{", "'Interface'", ":", "iface", ",", "'DNS ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get_default_gateway
Set DNS source to DHCP on Windows CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.get_default_gateway
salt/modules/win_ip.py
def get_default_gateway(): ''' Set DNS source to DHCP on Windows CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.get_default_gateway ''' try: return next(iter( x.split()[-1] for x in __salt__['cmd.run']( ['netsh', 'interface', 'ip',...
def get_default_gateway(): ''' Set DNS source to DHCP on Windows CLI Example: .. code-block:: bash salt -G 'os_family:Windows' ip.get_default_gateway ''' try: return next(iter( x.split()[-1] for x in __salt__['cmd.run']( ['netsh', 'interface', 'ip',...
[ "Set", "DNS", "source", "to", "DHCP", "on", "Windows" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_ip.py#L406-L425
[ "def", "get_default_gateway", "(", ")", ":", "try", ":", "return", "next", "(", "iter", "(", "x", ".", "split", "(", ")", "[", "-", "1", "]", "for", "x", "in", "__salt__", "[", "'cmd.run'", "]", "(", "[", "'netsh'", ",", "'interface'", ",", "'ip'",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
add
Add the specified group CLI Example: .. code-block:: bash salt '*' group.add foo 3456
salt/modules/mac_group.py
def add(name, gid=None, **kwargs): ''' Add the specified group CLI Example: .. code-block:: bash salt '*' group.add foo 3456 ''' ### NOTE: **kwargs isn't used here but needs to be included in this ### function for compatibility with the group.present state if info(name): ...
def add(name, gid=None, **kwargs): ''' Add the specified group CLI Example: .. code-block:: bash salt '*' group.add foo 3456 ''' ### NOTE: **kwargs isn't used here but needs to be included in this ### function for compatibility with the group.present state if info(name): ...
[ "Add", "the", "specified", "group" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_group.py#L37-L72
[ "def", "add", "(", "name", ",", "gid", "=", "None", ",", "*", "*", "kwargs", ")", ":", "### NOTE: **kwargs isn't used here but needs to be included in this", "### function for compatibility with the group.present state", "if", "info", "(", "name", ")", ":", "raise", "Co...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_list_gids
Return a list of gids in use
salt/modules/mac_group.py
def _list_gids(): ''' Return a list of gids in use ''' output = __salt__['cmd.run']( ['dscacheutil', '-q', 'group'], output_loglevel='quiet', python_shell=False ) ret = set() for line in salt.utils.itertools.split(output, '\n'): if line.startswith('gid:'): ...
def _list_gids(): ''' Return a list of gids in use ''' output = __salt__['cmd.run']( ['dscacheutil', '-q', 'group'], output_loglevel='quiet', python_shell=False ) ret = set() for line in salt.utils.itertools.split(output, '\n'): if line.startswith('gid:'): ...
[ "Return", "a", "list", "of", "gids", "in", "use" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_group.py#L75-L88
[ "def", "_list_gids", "(", ")", ":", "output", "=", "__salt__", "[", "'cmd.run'", "]", "(", "[", "'dscacheutil'", ",", "'-q'", ",", "'group'", "]", ",", "output_loglevel", "=", "'quiet'", ",", "python_shell", "=", "False", ")", "ret", "=", "set", "(", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Remove the named group CLI Example: .. code-block:: bash salt '*' group.delete foo
salt/modules/mac_group.py
def delete(name): ''' Remove the named group CLI Example: .. code-block:: bash salt '*' group.delete foo ''' if salt.utils.stringutils.contains_whitespace(name): raise SaltInvocationError('Group name cannot contain whitespace') if name.startswith('_'): raise SaltIn...
def delete(name): ''' Remove the named group CLI Example: .. code-block:: bash salt '*' group.delete foo ''' if salt.utils.stringutils.contains_whitespace(name): raise SaltInvocationError('Group name cannot contain whitespace') if name.startswith('_'): raise SaltIn...
[ "Remove", "the", "named", "group" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_group.py#L91-L110
[ "def", "delete", "(", "name", ")", ":", "if", "salt", ".", "utils", ".", "stringutils", ".", "contains_whitespace", "(", "name", ")", ":", "raise", "SaltInvocationError", "(", "'Group name cannot contain whitespace'", ")", "if", "name", ".", "startswith", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
members
Replaces members of the group with a provided list. .. versionadded:: 2016.3.0 CLI Example: salt '*' group.members foo 'user1,user2,user3,...' Replaces a membership list for a local group 'foo'.
salt/modules/mac_group.py
def members(name, members_list): ''' Replaces members of the group with a provided list. .. versionadded:: 2016.3.0 CLI Example: salt '*' group.members foo 'user1,user2,user3,...' Replaces a membership list for a local group 'foo'. ''' retcode = 1 grp_info = __salt__['group.i...
def members(name, members_list): ''' Replaces members of the group with a provided list. .. versionadded:: 2016.3.0 CLI Example: salt '*' group.members foo 'user1,user2,user3,...' Replaces a membership list for a local group 'foo'. ''' retcode = 1 grp_info = __salt__['group.i...
[ "Replaces", "members", "of", "the", "group", "with", "a", "provided", "list", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_group.py#L149-L175
[ "def", "members", "(", "name", ",", "members_list", ")", ":", "retcode", "=", "1", "grp_info", "=", "__salt__", "[", "'group.info'", "]", "(", "name", ")", "if", "grp_info", "and", "name", "in", "grp_info", "[", "'name'", "]", ":", "cmd", "=", "'/usr/b...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
info
Return information about a group CLI Example: .. code-block:: bash salt '*' group.info foo
salt/modules/mac_group.py
def info(name): ''' Return information about a group CLI Example: .. code-block:: bash salt '*' group.info foo ''' if salt.utils.stringutils.contains_whitespace(name): raise SaltInvocationError('Group name cannot contain whitespace') try: # getgrnam seems to cache ...
def info(name): ''' Return information about a group CLI Example: .. code-block:: bash salt '*' group.info foo ''' if salt.utils.stringutils.contains_whitespace(name): raise SaltInvocationError('Group name cannot contain whitespace') try: # getgrnam seems to cache ...
[ "Return", "information", "about", "a", "group" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_group.py#L178-L196
[ "def", "info", "(", "name", ")", ":", "if", "salt", ".", "utils", ".", "stringutils", ".", "contains_whitespace", "(", "name", ")", ":", "raise", "SaltInvocationError", "(", "'Group name cannot contain whitespace'", ")", "try", ":", "# getgrnam seems to cache weirdl...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_format_info
Return formatted information in a pretty way.
salt/modules/mac_group.py
def _format_info(data): ''' Return formatted information in a pretty way. ''' return {'name': data.gr_name, 'gid': data.gr_gid, 'passwd': data.gr_passwd, 'members': data.gr_mem}
def _format_info(data): ''' Return formatted information in a pretty way. ''' return {'name': data.gr_name, 'gid': data.gr_gid, 'passwd': data.gr_passwd, 'members': data.gr_mem}
[ "Return", "formatted", "information", "in", "a", "pretty", "way", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_group.py#L199-L206
[ "def", "_format_info", "(", "data", ")", ":", "return", "{", "'name'", ":", "data", ".", "gr_name", ",", "'gid'", ":", "data", ".", "gr_gid", ",", "'passwd'", ":", "data", ".", "gr_passwd", ",", "'members'", ":", "data", ".", "gr_mem", "}" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
getent
Return info on all groups CLI Example: .. code-block:: bash salt '*' group.getent
salt/modules/mac_group.py
def getent(refresh=False): ''' Return info on all groups CLI Example: .. code-block:: bash salt '*' group.getent ''' if 'group.getent' in __context__ and not refresh: return __context__['group.getent'] ret = [] for grinfo in grp.getgrall(): if not grinfo.gr_na...
def getent(refresh=False): ''' Return info on all groups CLI Example: .. code-block:: bash salt '*' group.getent ''' if 'group.getent' in __context__ and not refresh: return __context__['group.getent'] ret = [] for grinfo in grp.getgrall(): if not grinfo.gr_na...
[ "Return", "info", "on", "all", "groups" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_group.py#L209-L227
[ "def", "getent", "(", "refresh", "=", "False", ")", ":", "if", "'group.getent'", "in", "__context__", "and", "not", "refresh", ":", "return", "__context__", "[", "'group.getent'", "]", "ret", "=", "[", "]", "for", "grinfo", "in", "grp", ".", "getgrall", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
chgid
Change the gid for a named group CLI Example: .. code-block:: bash salt '*' group.chgid foo 4376
salt/modules/mac_group.py
def chgid(name, gid): ''' Change the gid for a named group CLI Example: .. code-block:: bash salt '*' group.chgid foo 4376 ''' if not isinstance(gid, int): raise SaltInvocationError('gid must be an integer') pre_gid = __salt__['file.group_to_gid'](name) pre_info = info...
def chgid(name, gid): ''' Change the gid for a named group CLI Example: .. code-block:: bash salt '*' group.chgid foo 4376 ''' if not isinstance(gid, int): raise SaltInvocationError('gid must be an integer') pre_gid = __salt__['file.group_to_gid'](name) pre_info = info...
[ "Change", "the", "gid", "for", "a", "named", "group" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_group.py#L230-L251
[ "def", "chgid", "(", "name", ",", "gid", ")", ":", "if", "not", "isinstance", "(", "gid", ",", "int", ")", ":", "raise", "SaltInvocationError", "(", "'gid must be an integer'", ")", "pre_gid", "=", "__salt__", "[", "'file.group_to_gid'", "]", "(", "name", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
EtcdClient.tree
.. versionadded:: 2014.7.0 Recurse through etcd and return all values
salt/utils/etcd_util.py
def tree(self, path): ''' .. versionadded:: 2014.7.0 Recurse through etcd and return all values ''' ret = {} try: items = self.read(path) except (etcd.EtcdKeyNotFound, ValueError): return None except etcd.EtcdConnectionFailed: ...
def tree(self, path): ''' .. versionadded:: 2014.7.0 Recurse through etcd and return all values ''' ret = {} try: items = self.read(path) except (etcd.EtcdKeyNotFound, ValueError): return None except etcd.EtcdConnectionFailed: ...
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/etcd_util.py#L355-L378
[ "def", "tree", "(", "self", ",", "path", ")", ":", "ret", "=", "{", "}", "try", ":", "items", "=", "self", ".", "read", "(", "path", ")", "except", "(", "etcd", ".", "EtcdKeyNotFound", ",", "ValueError", ")", ":", "return", "None", "except", "etcd"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ext_pillar
Read pillar data from Cobbler via its API.
salt/pillar/cobbler.py
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 key=None, only=()): ''' Read pillar data from Cobbler via its API. ''' url = __opts__['cobbler.url'] user = __opts__['cobbler.user'] password = __opts__['cobbler.password'] log.info("Quer...
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 key=None, only=()): ''' Read pillar data from Cobbler via its API. ''' url = __opts__['cobbler.url'] user = __opts__['cobbler.user'] password = __opts__['cobbler.password'] log.info("Quer...
[ "Read", "pillar", "data", "from", "Cobbler", "via", "its", "API", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/cobbler.py#L44-L72
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "# pylint: disable=W0613", "key", "=", "None", ",", "only", "=", "(", ")", ")", ":", "url", "=", "__opts__", "[", "'cobbler.url'", "]", "user", "=", "__opts__", "[", "'cobbler.user'", "]", "passwor...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_check_and_install_ruby
Verify that ruby is installed, install if unavailable
salt/states/rvm.py
def _check_and_install_ruby(ret, ruby, default=False, user=None, opts=None, env=None): ''' Verify that ruby is installed, install if unavailable ''' ret = _check_ruby(ret, ruby, user=user) if not ret['result']: if __salt__['rvm.install_ruby'](ruby, runas=user, opts=opts, env=env): ...
def _check_and_install_ruby(ret, ruby, default=False, user=None, opts=None, env=None): ''' Verify that ruby is installed, install if unavailable ''' ret = _check_ruby(ret, ruby, user=user) if not ret['result']: if __salt__['rvm.install_ruby'](ruby, runas=user, opts=opts, env=env): ...
[ "Verify", "that", "ruby", "is", "installed", "install", "if", "unavailable" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rvm.py#L119-L138
[ "def", "_check_and_install_ruby", "(", "ret", ",", "ruby", ",", "default", "=", "False", ",", "user", "=", "None", ",", "opts", "=", "None", ",", "env", "=", "None", ")", ":", "ret", "=", "_check_ruby", "(", "ret", ",", "ruby", ",", "user", "=", "u...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_check_ruby
Check that ruby is installed
salt/states/rvm.py
def _check_ruby(ret, ruby, user=None): ''' Check that ruby is installed ''' match_version = True match_micro_version = False micro_version_regex = re.compile(r'-([0-9]{4}\.[0-9]{2}|p[0-9]+)$') if micro_version_regex.search(ruby): match_micro_version = True if re.search('^[a-z]+$'...
def _check_ruby(ret, ruby, user=None): ''' Check that ruby is installed ''' match_version = True match_micro_version = False micro_version_regex = re.compile(r'-([0-9]{4}\.[0-9]{2}|p[0-9]+)$') if micro_version_regex.search(ruby): match_micro_version = True if re.search('^[a-z]+$'...
[ "Check", "that", "ruby", "is", "installed" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rvm.py#L141-L166
[ "def", "_check_ruby", "(", "ret", ",", "ruby", ",", "user", "=", "None", ")", ":", "match_version", "=", "True", "match_micro_version", "=", "False", "micro_version_regex", "=", "re", ".", "compile", "(", "r'-([0-9]{4}\\.[0-9]{2}|p[0-9]+)$'", ")", "if", "micro_v...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
installed
Verify that the specified ruby is installed with RVM. RVM is installed when necessary. name The version of ruby to install default : False Whether to make this ruby the default. user: None The user to run rvm as. env: None A list of environment variables to set (i...
salt/states/rvm.py
def installed(name, default=False, user=None, opts=None, env=None): ''' Verify that the specified ruby is installed with RVM. RVM is installed when necessary. name The version of ruby to install default : False Whether to make this ruby the default. user: None The user...
def installed(name, default=False, user=None, opts=None, env=None): ''' Verify that the specified ruby is installed with RVM. RVM is installed when necessary. name The version of ruby to install default : False Whether to make this ruby the default. user: None The user...
[ "Verify", "that", "the", "specified", "ruby", "is", "installed", "with", "RVM", ".", "RVM", "is", "installed", "when", "necessary", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rvm.py#L169-L205
[ "def", "installed", "(", "name", ",", "default", "=", "False", ",", "user", "=", "None", ",", "opts", "=", "None", ",", "env", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "None", ",", "'comment'", ":", "''...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
gemset_present
Verify that the gemset is present. name The name of the gemset. ruby: default The ruby version this gemset belongs to. user: None The user to run rvm as. .. versionadded:: 0.17.0
salt/states/rvm.py
def gemset_present(name, ruby='default', user=None): ''' Verify that the gemset is present. name The name of the gemset. ruby: default The ruby version this gemset belongs to. user: None The user to run rvm as. .. versionadded:: 0.17.0 ''' ret = {'name': n...
def gemset_present(name, ruby='default', user=None): ''' Verify that the gemset is present. name The name of the gemset. ruby: default The ruby version this gemset belongs to. user: None The user to run rvm as. .. versionadded:: 0.17.0 ''' ret = {'name': n...
[ "Verify", "that", "the", "gemset", "is", "present", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rvm.py#L208-L253
[ "def", "gemset_present", "(", "name", ",", "ruby", "=", "'default'", ",", "user", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "ret",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure that the named tablespace is present with the specified properties. For more information about all of these options run ``man 7 create_tablespace``. name The name of the tablespace to create/manage. directory The directory where the tablespace will be located, must already exist...
salt/states/postgres_tablespace.py
def present(name, directory, options=None, owner=None, user=None, maintenance_db=None, db_password=None, db_host=None, db_port=None, db_user=None): ''' Ensure that the named tablespace is present with the...
def present(name, directory, options=None, owner=None, user=None, maintenance_db=None, db_password=None, db_host=None, db_port=None, db_user=None): ''' Ensure that the named tablespace is present with the...
[ "Ensure", "that", "the", "named", "tablespace", "is", "present", "with", "the", "specified", "properties", ".", "For", "more", "information", "about", "all", "of", "these", "options", "run", "man", "7", "create_tablespace", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/postgres_tablespace.py#L38-L158
[ "def", "present", "(", "name", ",", "directory", ",", "options", "=", "None", ",", "owner", "=", "None", ",", "user", "=", "None", ",", "maintenance_db", "=", "None", ",", "db_password", "=", "None", ",", "db_host", "=", "None", ",", "db_port", "=", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ext_pillar
Execute queries against SQLCipher, merge and return as a dict
salt/pillar/sqlcipher.py
def ext_pillar(minion_id, pillar, *args, **kwargs): ''' Execute queries against SQLCipher, merge and return as a dict ''' return SQLCipherExtPillar().fetch(minion_id, pillar, *args, **kwargs)
def ext_pillar(minion_id, pillar, *args, **kwargs): ''' Execute queries against SQLCipher, merge and return as a dict ''' return SQLCipherExtPillar().fetch(minion_id, pillar, *args, **kwargs)
[ "Execute", "queries", "against", "SQLCipher", "merge", "and", "return", "as", "a", "dict" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/sqlcipher.py#L130-L137
[ "def", "ext_pillar", "(", "minion_id", ",", "pillar", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "SQLCipherExtPillar", "(", ")", ".", "fetch", "(", "minion_id", ",", "pillar", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SQLCipherExtPillar._get_cursor
Yield a SQLCipher cursor
salt/pillar/sqlcipher.py
def _get_cursor(self): ''' Yield a SQLCipher cursor ''' _options = self._get_options() conn = sqlcipher.connect(_options.get('database'), timeout=float(_options.get('timeout'))) conn.execute('pragma key="{0}"'.format(_options.get('pass')))...
def _get_cursor(self): ''' Yield a SQLCipher cursor ''' _options = self._get_options() conn = sqlcipher.connect(_options.get('database'), timeout=float(_options.get('timeout'))) conn.execute('pragma key="{0}"'.format(_options.get('pass')))...
[ "Yield", "a", "SQLCipher", "cursor" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/sqlcipher.py#L113-L127
[ "def", "_get_cursor", "(", "self", ")", ":", "_options", "=", "self", ".", "_get_options", "(", ")", "conn", "=", "sqlcipher", ".", "connect", "(", "_options", ".", "get", "(", "'database'", ")", ",", "timeout", "=", "float", "(", "_options", ".", "get...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_convert_exception
Convert an ldap backend exception to an LDAPError and raise it.
salt/modules/ldap3.py
def _convert_exception(e): '''Convert an ldap backend exception to an LDAPError and raise it.''' args = ('exception in ldap backend: {0}'.format(repr(e)), e) if six.PY2: six.reraise(LDAPError, args, sys.exc_info()[2]) else: six.raise_from(LDAPError(*args), e)
def _convert_exception(e): '''Convert an ldap backend exception to an LDAPError and raise it.''' args = ('exception in ldap backend: {0}'.format(repr(e)), e) if six.PY2: six.reraise(LDAPError, args, sys.exc_info()[2]) else: six.raise_from(LDAPError(*args), e)
[ "Convert", "an", "ldap", "backend", "exception", "to", "an", "LDAPError", "and", "raise", "it", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldap3.py#L53-L59
[ "def", "_convert_exception", "(", "e", ")", ":", "args", "=", "(", "'exception in ldap backend: {0}'", ".", "format", "(", "repr", "(", "e", ")", ")", ",", "e", ")", "if", "six", ".", "PY2", ":", "six", ".", "reraise", "(", "LDAPError", ",", "args", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_bind
Bind helper.
salt/modules/ldap3.py
def _bind(l, bind=None): '''Bind helper.''' if bind is None: return method = bind.get('method', 'simple') if method is None: return elif method == 'simple': l.simple_bind_s(bind.get('dn', ''), bind.get('password', '')) elif method == 'sasl': sasl_class = getattr(l...
def _bind(l, bind=None): '''Bind helper.''' if bind is None: return method = bind.get('method', 'simple') if method is None: return elif method == 'simple': l.simple_bind_s(bind.get('dn', ''), bind.get('password', '')) elif method == 'sasl': sasl_class = getattr(l...
[ "Bind", "helper", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldap3.py#L62-L81
[ "def", "_bind", "(", "l", ",", "bind", "=", "None", ")", ":", "if", "bind", "is", "None", ":", "return", "method", "=", "bind", ".", "get", "(", "'method'", ",", "'simple'", ")", "if", "method", "is", "None", ":", "return", "elif", "method", "==", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
connect
Connect and optionally bind to an LDAP server. :param connect_spec: This can be an LDAP connection object returned by a previous call to :py:func:`connect` (in which case the argument is simply returned), ``None`` (in which case an empty dict is used), or a dict with the following k...
salt/modules/ldap3.py
def connect(connect_spec=None): '''Connect and optionally bind to an LDAP server. :param connect_spec: This can be an LDAP connection object returned by a previous call to :py:func:`connect` (in which case the argument is simply returned), ``None`` (in which case an empty dict is ...
def connect(connect_spec=None): '''Connect and optionally bind to an LDAP server. :param connect_spec: This can be an LDAP connection object returned by a previous call to :py:func:`connect` (in which case the argument is simply returned), ``None`` (in which case an empty dict is ...
[ "Connect", "and", "optionally", "bind", "to", "an", "LDAP", "server", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldap3.py#L109-L306
[ "def", "connect", "(", "connect_spec", "=", "None", ")", ":", "if", "isinstance", "(", "connect_spec", ",", "_connect_ctx", ")", ":", "return", "connect_spec", "if", "connect_spec", "is", "None", ":", "connect_spec", "=", "{", "}", "backend_name", "=", "conn...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
search
Search an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param base: Distinguished name of the entry at which to start the search. :param scope: One of the following: * ``'subtree'`` ...
salt/modules/ldap3.py
def search(connect_spec, base, scope='subtree', filterstr='(objectClass=*)', attrlist=None, attrsonly=0): '''Search an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param base: Distinguished name of ...
def search(connect_spec, base, scope='subtree', filterstr='(objectClass=*)', attrlist=None, attrsonly=0): '''Search an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param base: Distinguished name of ...
[ "Search", "an", "LDAP", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldap3.py#L309-L369
[ "def", "search", "(", "connect_spec", ",", "base", ",", "scope", "=", "'subtree'", ",", "filterstr", "=", "'(objectClass=*)'", ",", "attrlist", "=", "None", ",", "attrsonly", "=", "0", ")", ":", "l", "=", "connect", "(", "connect_spec", ")", "scope", "="...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
add
Add an entry to an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param attributes: Non-empty dict mapping each of the new entry's attributes to a non...
salt/modules/ldap3.py
def add(connect_spec, dn, attributes): '''Add an entry to an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param attributes: Non-empty dict mapping each ...
def add(connect_spec, dn, attributes): '''Add an entry to an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param attributes: Non-empty dict mapping each ...
[ "Add", "an", "entry", "to", "an", "LDAP", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldap3.py#L372-L417
[ "def", "add", "(", "connect_spec", ",", "dn", ",", "attributes", ")", ":", "l", "=", "connect", "(", "connect_spec", ")", "# convert the \"iterable of values\" to lists in case that's what", "# addModlist() expects (also to ensure that the caller's objects", "# are not modified)"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
delete
Delete an entry from an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :returns: ``True`` if successful, raises an exception otherwise. CLI example: ...
salt/modules/ldap3.py
def delete(connect_spec, dn): '''Delete an entry from an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :returns: ``True`` if successful, raises an excepti...
def delete(connect_spec, dn): '''Delete an entry from an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :returns: ``True`` if successful, raises an excepti...
[ "Delete", "an", "entry", "from", "an", "LDAP", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldap3.py#L420-L450
[ "def", "delete", "(", "connect_spec", ",", "dn", ")", ":", "l", "=", "connect", "(", "connect_spec", ")", "log", ".", "info", "(", "'deleting entry: dn: %s'", ",", "repr", "(", "dn", ")", ")", "try", ":", "l", ".", "c", ".", "delete_s", "(", "dn", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
modify
Modify an entry in an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param directives: Iterable of directives that indicate how to modify the entry. E...
salt/modules/ldap3.py
def modify(connect_spec, dn, directives): '''Modify an entry in an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param directives: Iterable of directives...
def modify(connect_spec, dn, directives): '''Modify an entry in an LDAP database. :param connect_spec: See the documentation for the ``connect_spec`` parameter for :py:func:`connect`. :param dn: Distinguished name of the entry. :param directives: Iterable of directives...
[ "Modify", "an", "entry", "in", "an", "LDAP", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldap3.py#L453-L517
[ "def", "modify", "(", "connect_spec", ",", "dn", ",", "directives", ")", ":", "l", "=", "connect", "(", "connect_spec", ")", "# convert the \"iterable of values\" to lists in case that's what", "# modify_s() expects (also to ensure that the caller's objects are", "# not modified)...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
change
Modify an entry in an LDAP database. This does the same thing as :py:func:`modify`, but with a simpler interface. Instead of taking a list of directives, it takes a before and after view of an entry, determines the differences between the two, computes the directives, and executes them. Any attri...
salt/modules/ldap3.py
def change(connect_spec, dn, before, after): '''Modify an entry in an LDAP database. This does the same thing as :py:func:`modify`, but with a simpler interface. Instead of taking a list of directives, it takes a before and after view of an entry, determines the differences between the two, comput...
def change(connect_spec, dn, before, after): '''Modify an entry in an LDAP database. This does the same thing as :py:func:`modify`, but with a simpler interface. Instead of taking a list of directives, it takes a before and after view of an entry, determines the differences between the two, comput...
[ "Modify", "an", "entry", "in", "an", "LDAP", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldap3.py#L520-L585
[ "def", "change", "(", "connect_spec", ",", "dn", ",", "before", ",", "after", ")", ":", "l", "=", "connect", "(", "connect_spec", ")", "# convert the \"iterable of values\" to lists in case that's what", "# modifyModlist() expects (also to ensure that the caller's dicts", "# ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parse_profile
From a pillar key, or a dictionary, return index and host keys.
salt/states/grafana.py
def _parse_profile(profile): ''' From a pillar key, or a dictionary, return index and host keys. ''' if isinstance(profile, string_types): _profile = __salt__['config.option'](profile) if not _profile: msg = 'Pillar key for profile {0} not found.'.format(profile) ...
def _parse_profile(profile): ''' From a pillar key, or a dictionary, return index and host keys. ''' if isinstance(profile, string_types): _profile = __salt__['config.option'](profile) if not _profile: msg = 'Pillar key for profile {0} not found.'.format(profile) ...
[ "From", "a", "pillar", "key", "or", "a", "dictionary", "return", "index", "and", "host", "keys", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana.py#L189-L202
[ "def", "_parse_profile", "(", "profile", ")", ":", "if", "isinstance", "(", "profile", ",", "string_types", ")", ":", "_profile", "=", "__salt__", "[", "'config.option'", "]", "(", "profile", ")", "if", "not", "_profile", ":", "msg", "=", "'Pillar key for pr...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_rows_differ
Check if grafana dashboard row and _row differ
salt/states/grafana.py
def _rows_differ(row, _row): ''' Check if grafana dashboard row and _row differ ''' row_copy = copy.deepcopy(row) _row_copy = copy.deepcopy(_row) # Strip id from all panels in both rows, since they are always generated. for panel in row_copy['panels']: if 'id' in panel: d...
def _rows_differ(row, _row): ''' Check if grafana dashboard row and _row differ ''' row_copy = copy.deepcopy(row) _row_copy = copy.deepcopy(_row) # Strip id from all panels in both rows, since they are always generated. for panel in row_copy['panels']: if 'id' in panel: d...
[ "Check", "if", "grafana", "dashboard", "row", "and", "_row", "differ" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana.py#L205-L219
[ "def", "_rows_differ", "(", "row", ",", "_row", ")", ":", "row_copy", "=", "copy", ".", "deepcopy", "(", "row", ")", "_row_copy", "=", "copy", ".", "deepcopy", "(", "_row", ")", "# Strip id from all panels in both rows, since they are always generated.", "for", "p...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
dashboard_present
Ensure the grafana dashboard exists and is managed. name Name of the grafana dashboard. dashboard A dict that defines a dashboard that should be managed. dashboard_from_pillar A pillar key that contains a grafana dashboard dict. Mutually exclusive with dashboard. rows...
salt/states/grafana.py
def dashboard_present( name, dashboard=None, dashboard_from_pillar=None, rows=None, rows_from_pillar=None, profile='grafana'): ''' Ensure the grafana dashboard exists and is managed. name Name of the grafana dashboard. dashboard A dict th...
def dashboard_present( name, dashboard=None, dashboard_from_pillar=None, rows=None, rows_from_pillar=None, profile='grafana'): ''' Ensure the grafana dashboard exists and is managed. name Name of the grafana dashboard. dashboard A dict th...
[ "Ensure", "the", "grafana", "dashboard", "exists", "and", "is", "managed", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana.py#L222-L369
[ "def", "dashboard_present", "(", "name", ",", "dashboard", "=", "None", ",", "dashboard_from_pillar", "=", "None", ",", "rows", "=", "None", ",", "rows_from_pillar", "=", "None", ",", "profile", "=", "'grafana'", ")", ":", "ret", "=", "{", "'name'", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
dashboard_absent
Ensure the named grafana dashboard is deleted. name Name of the grafana dashboard. profile A pillar key or dict that contains a list of hosts and an elasticsearch index to use.
salt/states/grafana.py
def dashboard_absent( name, hosts=None, profile='grafana'): ''' Ensure the named grafana dashboard is deleted. name Name of the grafana dashboard. profile A pillar key or dict that contains a list of hosts and an elasticsearch index to use. ''' r...
def dashboard_absent( name, hosts=None, profile='grafana'): ''' Ensure the named grafana dashboard is deleted. name Name of the grafana dashboard. profile A pillar key or dict that contains a list of hosts and an elasticsearch index to use. ''' r...
[ "Ensure", "the", "named", "grafana", "dashboard", "is", "deleted", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/grafana.py#L372-L416
[ "def", "dashboard_absent", "(", "name", ",", "hosts", "=", "None", ",", "profile", "=", "'grafana'", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ensure_sequence_filter
Ensure sequenced data. **sequence** ensure that parsed data is a sequence .. code-block:: jinja {% set my_string = "foo" %} {% set my_list = ["bar", ] %} {% set my_dict = {"baz": "qux"} %} {{ my_string|sequence|first }} {{ my_list|sequence|first }} {{...
salt/utils/jinja.py
def ensure_sequence_filter(data): ''' Ensure sequenced data. **sequence** ensure that parsed data is a sequence .. code-block:: jinja {% set my_string = "foo" %} {% set my_list = ["bar", ] %} {% set my_dict = {"baz": "qux"} %} {{ my_string|sequence|first }} ...
def ensure_sequence_filter(data): ''' Ensure sequenced data. **sequence** ensure that parsed data is a sequence .. code-block:: jinja {% set my_string = "foo" %} {% set my_list = ["bar", ] %} {% set my_dict = {"baz": "qux"} %} {{ my_string|sequence|first }} ...
[ "Ensure", "sequenced", "data", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L252-L281
[ "def", "ensure_sequence_filter", "(", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "(", "list", ",", "tuple", ",", "set", ",", "dict", ")", ")", ":", "return", "[", "data", "]", "return", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
to_bool
Returns the logical value. .. code-block:: jinja {{ 'yes' | to_bool }} will be rendered as: .. code-block:: text True
salt/utils/jinja.py
def to_bool(val): ''' Returns the logical value. .. code-block:: jinja {{ 'yes' | to_bool }} will be rendered as: .. code-block:: text True ''' if val is None: return False if isinstance(val, bool): return val if isinstance(val, (six.text_type, si...
def to_bool(val): ''' Returns the logical value. .. code-block:: jinja {{ 'yes' | to_bool }} will be rendered as: .. code-block:: text True ''' if val is None: return False if isinstance(val, bool): return val if isinstance(val, (six.text_type, si...
[ "Returns", "the", "logical", "value", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L285-L309
[ "def", "to_bool", "(", "val", ")", ":", "if", "val", "is", "None", ":", "return", "False", "if", "isinstance", "(", "val", ",", "bool", ")", ":", "return", "val", "if", "isinstance", "(", "val", ",", "(", "six", ".", "text_type", ",", "six", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
tojson
Implementation of tojson filter (only present in Jinja 2.9 and later). If Jinja 2.9 or later is installed, then the upstream version of this filter will be used.
salt/utils/jinja.py
def tojson(val, indent=None): ''' Implementation of tojson filter (only present in Jinja 2.9 and later). If Jinja 2.9 or later is installed, then the upstream version of this filter will be used. ''' options = {'ensure_ascii': True} if indent is not None: options['indent'] = indent ...
def tojson(val, indent=None): ''' Implementation of tojson filter (only present in Jinja 2.9 and later). If Jinja 2.9 or later is installed, then the upstream version of this filter will be used. ''' options = {'ensure_ascii': True} if indent is not None: options['indent'] = indent ...
[ "Implementation", "of", "tojson", "filter", "(", "only", "present", "in", "Jinja", "2", ".", "9", "and", "later", ")", ".", "If", "Jinja", "2", ".", "9", "or", "later", "is", "installed", "then", "the", "upstream", "version", "of", "this", "filter", "w...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L313-L329
[ "def", "tojson", "(", "val", ",", "indent", "=", "None", ")", ":", "options", "=", "{", "'ensure_ascii'", ":", "True", "}", "if", "indent", "is", "not", "None", ":", "options", "[", "'indent'", "]", "=", "indent", "return", "(", "salt", ".", "utils",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
regex_search
Searches for a pattern in the text. .. code-block:: jinja {% set my_text = 'abcd' %} {{ my_text | regex_search('^(.*)BC(.*)$', ignorecase=True) }} will be rendered as: .. code-block:: text ('a', 'd')
salt/utils/jinja.py
def regex_search(txt, rgx, ignorecase=False, multiline=False): ''' Searches for a pattern in the text. .. code-block:: jinja {% set my_text = 'abcd' %} {{ my_text | regex_search('^(.*)BC(.*)$', ignorecase=True) }} will be rendered as: .. code-block:: text ('a', 'd') ...
def regex_search(txt, rgx, ignorecase=False, multiline=False): ''' Searches for a pattern in the text. .. code-block:: jinja {% set my_text = 'abcd' %} {{ my_text | regex_search('^(.*)BC(.*)$', ignorecase=True) }} will be rendered as: .. code-block:: text ('a', 'd') ...
[ "Searches", "for", "a", "pattern", "in", "the", "text", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L357-L380
[ "def", "regex_search", "(", "txt", ",", "rgx", ",", "ignorecase", "=", "False", ",", "multiline", "=", "False", ")", ":", "flag", "=", "0", "if", "ignorecase", ":", "flag", "|=", "re", ".", "I", "if", "multiline", ":", "flag", "|=", "re", ".", "M",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
regex_match
Searches for a pattern in the text. .. code-block:: jinja {% set my_text = 'abcd' %} {{ my_text | regex_match('^(.*)BC(.*)$', ignorecase=True) }} will be rendered as: .. code-block:: text ('a', 'd')
salt/utils/jinja.py
def regex_match(txt, rgx, ignorecase=False, multiline=False): ''' Searches for a pattern in the text. .. code-block:: jinja {% set my_text = 'abcd' %} {{ my_text | regex_match('^(.*)BC(.*)$', ignorecase=True) }} will be rendered as: .. code-block:: text ('a', 'd') ''...
def regex_match(txt, rgx, ignorecase=False, multiline=False): ''' Searches for a pattern in the text. .. code-block:: jinja {% set my_text = 'abcd' %} {{ my_text | regex_match('^(.*)BC(.*)$', ignorecase=True) }} will be rendered as: .. code-block:: text ('a', 'd') ''...
[ "Searches", "for", "a", "pattern", "in", "the", "text", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L384-L407
[ "def", "regex_match", "(", "txt", ",", "rgx", ",", "ignorecase", "=", "False", ",", "multiline", "=", "False", ")", ":", "flag", "=", "0", "if", "ignorecase", ":", "flag", "|=", "re", ".", "I", "if", "multiline", ":", "flag", "|=", "re", ".", "M", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
regex_replace
r''' Searches for a pattern and replaces with a sequence of characters. .. code-block:: jinja {% set my_text = 'lets replace spaces' %} {{ my_text | regex_replace('\s+', '__') }} will be rendered as: .. code-block:: text lets__replace__spaces
salt/utils/jinja.py
def regex_replace(txt, rgx, val, ignorecase=False, multiline=False): r''' Searches for a pattern and replaces with a sequence of characters. .. code-block:: jinja {% set my_text = 'lets replace spaces' %} {{ my_text | regex_replace('\s+', '__') }} will be rendered as: .. code-blo...
def regex_replace(txt, rgx, val, ignorecase=False, multiline=False): r''' Searches for a pattern and replaces with a sequence of characters. .. code-block:: jinja {% set my_text = 'lets replace spaces' %} {{ my_text | regex_replace('\s+', '__') }} will be rendered as: .. code-blo...
[ "r", "Searches", "for", "a", "pattern", "and", "replaces", "with", "a", "sequence", "of", "characters", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L411-L432
[ "def", "regex_replace", "(", "txt", ",", "rgx", ",", "val", ",", "ignorecase", "=", "False", ",", "multiline", "=", "False", ")", ":", "flag", "=", "0", "if", "ignorecase", ":", "flag", "|=", "re", ".", "I", "if", "multiline", ":", "flag", "|=", "r...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
uuid_
Returns a UUID corresponding to the value passed as argument. .. code-block:: jinja {{ 'example' | uuid }} will be rendered as: .. code-block:: text f4efeff8-c219-578a-bad7-3dc280612ec8
salt/utils/jinja.py
def uuid_(val): ''' Returns a UUID corresponding to the value passed as argument. .. code-block:: jinja {{ 'example' | uuid }} will be rendered as: .. code-block:: text f4efeff8-c219-578a-bad7-3dc280612ec8 ''' return six.text_type( uuid.uuid5( GLOBAL_...
def uuid_(val): ''' Returns a UUID corresponding to the value passed as argument. .. code-block:: jinja {{ 'example' | uuid }} will be rendered as: .. code-block:: text f4efeff8-c219-578a-bad7-3dc280612ec8 ''' return six.text_type( uuid.uuid5( GLOBAL_...
[ "Returns", "a", "UUID", "corresponding", "to", "the", "value", "passed", "as", "argument", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L436-L455
[ "def", "uuid_", "(", "val", ")", ":", "return", "six", ".", "text_type", "(", "uuid", ".", "uuid5", "(", "GLOBAL_UUID", ",", "salt", ".", "utils", ".", "stringutils", ".", "to_str", "(", "val", ")", ")", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
unique
Removes duplicates from a list. .. code-block:: jinja {% set my_list = ['a', 'b', 'c', 'a', 'b'] -%} {{ my_list | unique }} will be rendered as: .. code-block:: text ['a', 'b', 'c']
salt/utils/jinja.py
def unique(values): ''' Removes duplicates from a list. .. code-block:: jinja {% set my_list = ['a', 'b', 'c', 'a', 'b'] -%} {{ my_list | unique }} will be rendered as: .. code-block:: text ['a', 'b', 'c'] ''' ret = None if isinstance(values, collections.Hash...
def unique(values): ''' Removes duplicates from a list. .. code-block:: jinja {% set my_list = ['a', 'b', 'c', 'a', 'b'] -%} {{ my_list | unique }} will be rendered as: .. code-block:: text ['a', 'b', 'c'] ''' ret = None if isinstance(values, collections.Hash...
[ "Removes", "duplicates", "from", "a", "list", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L462-L485
[ "def", "unique", "(", "values", ")", ":", "ret", "=", "None", "if", "isinstance", "(", "values", ",", "collections", ".", "Hashable", ")", ":", "ret", "=", "set", "(", "values", ")", "else", ":", "ret", "=", "[", "]", "for", "value", "in", "values"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
lst_avg
Returns the average value of a list. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | avg }} will be rendered as: .. code-block:: yaml 2.5
salt/utils/jinja.py
def lst_avg(lst): ''' Returns the average value of a list. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | avg }} will be rendered as: .. code-block:: yaml 2.5 ''' salt.utils.versions.warn_until( 'Neon', 'This results of this fun...
def lst_avg(lst): ''' Returns the average value of a list. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | avg }} will be rendered as: .. code-block:: yaml 2.5 ''' salt.utils.versions.warn_until( 'Neon', 'This results of this fun...
[ "Returns", "the", "average", "value", "of", "a", "list", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L527-L552
[ "def", "lst_avg", "(", "lst", ")", ":", "salt", ".", "utils", ".", "versions", ".", "warn_until", "(", "'Neon'", ",", "'This results of this function are currently being rounded.'", "'Beginning in the Salt Neon release, results will no longer be '", "'rounded and this warning wil...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
union
Returns the union of two lists. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | union([2, 4, 6]) }} will be rendered as: .. code-block:: text [1, 2, 3, 4, 6]
salt/utils/jinja.py
def union(lst1, lst2): ''' Returns the union of two lists. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | union([2, 4, 6]) }} will be rendered as: .. code-block:: text [1, 2, 3, 4, 6] ''' if isinstance(lst1, collections.Hashable) and isinstance...
def union(lst1, lst2): ''' Returns the union of two lists. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | union([2, 4, 6]) }} will be rendered as: .. code-block:: text [1, 2, 3, 4, 6] ''' if isinstance(lst1, collections.Hashable) and isinstance...
[ "Returns", "the", "union", "of", "two", "lists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L556-L573
[ "def", "union", "(", "lst1", ",", "lst2", ")", ":", "if", "isinstance", "(", "lst1", ",", "collections", ".", "Hashable", ")", "and", "isinstance", "(", "lst2", ",", "collections", ".", "Hashable", ")", ":", "return", "set", "(", "lst1", ")", "|", "s...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
intersect
Returns the intersection of two lists. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | intersect([2, 4, 6]) }} will be rendered as: .. code-block:: text [2, 4]
salt/utils/jinja.py
def intersect(lst1, lst2): ''' Returns the intersection of two lists. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | intersect([2, 4, 6]) }} will be rendered as: .. code-block:: text [2, 4] ''' if isinstance(lst1, collections.Hashable) and isin...
def intersect(lst1, lst2): ''' Returns the intersection of two lists. .. code-block:: jinja {% my_list = [1,2,3,4] -%} {{ set my_list | intersect([2, 4, 6]) }} will be rendered as: .. code-block:: text [2, 4] ''' if isinstance(lst1, collections.Hashable) and isin...
[ "Returns", "the", "intersection", "of", "two", "lists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L577-L594
[ "def", "intersect", "(", "lst1", ",", "lst2", ")", ":", "if", "isinstance", "(", "lst1", ",", "collections", ".", "Hashable", ")", "and", "isinstance", "(", "lst2", ",", "collections", ".", "Hashable", ")", ":", "return", "set", "(", "lst1", ")", "&", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SaltCacheLoader.file_client
Return a file client. Instantiates on first call.
salt/utils/jinja.py
def file_client(self): ''' Return a file client. Instantiates on first call. ''' if not self._file_client: self._file_client = salt.fileclient.get_file_client( self.opts, self.pillar_rend) return self._file_client
def file_client(self): ''' Return a file client. Instantiates on first call. ''' if not self._file_client: self._file_client = salt.fileclient.get_file_client( self.opts, self.pillar_rend) return self._file_client
[ "Return", "a", "file", "client", ".", "Instantiates", "on", "first", "call", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L76-L83
[ "def", "file_client", "(", "self", ")", ":", "if", "not", "self", ".", "_file_client", ":", "self", ".", "_file_client", "=", "salt", ".", "fileclient", ".", "get_file_client", "(", "self", ".", "opts", ",", "self", ".", "pillar_rend", ")", "return", "se...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SaltCacheLoader.cache_file
Cache a file from the salt master
salt/utils/jinja.py
def cache_file(self, template): ''' Cache a file from the salt master ''' saltpath = salt.utils.url.create(template) self.file_client().get_file(saltpath, '', True, self.saltenv)
def cache_file(self, template): ''' Cache a file from the salt master ''' saltpath = salt.utils.url.create(template) self.file_client().get_file(saltpath, '', True, self.saltenv)
[ "Cache", "a", "file", "from", "the", "salt", "master" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L85-L90
[ "def", "cache_file", "(", "self", ",", "template", ")", ":", "saltpath", "=", "salt", ".", "utils", ".", "url", ".", "create", "(", "template", ")", "self", ".", "file_client", "(", ")", ".", "get_file", "(", "saltpath", ",", "''", ",", "True", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SaltCacheLoader.check_cache
Cache a file only once
salt/utils/jinja.py
def check_cache(self, template): ''' Cache a file only once ''' if template not in self.cached: self.cache_file(template) self.cached.append(template)
def check_cache(self, template): ''' Cache a file only once ''' if template not in self.cached: self.cache_file(template) self.cached.append(template)
[ "Cache", "a", "file", "only", "once" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L92-L98
[ "def", "check_cache", "(", "self", ",", "template", ")", ":", "if", "template", "not", "in", "self", ".", "cached", ":", "self", ".", "cache_file", "(", "template", ")", "self", ".", "cached", ".", "append", "(", "template", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SaltCacheLoader.get_source
Salt-specific loader to find imported jinja files. Jinja imports will be interpreted as originating from the top of each of the directories in the searchpath when the template name does not begin with './' or '../'. When a template name begins with './' or '../' then the import will be...
salt/utils/jinja.py
def get_source(self, environment, template): ''' Salt-specific loader to find imported jinja files. Jinja imports will be interpreted as originating from the top of each of the directories in the searchpath when the template name does not begin with './' or '../'. When a templa...
def get_source(self, environment, template): ''' Salt-specific loader to find imported jinja files. Jinja imports will be interpreted as originating from the top of each of the directories in the searchpath when the template name does not begin with './' or '../'. When a templa...
[ "Salt", "-", "specific", "loader", "to", "find", "imported", "jinja", "files", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L100-L171
[ "def", "get_source", "(", "self", ",", "environment", ",", "template", ")", ":", "# FIXME: somewhere do seprataor replacement: '\\\\' => '/'", "_template", "=", "template", "if", "template", ".", "split", "(", "'/'", ",", "1", ")", "[", "0", "]", "in", "(", "'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SerializerExtension.finalizer
Ensure that printed mappings are YAML friendly.
salt/utils/jinja.py
def finalizer(self, data): ''' Ensure that printed mappings are YAML friendly. ''' def explore(data): if isinstance(data, (dict, OrderedDict)): return PrintableDict( [(key, explore(value)) for key, value in six.iteritems(data)] ...
def finalizer(self, data): ''' Ensure that printed mappings are YAML friendly. ''' def explore(data): if isinstance(data, (dict, OrderedDict)): return PrintableDict( [(key, explore(value)) for key, value in six.iteritems(data)] ...
[ "Ensure", "that", "printed", "mappings", "are", "YAML", "friendly", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L840-L852
[ "def", "finalizer", "(", "self", ",", "data", ")", ":", "def", "explore", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "(", "dict", ",", "OrderedDict", ")", ")", ":", "return", "PrintableDict", "(", "[", "(", "key", ",", "explore", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
SerializerExtension.format_xml
Render a formatted multi-line XML string from a complex Python data structure. Supports tag attributes and nested dicts/lists. :param value: Complex data structure representing XML contents :returns: Formatted XML string rendered with newlines and indentation :rtype: str
salt/utils/jinja.py
def format_xml(self, value): """Render a formatted multi-line XML string from a complex Python data structure. Supports tag attributes and nested dicts/lists. :param value: Complex data structure representing XML contents :returns: Formatted XML string rendered with newlines and indenta...
def format_xml(self, value): """Render a formatted multi-line XML string from a complex Python data structure. Supports tag attributes and nested dicts/lists. :param value: Complex data structure representing XML contents :returns: Formatted XML string rendered with newlines and indenta...
[ "Render", "a", "formatted", "multi", "-", "line", "XML", "string", "from", "a", "complex", "Python", "data", "structure", ".", "Supports", "tag", "attributes", "and", "nested", "dicts", "/", "lists", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jinja.py#L871-L915
[ "def", "format_xml", "(", "self", ",", "value", ")", ":", "def", "normalize_iter", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "(", "list", ",", "tuple", ")", ")", ":", "if", "isinstance", "(", "value", "[", "0", "]", ",", "str",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
alias_absent
Ensure that the index alias is absent. name Name of the index alias to remove index Name of the index for the alias
salt/states/elasticsearch.py
def alias_absent(name, index): ''' Ensure that the index alias is absent. name Name of the index alias to remove index Name of the index for the alias ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} try: alias = __salt__['elasticsearch.alias_...
def alias_absent(name, index): ''' Ensure that the index alias is absent. name Name of the index alias to remove index Name of the index for the alias ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} try: alias = __salt__['elasticsearch.alias_...
[ "Ensure", "that", "the", "index", "alias", "is", "absent", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L104-L136
[ "def", "alias_absent", "(", "name", ",", "index", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "try", ":", "alias", "=", "__salt__", "[", "'elasti...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
alias_present
Ensure that the named index alias is present. name Name of the alias index Name of the index definition Optional dict for filters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html **Example:** .. code-block:: yaml mytestal...
salt/states/elasticsearch.py
def alias_present(name, index, definition=None): ''' Ensure that the named index alias is present. name Name of the alias index Name of the index definition Optional dict for filters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html ...
def alias_present(name, index, definition=None): ''' Ensure that the named index alias is present. name Name of the alias index Name of the index definition Optional dict for filters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html ...
[ "Ensure", "that", "the", "named", "index", "alias", "is", "present", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L139-L199
[ "def", "alias_present", "(", "name", ",", "index", ",", "definition", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "try", ":", "alias...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
index_template_absent
Ensure that the named index template is absent. name Name of the index to remove
salt/states/elasticsearch.py
def index_template_absent(name): ''' Ensure that the named index template is absent. name Name of the index to remove ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} try: index_template = __salt__['elasticsearch.index_template_get'](name=name) if...
def index_template_absent(name): ''' Ensure that the named index template is absent. name Name of the index to remove ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} try: index_template = __salt__['elasticsearch.index_template_get'](name=name) if...
[ "Ensure", "that", "the", "named", "index", "template", "is", "absent", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L202-L232
[ "def", "index_template_absent", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "try", ":", "index_template", "=", "__salt__", "[", "'elasti...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
index_template_present
Ensure that the named index template is present. name Name of the index to add definition Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html check_definition If the template already exists and the defin...
salt/states/elasticsearch.py
def index_template_present(name, definition, check_definition=False): ''' Ensure that the named index template is present. name Name of the index to add definition Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templa...
def index_template_present(name, definition, check_definition=False): ''' Ensure that the named index template is present. name Name of the index to add definition Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templa...
[ "Ensure", "that", "the", "named", "index", "template", "is", "present", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L235-L309
[ "def", "index_template_present", "(", "name", ",", "definition", ",", "check_definition", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
pipeline_absent
Ensure that the named pipeline is absent name Name of the pipeline to remove
salt/states/elasticsearch.py
def pipeline_absent(name): ''' Ensure that the named pipeline is absent name Name of the pipeline to remove ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} try: pipeline = __salt__['elasticsearch.pipeline_get'](id=name) if pipeline and name in pi...
def pipeline_absent(name): ''' Ensure that the named pipeline is absent name Name of the pipeline to remove ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} try: pipeline = __salt__['elasticsearch.pipeline_get'](id=name) if pipeline and name in pi...
[ "Ensure", "that", "the", "named", "pipeline", "is", "absent" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L312-L342
[ "def", "pipeline_absent", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "try", ":", "pipeline", "=", "__salt__", "[", "'elasticsearch.pipe...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
pipeline_present
Ensure that the named pipeline is present. name Name of the index to add definition Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/master/pipeline.html **Example:** .. code-block:: yaml test_pipeline: elasticsear...
salt/states/elasticsearch.py
def pipeline_present(name, definition): ''' Ensure that the named pipeline is present. name Name of the index to add definition Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/master/pipeline.html **Example:** .. code-block:...
def pipeline_present(name, definition): ''' Ensure that the named pipeline is present. name Name of the index to add definition Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/master/pipeline.html **Example:** .. code-block:...
[ "Ensure", "that", "the", "named", "pipeline", "is", "present", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L345-L401
[ "def", "pipeline_present", "(", "name", ",", "definition", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "try", ":", "pipeline", "=", "__salt__", "["...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
search_template_absent
Ensure that the search template is absent name Name of the search template to remove
salt/states/elasticsearch.py
def search_template_absent(name): ''' Ensure that the search template is absent name Name of the search template to remove ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} try: template = __salt__['elasticsearch.search_template_get'](id=name) if t...
def search_template_absent(name): ''' Ensure that the search template is absent name Name of the search template to remove ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} try: template = __salt__['elasticsearch.search_template_get'](id=name) if t...
[ "Ensure", "that", "the", "search", "template", "is", "absent" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L404-L434
[ "def", "search_template_absent", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "try", ":", "template", "=", "__salt__", "[", "'elasticsear...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
search_template_present
Ensure that the named search template is present. name Name of the search template to add definition Required dict for creation parameters as per http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html **Example:** .. code-block:: yaml test_pipelin...
salt/states/elasticsearch.py
def search_template_present(name, definition): ''' Ensure that the named search template is present. name Name of the search template to add definition Required dict for creation parameters as per http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html *...
def search_template_present(name, definition): ''' Ensure that the named search template is present. name Name of the search template to add definition Required dict for creation parameters as per http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html *...
[ "Ensure", "that", "the", "named", "search", "template", "is", "present", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/elasticsearch.py#L437-L492
[ "def", "search_template_present", "(", "name", ",", "definition", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "try", ":", "template", "=", "__salt__"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_pkg
Returns the prefix for a pkg command, using -j if a jail is specified, or -c if chroot is specified.
salt/modules/pkgng.py
def _pkg(jail=None, chroot=None, root=None): ''' Returns the prefix for a pkg command, using -j if a jail is specified, or -c if chroot is specified. ''' ret = ['pkg'] if jail: ret.extend(['-j', jail]) elif chroot: ret.extend(['-c', chroot]) elif root: ret.extend(...
def _pkg(jail=None, chroot=None, root=None): ''' Returns the prefix for a pkg command, using -j if a jail is specified, or -c if chroot is specified. ''' ret = ['pkg'] if jail: ret.extend(['-j', jail]) elif chroot: ret.extend(['-c', chroot]) elif root: ret.extend(...
[ "Returns", "the", "prefix", "for", "a", "pkg", "command", "using", "-", "j", "if", "a", "jail", "is", "specified", "or", "-", "c", "if", "chroot", "is", "specified", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L89-L101
[ "def", "_pkg", "(", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ")", ":", "ret", "=", "[", "'pkg'", "]", "if", "jail", ":", "ret", ".", "extend", "(", "[", "'-j'", ",", "jail", "]", ")", "elif", "chroot", ":", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_pkgng_version
return the version of 'pkg'
salt/modules/pkgng.py
def _get_pkgng_version(jail=None, chroot=None, root=None): ''' return the version of 'pkg' ''' cmd = _pkg(jail, chroot, root) + ['--version'] return __salt__['cmd.run'](cmd).strip()
def _get_pkgng_version(jail=None, chroot=None, root=None): ''' return the version of 'pkg' ''' cmd = _pkg(jail, chroot, root) + ['--version'] return __salt__['cmd.run'](cmd).strip()
[ "return", "the", "version", "of", "pkg" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L104-L109
[ "def", "_get_pkgng_version", "(", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ")", ":", "cmd", "=", "_pkg", "(", "jail", ",", "chroot", ",", "root", ")", "+", "[", "'--version'", "]", "return", "__salt__", "[", "'cmd.ru...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_version
``pkg search`` will return all packages for which the pattern is a match. Narrow this down and return the package version, or None if no exact match.
salt/modules/pkgng.py
def _get_version(name, results): ''' ``pkg search`` will return all packages for which the pattern is a match. Narrow this down and return the package version, or None if no exact match. ''' for line in salt.utils.itertools.split(results, '\n'): if not line: continue try:...
def _get_version(name, results): ''' ``pkg search`` will return all packages for which the pattern is a match. Narrow this down and return the package version, or None if no exact match. ''' for line in salt.utils.itertools.split(results, '\n'): if not line: continue try:...
[ "pkg", "search", "will", "return", "all", "packages", "for", "which", "the", "pattern", "is", "a", "match", ".", "Narrow", "this", "down", "and", "return", "the", "package", "version", "or", "None", "if", "no", "exact", "match", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L112-L126
[ "def", "_get_version", "(", "name", ",", "results", ")", ":", "for", "line", "in", "salt", ".", "utils", ".", "itertools", ".", "split", "(", "results", ",", "'\\n'", ")", ":", "if", "not", "line", ":", "continue", "try", ":", "pkgname", ",", "pkgver...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_contextkey
As this module is designed to manipulate packages in jails and chroots, use the passed jail/chroot to ensure that a key in the __context__ dict that is unique to that jail/chroot is used.
salt/modules/pkgng.py
def _contextkey(jail=None, chroot=None, root=None, prefix='pkg.list_pkgs'): ''' As this module is designed to manipulate packages in jails and chroots, use the passed jail/chroot to ensure that a key in the __context__ dict that is unique to that jail/chroot is used. ''' if jail: return ...
def _contextkey(jail=None, chroot=None, root=None, prefix='pkg.list_pkgs'): ''' As this module is designed to manipulate packages in jails and chroots, use the passed jail/chroot to ensure that a key in the __context__ dict that is unique to that jail/chroot is used. ''' if jail: return ...
[ "As", "this", "module", "is", "designed", "to", "manipulate", "packages", "in", "jails", "and", "chroots", "use", "the", "passed", "jail", "/", "chroot", "to", "ensure", "that", "a", "key", "in", "the", "__context__", "dict", "that", "is", "unique", "to", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L129-L141
[ "def", "_contextkey", "(", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ",", "prefix", "=", "'pkg.list_pkgs'", ")", ":", "if", "jail", ":", "return", "six", ".", "text_type", "(", "prefix", ")", "+", "'.jail_{0}'", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
parse_config
Return dict of uncommented global variables. CLI Example: .. code-block:: bash salt '*' pkg.parse_config ``NOTE:`` not working properly right now
salt/modules/pkgng.py
def parse_config(file_name='/usr/local/etc/pkg.conf'): ''' Return dict of uncommented global variables. CLI Example: .. code-block:: bash salt '*' pkg.parse_config ``NOTE:`` not working properly right now ''' ret = {} if not os.path.isfile(file_name): return 'Unable t...
def parse_config(file_name='/usr/local/etc/pkg.conf'): ''' Return dict of uncommented global variables. CLI Example: .. code-block:: bash salt '*' pkg.parse_config ``NOTE:`` not working properly right now ''' ret = {} if not os.path.isfile(file_name): return 'Unable t...
[ "Return", "dict", "of", "uncommented", "global", "variables", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L144-L169
[ "def", "parse_config", "(", "file_name", "=", "'/usr/local/etc/pkg.conf'", ")", ":", "ret", "=", "{", "}", "if", "not", "os", ".", "path", ".", "isfile", "(", "file_name", ")", ":", "return", "'Unable to find {0} on file system'", ".", "format", "(", "file_nam...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
version
Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned. .. note:: This function can accessed using ``pkg.info`` in addition to ``pkg.version``, to more closely match the CLI...
salt/modules/pkgng.py
def version(*names, **kwargs): ''' Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned. .. note:: This function can accessed using ``pkg.info`` in addition to ``p...
def version(*names, **kwargs): ''' Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned. .. note:: This function can accessed using ``pkg.info`` in addition to ``p...
[ "Returns", "a", "string", "representing", "the", "package", "version", "or", "an", "empty", "string", "if", "not", "installed", ".", "If", "more", "than", "one", "package", "name", "is", "specified", "a", "dict", "of", "name", "/", "version", "pairs", "is"...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L172-L220
[ "def", "version", "(", "*", "names", ",", "*", "*", "kwargs", ")", ":", "with_origin", "=", "kwargs", ".", "pop", "(", "'with_origin'", ",", "False", ")", "ret", "=", "__salt__", "[", "'pkg_resource.version'", "]", "(", "*", "names", ",", "*", "*", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
refresh_db
Refresh PACKAGESITE contents .. note:: This function can accessed using ``pkg.update`` in addition to ``pkg.refresh_db``, to more closely match the CLI usage of ``pkg(8)``. CLI Example: .. code-block:: bash salt '*' pkg.refresh_db jail Refresh the pkg database withi...
salt/modules/pkgng.py
def refresh_db(jail=None, chroot=None, root=None, force=False, **kwargs): ''' Refresh PACKAGESITE contents .. note:: This function can accessed using ``pkg.update`` in addition to ``pkg.refresh_db``, to more closely match the CLI usage of ``pkg(8)``. CLI Example: .. code-block:: ...
def refresh_db(jail=None, chroot=None, root=None, force=False, **kwargs): ''' Refresh PACKAGESITE contents .. note:: This function can accessed using ``pkg.update`` in addition to ``pkg.refresh_db``, to more closely match the CLI usage of ``pkg(8)``. CLI Example: .. code-block:: ...
[ "Refresh", "PACKAGESITE", "contents" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L227-L269
[ "def", "refresh_db", "(", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ",", "force", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Remove rtag file to keep multiple refreshes from happening in pkg states", "salt", ".", "utils"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_pkgs
List the packages currently installed as a dict:: {'<package_name>': '<version>'} jail List the packages in the specified jail chroot List the packages in the specified chroot (ignored if ``jail`` is specified) root List the packages in the specified root (ignored...
salt/modules/pkgng.py
def list_pkgs(versions_as_list=False, jail=None, chroot=None, root=None, with_origin=False, **kwargs): ''' List the packages currently installed as a dict:: {'<package_name>': '<version>'} jail List the packages in the s...
def list_pkgs(versions_as_list=False, jail=None, chroot=None, root=None, with_origin=False, **kwargs): ''' List the packages currently installed as a dict:: {'<package_name>': '<version>'} jail List the packages in the s...
[ "List", "the", "packages", "currently", "installed", "as", "a", "dict", "::" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L354-L438
[ "def", "list_pkgs", "(", "versions_as_list", "=", "False", ",", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ",", "with_origin", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# not yet implemented or not applicable", "if", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
stats
Return pkgng stats. CLI Example: .. code-block:: bash salt '*' pkg.stats local Display stats only for the local package database. CLI Example: .. code-block:: bash salt '*' pkg.stats local=True remote Display stats only for the remote package d...
salt/modules/pkgng.py
def stats(local=False, remote=False, jail=None, chroot=None, root=None): ''' Return pkgng stats. CLI Example: .. code-block:: bash salt '*' pkg.stats local Display stats only for the local package database. CLI Example: .. code-block:: bash salt '*'...
def stats(local=False, remote=False, jail=None, chroot=None, root=None): ''' Return pkgng stats. CLI Example: .. code-block:: bash salt '*' pkg.stats local Display stats only for the local package database. CLI Example: .. code-block:: bash salt '*'...
[ "Return", "pkgng", "stats", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L462-L529
[ "def", "stats", "(", "local", "=", "False", ",", "remote", "=", "False", ",", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ")", ":", "opts", "=", "''", "if", "local", ":", "opts", "+=", "'l'", "if", "remote", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
backup
Export installed packages into yaml+mtree file CLI Example: .. code-block:: bash salt '*' pkg.backup /tmp/pkg jail Backup packages from the specified jail. Note that this will run the command within the jail, and so the path to the backup file will be relative to the root...
salt/modules/pkgng.py
def backup(file_name, jail=None, chroot=None, root=None): ''' Export installed packages into yaml+mtree file CLI Example: .. code-block:: bash salt '*' pkg.backup /tmp/pkg jail Backup packages from the specified jail. Note that this will run the command within the jail, a...
def backup(file_name, jail=None, chroot=None, root=None): ''' Export installed packages into yaml+mtree file CLI Example: .. code-block:: bash salt '*' pkg.backup /tmp/pkg jail Backup packages from the specified jail. Note that this will run the command within the jail, a...
[ "Export", "installed", "packages", "into", "yaml", "+", "mtree", "file" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L532-L576
[ "def", "backup", "(", "file_name", ",", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ")", ":", "ret", "=", "__salt__", "[", "'cmd.run'", "]", "(", "_pkg", "(", "jail", ",", "chroot", ",", "root", ")", "+", "[", "'bac...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
restore
Reads archive created by pkg backup -d and recreates the database. CLI Example: .. code-block:: bash salt '*' pkg.restore /tmp/pkg jail Restore database to the specified jail. Note that this will run the command within the jail, and so the path to the file from which the pkg ...
salt/modules/pkgng.py
def restore(file_name, jail=None, chroot=None, root=None): ''' Reads archive created by pkg backup -d and recreates the database. CLI Example: .. code-block:: bash salt '*' pkg.restore /tmp/pkg jail Restore database to the specified jail. Note that this will run the comma...
def restore(file_name, jail=None, chroot=None, root=None): ''' Reads archive created by pkg backup -d and recreates the database. CLI Example: .. code-block:: bash salt '*' pkg.restore /tmp/pkg jail Restore database to the specified jail. Note that this will run the comma...
[ "Reads", "archive", "created", "by", "pkg", "backup", "-", "d", "and", "recreates", "the", "database", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L579-L622
[ "def", "restore", "(", "file_name", ",", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ")", ":", "return", "__salt__", "[", "'cmd.run'", "]", "(", "_pkg", "(", "jail", ",", "chroot", ",", "root", ")", "+", "[", "'backup...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
audit
Audits installed packages against known vulnerabilities CLI Example: .. code-block:: bash salt '*' pkg.audit jail Audit packages within the specified jail CLI Example: .. code-block:: bash salt '*' pkg.audit jail=<jail name or id> chroot Audit ...
salt/modules/pkgng.py
def audit(jail=None, chroot=None, root=None): ''' Audits installed packages against known vulnerabilities CLI Example: .. code-block:: bash salt '*' pkg.audit jail Audit packages within the specified jail CLI Example: .. code-block:: bash salt '*' p...
def audit(jail=None, chroot=None, root=None): ''' Audits installed packages against known vulnerabilities CLI Example: .. code-block:: bash salt '*' pkg.audit jail Audit packages within the specified jail CLI Example: .. code-block:: bash salt '*' p...
[ "Audits", "installed", "packages", "against", "known", "vulnerabilities" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L625-L662
[ "def", "audit", "(", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ")", ":", "return", "__salt__", "[", "'cmd.run'", "]", "(", "_pkg", "(", "jail", ",", "chroot", ",", "root", ")", "+", "[", "'audit'", ",", "'-F'", "]...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
install
Install package(s) from a repository name The name of the package to install CLI Example: .. code-block:: bash salt '*' pkg.install <package name> jail Install the package into the specified jail chroot Install the package into the specified chroot (...
salt/modules/pkgng.py
def install(name=None, fromrepo=None, pkgs=None, sources=None, jail=None, chroot=None, root=None, orphan=False, force=False, glob=False, local=False, dryrun=False, quiet=False,...
def install(name=None, fromrepo=None, pkgs=None, sources=None, jail=None, chroot=None, root=None, orphan=False, force=False, glob=False, local=False, dryrun=False, quiet=False,...
[ "Install", "package", "(", "s", ")", "from", "a", "repository" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L665-L909
[ "def", "install", "(", "name", "=", "None", ",", "fromrepo", "=", "None", ",", "pkgs", "=", "None", ",", "sources", "=", "None", ",", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ",", "orphan", "=", "False", ",", "fo...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
remove
Remove a package from the database and system .. note:: This function can accessed using ``pkg.delete`` in addition to ``pkg.remove``, to more closely match the CLI usage of ``pkg(8)``. name The package to remove CLI Example: .. code-block:: bash salt '*...
salt/modules/pkgng.py
def remove(name=None, pkgs=None, jail=None, chroot=None, root=None, all_installed=False, force=False, glob=False, dryrun=False, recurse=False, regex=False, pcre=False, **kwargs): ''' ...
def remove(name=None, pkgs=None, jail=None, chroot=None, root=None, all_installed=False, force=False, glob=False, dryrun=False, recurse=False, regex=False, pcre=False, **kwargs): ''' ...
[ "Remove", "a", "package", "from", "the", "database", "and", "system" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L912-L1086
[ "def", "remove", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "jail", "=", "None", ",", "chroot", "=", "None", ",", "root", "=", "None", ",", "all_installed", "=", "False", ",", "force", "=", "False", ",", "glob", "=", "False", ",", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
upgrade
Upgrade named or all packages (run a ``pkg upgrade``). If <package name> is omitted, the operation is executed on all packages. Returns a dictionary containing the changes: .. code-block:: python {'<package>': {'old': '<old-version>', 'new': '<new-version>'}} CLI Ex...
salt/modules/pkgng.py
def upgrade(*names, **kwargs): ''' Upgrade named or all packages (run a ``pkg upgrade``). If <package name> is omitted, the operation is executed on all packages. Returns a dictionary containing the changes: .. code-block:: python {'<package>': {'old': '<old-version>', ...
def upgrade(*names, **kwargs): ''' Upgrade named or all packages (run a ``pkg upgrade``). If <package name> is omitted, the operation is executed on all packages. Returns a dictionary containing the changes: .. code-block:: python {'<package>': {'old': '<old-version>', ...
[ "Upgrade", "named", "or", "all", "packages", "(", "run", "a", "pkg", "upgrade", ")", ".", "If", "<package", "name", ">", "is", "omitted", "the", "operation", "is", "executed", "on", "all", "packages", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pkgng.py#L1095-L1212
[ "def", "upgrade", "(", "*", "names", ",", "*", "*", "kwargs", ")", ":", "jail", "=", "kwargs", ".", "pop", "(", "'jail'", ",", "None", ")", "chroot", "=", "kwargs", ".", "pop", "(", "'chroot'", ",", "None", ")", "root", "=", "kwargs", ".", "pop",...
e8541fd6e744ab0df786c0f76102e41631f45d46