repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
saltstack/salt
salt/modules/portage_config.py
get_flags_from_package_conf
def get_flags_from_package_conf(conf, atom): ''' Get flags for a given package or DEPEND atom. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*' portage_config.get_flag...
python
def get_flags_from_package_conf(conf, atom): ''' Get flags for a given package or DEPEND atom. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*' portage_config.get_flag...
[ "def", "get_flags_from_package_conf", "(", "conf", ",", "atom", ")", ":", "if", "conf", "in", "SUPPORTED_CONFS", ":", "package_file", "=", "_get_config_file", "(", "conf", ",", "atom", ")", "if", "'/'", "not", "in", "atom", ":", "atom", "=", "_p_to_cp", "(...
Get flags for a given package or DEPEND atom. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*' portage_config.get_flags_from_package_conf license salt
[ "Get", "flags", "for", "a", "given", "package", "or", "DEPEND", "atom", ".", "Warning", ":", "This", "only", "works", "if", "the", "configuration", "files", "tree", "is", "in", "the", "correct", "format", "(", "the", "one", "enforced", "by", "enforce_nice_...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L459-L507
train
saltstack/salt
salt/modules/portage_config.py
has_flag
def has_flag(conf, atom, flag): ''' Verify if the given package or DEPEND atom has the given flag. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*' portage_config.has_...
python
def has_flag(conf, atom, flag): ''' Verify if the given package or DEPEND atom has the given flag. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*' portage_config.has_...
[ "def", "has_flag", "(", "conf", ",", "atom", ",", "flag", ")", ":", "if", "flag", "in", "get_flags_from_package_conf", "(", "conf", ",", "atom", ")", ":", "return", "True", "return", "False" ]
Verify if the given package or DEPEND atom has the given flag. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*' portage_config.has_flag license salt Apache-2.0
[ "Verify", "if", "the", "given", "package", "or", "DEPEND", "atom", "has", "the", "given", "flag", ".", "Warning", ":", "This", "only", "works", "if", "the", "configuration", "files", "tree", "is", "in", "the", "correct", "format", "(", "the", "one", "enf...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L510-L524
train
saltstack/salt
salt/modules/portage_config.py
get_missing_flags
def get_missing_flags(conf, atom, flags): ''' Find out which of the given flags are currently not set. CLI Example: .. code-block:: bash salt '*' portage_config.get_missing_flags use salt "['ldap', '-libvirt', 'openssl']" ''' new_flags = [] for flag in flags: if not has_fla...
python
def get_missing_flags(conf, atom, flags): ''' Find out which of the given flags are currently not set. CLI Example: .. code-block:: bash salt '*' portage_config.get_missing_flags use salt "['ldap', '-libvirt', 'openssl']" ''' new_flags = [] for flag in flags: if not has_fla...
[ "def", "get_missing_flags", "(", "conf", ",", "atom", ",", "flags", ")", ":", "new_flags", "=", "[", "]", "for", "flag", "in", "flags", ":", "if", "not", "has_flag", "(", "conf", ",", "atom", ",", "flag", ")", ":", "new_flags", ".", "append", "(", ...
Find out which of the given flags are currently not set. CLI Example: .. code-block:: bash salt '*' portage_config.get_missing_flags use salt "['ldap', '-libvirt', 'openssl']"
[ "Find", "out", "which", "of", "the", "given", "flags", "are", "currently", "not", "set", ".", "CLI", "Example", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L527-L540
train
saltstack/salt
salt/modules/portage_config.py
is_present
def is_present(conf, atom): ''' Tell if a given package or DEPEND atom is present in the configuration files tree. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*'...
python
def is_present(conf, atom): ''' Tell if a given package or DEPEND atom is present in the configuration files tree. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*'...
[ "def", "is_present", "(", "conf", ",", "atom", ")", ":", "if", "conf", "in", "SUPPORTED_CONFS", ":", "if", "not", "isinstance", "(", "atom", ",", "portage", ".", "dep", ".", "Atom", ")", ":", "atom", "=", "portage", ".", "dep", ".", "Atom", "(", "a...
Tell if a given package or DEPEND atom is present in the configuration files tree. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*' portage_config.is_present unmask salt
[ "Tell", "if", "a", "given", "package", "or", "DEPEND", "atom", "is", "present", "in", "the", "configuration", "files", "tree", ".", "Warning", ":", "This", "only", "works", "if", "the", "configuration", "files", "tree", "is", "in", "the", "correct", "forma...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L558-L599
train
saltstack/salt
salt/modules/portage_config.py
get_iuse
def get_iuse(cp): ''' .. versionadded:: 2015.8.0 Gets the current IUSE flags from the tree. @type: cpv: string @param cpv: cat/pkg @rtype list @returns [] or the list of IUSE flags ''' cpv = _get_cpv(cp) try: # aux_get might return dupes, so run them through set() to re...
python
def get_iuse(cp): ''' .. versionadded:: 2015.8.0 Gets the current IUSE flags from the tree. @type: cpv: string @param cpv: cat/pkg @rtype list @returns [] or the list of IUSE flags ''' cpv = _get_cpv(cp) try: # aux_get might return dupes, so run them through set() to re...
[ "def", "get_iuse", "(", "cp", ")", ":", "cpv", "=", "_get_cpv", "(", "cp", ")", "try", ":", "# aux_get might return dupes, so run them through set() to remove them", "dirty_flags", "=", "_porttree", "(", ")", ".", "dbapi", ".", "aux_get", "(", "cpv", ",", "[", ...
.. versionadded:: 2015.8.0 Gets the current IUSE flags from the tree. @type: cpv: string @param cpv: cat/pkg @rtype list @returns [] or the list of IUSE flags
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L602-L619
train
saltstack/salt
salt/modules/portage_config.py
get_installed_use
def get_installed_use(cp, use="USE"): ''' .. versionadded:: 2015.8.0 Gets the installed USE flags from the VARDB. @type: cp: string @param cp: cat/pkg @type use: string @param use: 1 of ["USE", "PKGUSE"] @rtype list @returns [] or the list of IUSE flags ''' portage = _get_p...
python
def get_installed_use(cp, use="USE"): ''' .. versionadded:: 2015.8.0 Gets the installed USE flags from the VARDB. @type: cp: string @param cp: cat/pkg @type use: string @param use: 1 of ["USE", "PKGUSE"] @rtype list @returns [] or the list of IUSE flags ''' portage = _get_p...
[ "def", "get_installed_use", "(", "cp", ",", "use", "=", "\"USE\"", ")", ":", "portage", "=", "_get_portage", "(", ")", "cpv", "=", "_get_cpv", "(", "cp", ")", "return", "portage", ".", "db", "[", "portage", ".", "root", "]", "[", "\"vartree\"", "]", ...
.. versionadded:: 2015.8.0 Gets the installed USE flags from the VARDB. @type: cp: string @param cp: cat/pkg @type use: string @param use: 1 of ["USE", "PKGUSE"] @rtype list @returns [] or the list of IUSE flags
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L622-L637
train
saltstack/salt
salt/modules/portage_config.py
filter_flags
def filter_flags(use, use_expand_hidden, usemasked, useforced): ''' .. versionadded:: 2015.8.0 Filter function to remove hidden or otherwise not normally visible USE flags from a list. @type use: list @param use: the USE flag list to be filtered. @type use_expand_hidden: list @param u...
python
def filter_flags(use, use_expand_hidden, usemasked, useforced): ''' .. versionadded:: 2015.8.0 Filter function to remove hidden or otherwise not normally visible USE flags from a list. @type use: list @param use: the USE flag list to be filtered. @type use_expand_hidden: list @param u...
[ "def", "filter_flags", "(", "use", ",", "use_expand_hidden", ",", "usemasked", ",", "useforced", ")", ":", "portage", "=", "_get_portage", "(", ")", "# clean out some environment flags, since they will most probably", "# be confusing for the user", "for", "f", "in", "use_...
.. versionadded:: 2015.8.0 Filter function to remove hidden or otherwise not normally visible USE flags from a list. @type use: list @param use: the USE flag list to be filtered. @type use_expand_hidden: list @param use_expand_hidden: list of flags hidden. @type usemasked: list @param...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L640-L676
train
saltstack/salt
salt/modules/portage_config.py
get_all_cpv_use
def get_all_cpv_use(cp): ''' .. versionadded:: 2015.8.0 Uses portage to determine final USE flags and settings for an emerge. @type cp: string @param cp: eg cat/pkg @rtype: lists @return use, use_expand_hidden, usemask, useforce ''' cpv = _get_cpv(cp) portage = _get_portage() ...
python
def get_all_cpv_use(cp): ''' .. versionadded:: 2015.8.0 Uses portage to determine final USE flags and settings for an emerge. @type cp: string @param cp: eg cat/pkg @rtype: lists @return use, use_expand_hidden, usemask, useforce ''' cpv = _get_cpv(cp) portage = _get_portage() ...
[ "def", "get_all_cpv_use", "(", "cp", ")", ":", "cpv", "=", "_get_cpv", "(", "cp", ")", "portage", "=", "_get_portage", "(", ")", "use", "=", "None", "_porttree", "(", ")", ".", "dbapi", ".", "settings", ".", "unlock", "(", ")", "try", ":", "_porttree...
.. versionadded:: 2015.8.0 Uses portage to determine final USE flags and settings for an emerge. @type cp: string @param cp: eg cat/pkg @rtype: lists @return use, use_expand_hidden, usemask, useforce
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L679-L707
train
saltstack/salt
salt/modules/portage_config.py
get_cleared_flags
def get_cleared_flags(cp): ''' .. versionadded:: 2015.8.0 Uses portage for compare use flags which is used for installing package and use flags which now exist int /etc/portage/package.use/ @type cp: string @param cp: eg cat/pkg @rtype: tuple @rparam: tuple with two lists - list of use...
python
def get_cleared_flags(cp): ''' .. versionadded:: 2015.8.0 Uses portage for compare use flags which is used for installing package and use flags which now exist int /etc/portage/package.use/ @type cp: string @param cp: eg cat/pkg @rtype: tuple @rparam: tuple with two lists - list of use...
[ "def", "get_cleared_flags", "(", "cp", ")", ":", "cpv", "=", "_get_cpv", "(", "cp", ")", "final_use", ",", "use_expand_hidden", ",", "usemasked", ",", "useforced", "=", "get_all_cpv_use", "(", "cpv", ")", "inst_flags", "=", "filter_flags", "(", "get_installed_...
.. versionadded:: 2015.8.0 Uses portage for compare use flags which is used for installing package and use flags which now exist int /etc/portage/package.use/ @type cp: string @param cp: eg cat/pkg @rtype: tuple @rparam: tuple with two lists - list of used flags and list of flags which wil...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L710-L729
train
saltstack/salt
salt/modules/portage_config.py
is_changed_uses
def is_changed_uses(cp): ''' .. versionadded:: 2015.8.0 Uses portage for determine if the use flags of installed package is compatible with use flags in portage configs. @type cp: string @param cp: eg cat/pkg ''' cpv = _get_cpv(cp) i_flags, conf_flags = get_cleared_flags(cpv) f...
python
def is_changed_uses(cp): ''' .. versionadded:: 2015.8.0 Uses portage for determine if the use flags of installed package is compatible with use flags in portage configs. @type cp: string @param cp: eg cat/pkg ''' cpv = _get_cpv(cp) i_flags, conf_flags = get_cleared_flags(cpv) f...
[ "def", "is_changed_uses", "(", "cp", ")", ":", "cpv", "=", "_get_cpv", "(", "cp", ")", "i_flags", ",", "conf_flags", "=", "get_cleared_flags", "(", "cpv", ")", "for", "i", "in", "i_flags", ":", "try", ":", "conf_flags", ".", "remove", "(", "i", ")", ...
.. versionadded:: 2015.8.0 Uses portage for determine if the use flags of installed package is compatible with use flags in portage configs. @type cp: string @param cp: eg cat/pkg
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L732-L749
train
saltstack/salt
salt/modules/cryptdev.py
active
def active(): ''' List existing device-mapper device details. ''' ret = {} # TODO: This command should be extended to collect more information, such as UUID. devices = __salt__['cmd.run_stdout']('dmsetup ls --target crypt') out_regex = re.compile(r'(?P<devname>\w+)\W+\((?P<major>\d+), (?P<mi...
python
def active(): ''' List existing device-mapper device details. ''' ret = {} # TODO: This command should be extended to collect more information, such as UUID. devices = __salt__['cmd.run_stdout']('dmsetup ls --target crypt') out_regex = re.compile(r'(?P<devname>\w+)\W+\((?P<major>\d+), (?P<mi...
[ "def", "active", "(", ")", ":", "ret", "=", "{", "}", "# TODO: This command should be extended to collect more information, such as UUID.", "devices", "=", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "'dmsetup ls --target crypt'", ")", "out_regex", "=", "re", ".", "c...
List existing device-mapper device details.
[ "List", "existing", "device", "-", "mapper", "device", "details", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cryptdev.py#L111-L129
train
saltstack/salt
salt/modules/cryptdev.py
crypttab
def crypttab(config='/etc/crypttab'): ''' List the contents of the crypttab CLI Example: .. code-block:: bash salt '*' cryptdev.crypttab ''' ret = {} if not os.path.isfile(config): return ret with salt.utils.files.fopen(config) as ifile: for line in ifile: ...
python
def crypttab(config='/etc/crypttab'): ''' List the contents of the crypttab CLI Example: .. code-block:: bash salt '*' cryptdev.crypttab ''' ret = {} if not os.path.isfile(config): return ret with salt.utils.files.fopen(config) as ifile: for line in ifile: ...
[ "def", "crypttab", "(", "config", "=", "'/etc/crypttab'", ")", ":", "ret", "=", "{", "}", "if", "not", "os", ".", "path", ".", "isfile", "(", "config", ")", ":", "return", "ret", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "confi...
List the contents of the crypttab CLI Example: .. code-block:: bash salt '*' cryptdev.crypttab
[ "List", "the", "contents", "of", "the", "crypttab" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cryptdev.py#L132-L161
train
saltstack/salt
salt/modules/cryptdev.py
rm_crypttab
def rm_crypttab(name, config='/etc/crypttab'): ''' Remove the named mapping from the crypttab. If the described entry does not exist, nothing is changed, but the command succeeds by returning ``'absent'``. If a line is removed, it returns ``'change'``. CLI Example: .. code-block:: bash ...
python
def rm_crypttab(name, config='/etc/crypttab'): ''' Remove the named mapping from the crypttab. If the described entry does not exist, nothing is changed, but the command succeeds by returning ``'absent'``. If a line is removed, it returns ``'change'``. CLI Example: .. code-block:: bash ...
[ "def", "rm_crypttab", "(", "name", ",", "config", "=", "'/etc/crypttab'", ")", ":", "modified", "=", "False", "criteria", "=", "_crypttab_entry", "(", "name", "=", "name", ")", "# For each line in the config that does not match the criteria, add it to", "# the list. At th...
Remove the named mapping from the crypttab. If the described entry does not exist, nothing is changed, but the command succeeds by returning ``'absent'``. If a line is removed, it returns ``'change'``. CLI Example: .. code-block:: bash salt '*' cryptdev.rm_crypttab foo
[ "Remove", "the", "named", "mapping", "from", "the", "crypttab", ".", "If", "the", "described", "entry", "does", "not", "exist", "nothing", "is", "changed", "but", "the", "command", "succeeds", "by", "returning", "absent", ".", "If", "a", "line", "is", "rem...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cryptdev.py#L164-L208
train
saltstack/salt
salt/modules/cryptdev.py
set_crypttab
def set_crypttab( name, device, password='none', options='', config='/etc/crypttab', test=False, match_on='name'): ''' Verify that this device is represented in the crypttab, change the device to match the name passed, or add the name if it is not pres...
python
def set_crypttab( name, device, password='none', options='', config='/etc/crypttab', test=False, match_on='name'): ''' Verify that this device is represented in the crypttab, change the device to match the name passed, or add the name if it is not pres...
[ "def", "set_crypttab", "(", "name", ",", "device", ",", "password", "=", "'none'", ",", "options", "=", "''", ",", "config", "=", "'/etc/crypttab'", ",", "test", "=", "False", ",", "match_on", "=", "'name'", ")", ":", "# Fix the options type if it is not a str...
Verify that this device is represented in the crypttab, change the device to match the name passed, or add the name if it is not present. CLI Example: .. code-block:: bash salt '*' cryptdev.set_crypttab foo /dev/sdz1 mypassword swap,size=256
[ "Verify", "that", "this", "device", "is", "represented", "in", "the", "crypttab", "change", "the", "device", "to", "match", "the", "name", "passed", "or", "add", "the", "name", "if", "it", "is", "not", "present", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cryptdev.py#L211-L316
train
saltstack/salt
salt/modules/cryptdev.py
open
def open(name, device, keyfile): ''' Open a crypt device using ``cryptsetup``. The ``keyfile`` must not be ``None`` or ``'none'``, because ``cryptsetup`` will otherwise ask for the password interactively. CLI Example: .. code-block:: bash salt '*' cryptdev.open foo /dev/sdz1 /path/to/...
python
def open(name, device, keyfile): ''' Open a crypt device using ``cryptsetup``. The ``keyfile`` must not be ``None`` or ``'none'``, because ``cryptsetup`` will otherwise ask for the password interactively. CLI Example: .. code-block:: bash salt '*' cryptdev.open foo /dev/sdz1 /path/to/...
[ "def", "open", "(", "name", ",", "device", ",", "keyfile", ")", ":", "if", "keyfile", "is", "None", "or", "keyfile", "==", "'none'", "or", "keyfile", "==", "'-'", ":", "raise", "CommandExecutionError", "(", "'For immediate crypt device mapping, keyfile must not be...
Open a crypt device using ``cryptsetup``. The ``keyfile`` must not be ``None`` or ``'none'``, because ``cryptsetup`` will otherwise ask for the password interactively. CLI Example: .. code-block:: bash salt '*' cryptdev.open foo /dev/sdz1 /path/to/keyfile
[ "Open", "a", "crypt", "device", "using", "cryptsetup", ".", "The", "keyfile", "must", "not", "be", "None", "or", "none", "because", "cryptsetup", "will", "otherwise", "ask", "for", "the", "password", "interactively", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cryptdev.py#L319-L336
train
saltstack/salt
salt/states/keystone_user.py
present
def present(name, auth=None, **kwargs): ''' Ensure domain exists and is up-to-date name Name of the domain domain The name or id of the domain enabled Boolean to control if domain is enabled description An arbitrary description of the domain password ...
python
def present(name, auth=None, **kwargs): ''' Ensure domain exists and is up-to-date name Name of the domain domain The name or id of the domain enabled Boolean to control if domain is enabled description An arbitrary description of the domain password ...
[ "def", "present", "(", "name", ",", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "kwargs", "=", ...
Ensure domain exists and is up-to-date name Name of the domain domain The name or id of the domain enabled Boolean to control if domain is enabled description An arbitrary description of the domain password The user password email The users e...
[ "Ensure", "domain", "exists", "and", "is", "up", "-", "to", "-", "date" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone_user.py#L59-L118
train
saltstack/salt
salt/states/lvs_server.py
present
def present(name, protocol=None, service_address=None, server_address=None, packet_forward_method='dr', weight=1 ): ''' Ensure that the named service is present. name The LVS server name protocol The service protoco...
python
def present(name, protocol=None, service_address=None, server_address=None, packet_forward_method='dr', weight=1 ): ''' Ensure that the named service is present. name The LVS server name protocol The service protoco...
[ "def", "present", "(", "name", ",", "protocol", "=", "None", ",", "service_address", "=", "None", ",", "server_address", "=", "None", ",", "packet_forward_method", "=", "'dr'", ",", "weight", "=", "1", ")", ":", "ret", "=", "{", "'name'", ":", "name", ...
Ensure that the named service is present. name The LVS server name protocol The service protocol service_address The LVS service address server_address The real server address. packet_forward_method The LVS packet forwarding method(``dr`` for direct routi...
[ "Ensure", "that", "the", "named", "service", "is", "present", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvs_server.py#L18-L112
train
saltstack/salt
salt/states/lvs_server.py
absent
def absent(name, protocol=None, service_address=None, server_address=None): ''' Ensure the LVS Real Server in specified service is absent. name The name of the LVS server. protocol The service protocol(only support ``tcp``, ``udp`` and ``fwmark`` service). service_address ...
python
def absent(name, protocol=None, service_address=None, server_address=None): ''' Ensure the LVS Real Server in specified service is absent. name The name of the LVS server. protocol The service protocol(only support ``tcp``, ``udp`` and ``fwmark`` service). service_address ...
[ "def", "absent", "(", "name", ",", "protocol", "=", "None", ",", "service_address", "=", "None", ",", "server_address", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",",...
Ensure the LVS Real Server in specified service is absent. name The name of the LVS server. protocol The service protocol(only support ``tcp``, ``udp`` and ``fwmark`` service). service_address The LVS service address. server_address The LVS real server address.
[ "Ensure", "the", "LVS", "Real", "Server", "in", "specified", "service", "is", "absent", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lvs_server.py#L115-L159
train
saltstack/salt
salt/states/influxdb08_user.py
present
def present(name, passwd, database=None, user=None, password=None, host=None, port=None): ''' Ensure that the cluster admin or database user is present. name The name of the user to manage passwd The password of th...
python
def present(name, passwd, database=None, user=None, password=None, host=None, port=None): ''' Ensure that the cluster admin or database user is present. name The name of the user to manage passwd The password of th...
[ "def", "present", "(", "name", ",", "passwd", ",", "database", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'chang...
Ensure that the cluster admin or database user is present. name The name of the user to manage passwd The password of the user database The database to create the user in user The user to connect as (must be able to create the user) password The password ...
[ "Ensure", "that", "the", "cluster", "admin", "or", "database", "user", "is", "present", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/influxdb08_user.py#L25-L90
train
saltstack/salt
salt/modules/openbsdpkg.py
list_pkgs
def list_pkgs(versions_as_list=False, **kwargs): ''' List the packages currently installed as a dict:: {'<package_name>': '<version>'} CLI Example: .. code-block:: bash salt '*' pkg.list_pkgs ''' versions_as_list = salt.utils.data.is_true(versions_as_list) # not yet imple...
python
def list_pkgs(versions_as_list=False, **kwargs): ''' List the packages currently installed as a dict:: {'<package_name>': '<version>'} CLI Example: .. code-block:: bash salt '*' pkg.list_pkgs ''' versions_as_list = salt.utils.data.is_true(versions_as_list) # not yet imple...
[ "def", "list_pkgs", "(", "versions_as_list", "=", "False", ",", "*", "*", "kwargs", ")", ":", "versions_as_list", "=", "salt", ".", "utils", ".", "data", ".", "is_true", "(", "versions_as_list", ")", "# not yet implemented or not applicable", "if", "any", "(", ...
List the packages currently installed as a dict:: {'<package_name>': '<version>'} CLI Example: .. code-block:: bash salt '*' pkg.list_pkgs
[ "List", "the", "packages", "currently", "installed", "as", "a", "dict", "::" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdpkg.py#L57-L98
train
saltstack/salt
salt/modules/openbsdpkg.py
install
def install(name=None, pkgs=None, sources=None, **kwargs): ''' Install the passed package Return a dict containing the new package names and versions:: {'<package>': {'old': '<old-version>', 'new': '<new-version>'}} CLI Example, Install one package: .. code-block::...
python
def install(name=None, pkgs=None, sources=None, **kwargs): ''' Install the passed package Return a dict containing the new package names and versions:: {'<package>': {'old': '<old-version>', 'new': '<new-version>'}} CLI Example, Install one package: .. code-block::...
[ "def", "install", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "sources", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "pkg_params", ",", "pkg_type", "=", "__salt__", "[", "'pkg_resource.parse_targets'", "]", "(", "name", ","...
Install the passed package Return a dict containing the new package names and versions:: {'<package>': {'old': '<old-version>', 'new': '<new-version>'}} CLI Example, Install one package: .. code-block:: bash salt '*' pkg.install <package name> CLI Example, In...
[ "Install", "the", "passed", "package" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdpkg.py#L184-L250
train
saltstack/salt
salt/modules/openbsdpkg.py
remove
def remove(name=None, pkgs=None, purge=False, **kwargs): ''' Remove a single package with pkg_delete Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if this option is passed. .. versionadded:: 0.1...
python
def remove(name=None, pkgs=None, purge=False, **kwargs): ''' Remove a single package with pkg_delete Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if this option is passed. .. versionadded:: 0.1...
[ "def", "remove", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "purge", "=", "False", ",", "*", "*", "kwargs", ")", ":", "try", ":", "pkg_params", "=", "[", "x", ".", "split", "(", "'--'", ")", "[", "0", "]", "for", "x", "in", "__s...
Remove a single package with pkg_delete Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if this option is passed. .. versionadded:: 0.16.0 Returns a dict containing the changes. CLI Example: ...
[ "Remove", "a", "single", "package", "with", "pkg_delete" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdpkg.py#L253-L314
train
saltstack/salt
salt/modules/openbsdpkg.py
purge
def purge(name=None, pkgs=None, **kwargs): ''' Remove a package and extra configuration files. name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored ...
python
def purge(name=None, pkgs=None, **kwargs): ''' Remove a package and extra configuration files. name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored ...
[ "def", "purge", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "remove", "(", "name", "=", "name", ",", "pkgs", "=", "pkgs", ",", "purge", "=", "True", ")" ]
Remove a package and extra configuration files. name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ``name`` parameter will be ignored if this option is passed. .. versionadded:: 0.16.0...
[ "Remove", "a", "package", "and", "extra", "configuration", "files", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdpkg.py#L317-L344
train
saltstack/salt
salt/modules/openbsdpkg.py
upgrade
def upgrade(name=None, pkgs=None, **kwargs): ''' Run a full package upgrade (``pkg_add -u``), or upgrade a specific package if ``name`` or ``pkgs`` is provided. ``name`` is ignored when ``pkgs`` is specified. Returns a dictionary containing the changes: .. versionadded:...
python
def upgrade(name=None, pkgs=None, **kwargs): ''' Run a full package upgrade (``pkg_add -u``), or upgrade a specific package if ``name`` or ``pkgs`` is provided. ``name`` is ignored when ``pkgs`` is specified. Returns a dictionary containing the changes: .. versionadded:...
[ "def", "upgrade", "(", "name", "=", "None", ",", "pkgs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "old", "=", "list_pkgs", "(", ")", "cmd", "=", "[", "'pkg_add'", ",", "'-Ix'", ",", "'-u'", "]", "if", "kwargs", ".", "get", "(", "'noop'", ...
Run a full package upgrade (``pkg_add -u``), or upgrade a specific package if ``name`` or ``pkgs`` is provided. ``name`` is ignored when ``pkgs`` is specified. Returns a dictionary containing the changes: .. versionadded:: 2019.2.0 .. code-block:: python {'<package>': {'old': '<old-versi...
[ "Run", "a", "full", "package", "upgrade", "(", "pkg_add", "-", "u", ")", "or", "upgrade", "a", "specific", "package", "if", "name", "or", "pkgs", "is", "provided", ".", "name", "is", "ignored", "when", "pkgs", "is", "specified", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdpkg.py#L362-L413
train
saltstack/salt
salt/states/boto_datapipeline.py
present
def present(name, pipeline_objects=None, pipeline_objects_from_pillars='boto_datapipeline_pipeline_objects', parameter_objects=None, parameter_objects_from_pillars='boto_datapipeline_parameter_objects', parameter_values=None, parameter_values_from_pillars='bot...
python
def present(name, pipeline_objects=None, pipeline_objects_from_pillars='boto_datapipeline_pipeline_objects', parameter_objects=None, parameter_objects_from_pillars='boto_datapipeline_parameter_objects', parameter_values=None, parameter_values_from_pillars='bot...
[ "def", "present", "(", "name", ",", "pipeline_objects", "=", "None", ",", "pipeline_objects_from_pillars", "=", "'boto_datapipeline_pipeline_objects'", ",", "parameter_objects", "=", "None", ",", "parameter_objects_from_pillars", "=", "'boto_datapipeline_parameter_objects'", ...
Ensure the data pipeline exists with matching definition. name Name of the service to ensure a data pipeline exists for. pipeline_objects Pipeline objects to use. Will override objects read from pillars. pipeline_objects_from_pillars The pillar key to use for lookup. paramete...
[ "Ensure", "the", "data", "pipeline", "exists", "with", "matching", "definition", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L72-L251
train
saltstack/salt
salt/states/boto_datapipeline.py
_pipeline_present_with_definition
def _pipeline_present_with_definition(name, expected_pipeline_objects, expected_parameter_objects, expected_parameter_values, region, key, keyid, profile): ''' Return true if the pipeline exists and...
python
def _pipeline_present_with_definition(name, expected_pipeline_objects, expected_parameter_objects, expected_parameter_values, region, key, keyid, profile): ''' Return true if the pipeline exists and...
[ "def", "_pipeline_present_with_definition", "(", "name", ",", "expected_pipeline_objects", ",", "expected_parameter_objects", ",", "expected_parameter_values", ",", "region", ",", "key", ",", "keyid", ",", "profile", ")", ":", "result_pipeline_id", "=", "__salt__", "[",...
Return true if the pipeline exists and the definition matches. name The name of the pipeline. expected_pipeline_objects Pipeline objects that must match the definition. expected_parameter_objects Parameter objects that must match the definition. expected_parameter_values ...
[ "Return", "true", "if", "the", "pipeline", "exists", "and", "the", "definition", "matches", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L268-L331
train
saltstack/salt
salt/states/boto_datapipeline.py
_cleaned
def _cleaned(_pipeline_objects): """Return standardized pipeline objects to be used for comparing Remove year, month, and day components of the startDateTime so that data pipelines with the same time of day but different days are considered equal. """ pipeline_objects = copy.deepcopy(_pipeline_...
python
def _cleaned(_pipeline_objects): """Return standardized pipeline objects to be used for comparing Remove year, month, and day components of the startDateTime so that data pipelines with the same time of day but different days are considered equal. """ pipeline_objects = copy.deepcopy(_pipeline_...
[ "def", "_cleaned", "(", "_pipeline_objects", ")", ":", "pipeline_objects", "=", "copy", ".", "deepcopy", "(", "_pipeline_objects", ")", "for", "pipeline_object", "in", "pipeline_objects", ":", "if", "pipeline_object", "[", "'id'", "]", "==", "'DefaultSchedule'", "...
Return standardized pipeline objects to be used for comparing Remove year, month, and day components of the startDateTime so that data pipelines with the same time of day but different days are considered equal.
[ "Return", "standardized", "pipeline", "objects", "to", "be", "used", "for", "comparing" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L334-L350
train
saltstack/salt
salt/states/boto_datapipeline.py
_recursive_compare
def _recursive_compare(v1, v2): ''' Return v1 == v2. Compares list, dict, recursively. ''' if isinstance(v1, list): if v2 is None: v2 = [] if len(v1) != len(v2): return False v1.sort(key=_id_or_key) v2.sort(key=_id_or_key) for x, y in zip(v...
python
def _recursive_compare(v1, v2): ''' Return v1 == v2. Compares list, dict, recursively. ''' if isinstance(v1, list): if v2 is None: v2 = [] if len(v1) != len(v2): return False v1.sort(key=_id_or_key) v2.sort(key=_id_or_key) for x, y in zip(v...
[ "def", "_recursive_compare", "(", "v1", ",", "v2", ")", ":", "if", "isinstance", "(", "v1", ",", "list", ")", ":", "if", "v2", "is", "None", ":", "v2", "=", "[", "]", "if", "len", "(", "v1", ")", "!=", "len", "(", "v2", ")", ":", "return", "F...
Return v1 == v2. Compares list, dict, recursively.
[ "Return", "v1", "==", "v2", ".", "Compares", "list", "dict", "recursively", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L353-L380
train
saltstack/salt
salt/states/boto_datapipeline.py
_id_or_key
def _id_or_key(list_item): ''' Return the value at key 'id' or 'key'. ''' if isinstance(list_item, dict): if 'id' in list_item: return list_item['id'] if 'key' in list_item: return list_item['key'] return list_item
python
def _id_or_key(list_item): ''' Return the value at key 'id' or 'key'. ''' if isinstance(list_item, dict): if 'id' in list_item: return list_item['id'] if 'key' in list_item: return list_item['key'] return list_item
[ "def", "_id_or_key", "(", "list_item", ")", ":", "if", "isinstance", "(", "list_item", ",", "dict", ")", ":", "if", "'id'", "in", "list_item", ":", "return", "list_item", "[", "'id'", "]", "if", "'key'", "in", "list_item", ":", "return", "list_item", "["...
Return the value at key 'id' or 'key'.
[ "Return", "the", "value", "at", "key", "id", "or", "key", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L383-L392
train
saltstack/salt
salt/states/boto_datapipeline.py
_diff
def _diff(old_pipeline_definition, new_pipeline_definition): ''' Return string diff of pipeline definitions. ''' old_pipeline_definition.pop('ResponseMetadata', None) new_pipeline_definition.pop('ResponseMetadata', None) diff = salt.utils.data.decode(difflib.unified_diff( salt.utils.jso...
python
def _diff(old_pipeline_definition, new_pipeline_definition): ''' Return string diff of pipeline definitions. ''' old_pipeline_definition.pop('ResponseMetadata', None) new_pipeline_definition.pop('ResponseMetadata', None) diff = salt.utils.data.decode(difflib.unified_diff( salt.utils.jso...
[ "def", "_diff", "(", "old_pipeline_definition", ",", "new_pipeline_definition", ")", ":", "old_pipeline_definition", ".", "pop", "(", "'ResponseMetadata'", ",", "None", ")", "new_pipeline_definition", ".", "pop", "(", "'ResponseMetadata'", ",", "None", ")", "diff", ...
Return string diff of pipeline definitions.
[ "Return", "string", "diff", "of", "pipeline", "definitions", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L395-L406
train
saltstack/salt
salt/states/boto_datapipeline.py
_standardize
def _standardize(structure): ''' Return standardized format for lists/dictionaries. Lists of dictionaries are sorted by the value of the dictionary at its primary key ('id' or 'key'). OrderedDict's are converted to basic dictionaries. ''' def mutating_helper(structure): if isinstanc...
python
def _standardize(structure): ''' Return standardized format for lists/dictionaries. Lists of dictionaries are sorted by the value of the dictionary at its primary key ('id' or 'key'). OrderedDict's are converted to basic dictionaries. ''' def mutating_helper(structure): if isinstanc...
[ "def", "_standardize", "(", "structure", ")", ":", "def", "mutating_helper", "(", "structure", ")", ":", "if", "isinstance", "(", "structure", ",", "list", ")", ":", "structure", ".", "sort", "(", "key", "=", "_id_or_key", ")", "for", "each", "in", "stru...
Return standardized format for lists/dictionaries. Lists of dictionaries are sorted by the value of the dictionary at its primary key ('id' or 'key'). OrderedDict's are converted to basic dictionaries.
[ "Return", "standardized", "format", "for", "lists", "/", "dictionaries", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L409-L430
train
saltstack/salt
salt/states/boto_datapipeline.py
_pipeline_objects
def _pipeline_objects(pipeline_objects_from_pillars, pipeline_object_overrides): ''' Return a list of pipeline objects that compose the pipeline pipeline_objects_from_pillars The pillar key to use for lookup pipeline_object_overrides Pipeline objects to use. Will override objects read ...
python
def _pipeline_objects(pipeline_objects_from_pillars, pipeline_object_overrides): ''' Return a list of pipeline objects that compose the pipeline pipeline_objects_from_pillars The pillar key to use for lookup pipeline_object_overrides Pipeline objects to use. Will override objects read ...
[ "def", "_pipeline_objects", "(", "pipeline_objects_from_pillars", ",", "pipeline_object_overrides", ")", ":", "from_pillars", "=", "copy", ".", "deepcopy", "(", "__salt__", "[", "'pillar.get'", "]", "(", "pipeline_objects_from_pillars", ")", ")", "from_pillars", ".", ...
Return a list of pipeline objects that compose the pipeline pipeline_objects_from_pillars The pillar key to use for lookup pipeline_object_overrides Pipeline objects to use. Will override objects read from pillars.
[ "Return", "a", "list", "of", "pipeline", "objects", "that", "compose", "the", "pipeline" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L433-L448
train
saltstack/salt
salt/states/boto_datapipeline.py
_parameter_objects
def _parameter_objects(parameter_objects_from_pillars, parameter_object_overrides): ''' Return a list of parameter objects that configure the pipeline parameter_objects_from_pillars The pillar key to use for lookup parameter_object_overrides Parameter objects to use. Will override obje...
python
def _parameter_objects(parameter_objects_from_pillars, parameter_object_overrides): ''' Return a list of parameter objects that configure the pipeline parameter_objects_from_pillars The pillar key to use for lookup parameter_object_overrides Parameter objects to use. Will override obje...
[ "def", "_parameter_objects", "(", "parameter_objects_from_pillars", ",", "parameter_object_overrides", ")", ":", "from_pillars", "=", "copy", ".", "deepcopy", "(", "__salt__", "[", "'pillar.get'", "]", "(", "parameter_objects_from_pillars", ")", ")", "from_pillars", "."...
Return a list of parameter objects that configure the pipeline parameter_objects_from_pillars The pillar key to use for lookup parameter_object_overrides Parameter objects to use. Will override objects read from pillars.
[ "Return", "a", "list", "of", "parameter", "objects", "that", "configure", "the", "pipeline" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L451-L466
train
saltstack/salt
salt/states/boto_datapipeline.py
_parameter_values
def _parameter_values(parameter_values_from_pillars, parameter_value_overrides): ''' Return a dictionary of parameter values that configure the pipeline parameter_values_from_pillars The pillar key to use for lookup parameter_value_overrides Parameter values to use. Will override value...
python
def _parameter_values(parameter_values_from_pillars, parameter_value_overrides): ''' Return a dictionary of parameter values that configure the pipeline parameter_values_from_pillars The pillar key to use for lookup parameter_value_overrides Parameter values to use. Will override value...
[ "def", "_parameter_values", "(", "parameter_values_from_pillars", ",", "parameter_value_overrides", ")", ":", "from_pillars", "=", "copy", ".", "deepcopy", "(", "__salt__", "[", "'pillar.get'", "]", "(", "parameter_values_from_pillars", ")", ")", "from_pillars", ".", ...
Return a dictionary of parameter values that configure the pipeline parameter_values_from_pillars The pillar key to use for lookup parameter_value_overrides Parameter values to use. Will override values read from pillars.
[ "Return", "a", "dictionary", "of", "parameter", "values", "that", "configure", "the", "pipeline" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L469-L482
train
saltstack/salt
salt/states/boto_datapipeline.py
_dict_to_list_ids
def _dict_to_list_ids(objects): ''' Convert a dictionary to a list of dictionaries, where each element has a key value pair {'id': key}. This makes it easy to override pillar values while still satisfying the boto api. ''' list_with_ids = [] for key, value in six.iteritems(objects): ...
python
def _dict_to_list_ids(objects): ''' Convert a dictionary to a list of dictionaries, where each element has a key value pair {'id': key}. This makes it easy to override pillar values while still satisfying the boto api. ''' list_with_ids = [] for key, value in six.iteritems(objects): ...
[ "def", "_dict_to_list_ids", "(", "objects", ")", ":", "list_with_ids", "=", "[", "]", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "objects", ")", ":", "element", "=", "{", "'id'", ":", "key", "}", "element", ".", "update", "(", "v...
Convert a dictionary to a list of dictionaries, where each element has a key value pair {'id': key}. This makes it easy to override pillar values while still satisfying the boto api.
[ "Convert", "a", "dictionary", "to", "a", "list", "of", "dictionaries", "where", "each", "element", "has", "a", "key", "value", "pair", "{", "id", ":", "key", "}", ".", "This", "makes", "it", "easy", "to", "override", "pillar", "values", "while", "still",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L485-L496
train
saltstack/salt
salt/states/boto_datapipeline.py
_properties_from_dict
def _properties_from_dict(d, key_name='key'): ''' Transforms dictionary into pipeline object properties. The output format conforms to boto's specification. Example input: { 'a': '1', 'b': { 'ref': '2' }, } Example output: ...
python
def _properties_from_dict(d, key_name='key'): ''' Transforms dictionary into pipeline object properties. The output format conforms to boto's specification. Example input: { 'a': '1', 'b': { 'ref': '2' }, } Example output: ...
[ "def", "_properties_from_dict", "(", "d", ",", "key_name", "=", "'key'", ")", ":", "fields", "=", "[", "]", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "d", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "fie...
Transforms dictionary into pipeline object properties. The output format conforms to boto's specification. Example input: { 'a': '1', 'b': { 'ref': '2' }, } Example output: [ { 'key': 'a', ...
[ "Transforms", "dictionary", "into", "pipeline", "object", "properties", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L499-L537
train
saltstack/salt
salt/states/boto_datapipeline.py
absent
def absent(name, region=None, key=None, keyid=None, profile=None): ''' Ensure a pipeline with the service_name does not exist name Name of the service to ensure a data pipeline does not exist for. region Region to connect to. key Secret key to be used. keyid A...
python
def absent(name, region=None, key=None, keyid=None, profile=None): ''' Ensure a pipeline with the service_name does not exist name Name of the service to ensure a data pipeline does not exist for. region Region to connect to. key Secret key to be used. keyid A...
[ "def", "absent", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''"...
Ensure a pipeline with the service_name does not exist name Name of the service to ensure a data pipeline does not exist for. region Region to connect to. key Secret key to be used. keyid Access key to be used. profile A dict with region, key and keyid, o...
[ "Ensure", "a", "pipeline", "with", "the", "service_name", "does", "not", "exist" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L540-L588
train
saltstack/salt
salt/serializers/json.py
deserialize
def deserialize(stream_or_string, **options): ''' Deserialize any string or stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower json/simplejson module. ''' try: if not isinstance(stream_or_str...
python
def deserialize(stream_or_string, **options): ''' Deserialize any string or stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower json/simplejson module. ''' try: if not isinstance(stream_or_str...
[ "def", "deserialize", "(", "stream_or_string", ",", "*", "*", "options", ")", ":", "try", ":", "if", "not", "isinstance", "(", "stream_or_string", ",", "(", "bytes", ",", "six", ".", "string_types", ")", ")", ":", "return", "salt", ".", "utils", ".", "...
Deserialize any string or stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower json/simplejson module.
[ "Deserialize", "any", "string", "or", "stream", "like", "object", "into", "a", "Python", "data", "structure", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/json.py#L30-L48
train
saltstack/salt
salt/serializers/json.py
serialize
def serialize(obj, **options): ''' Serialize Python data to JSON. :param obj: the data structure to serialize :param options: options given to lower json/simplejson module. ''' try: if 'fp' in options: return salt.utils.json.dump(obj, _json_module=_json, **options) ...
python
def serialize(obj, **options): ''' Serialize Python data to JSON. :param obj: the data structure to serialize :param options: options given to lower json/simplejson module. ''' try: if 'fp' in options: return salt.utils.json.dump(obj, _json_module=_json, **options) ...
[ "def", "serialize", "(", "obj", ",", "*", "*", "options", ")", ":", "try", ":", "if", "'fp'", "in", "options", ":", "return", "salt", ".", "utils", ".", "json", ".", "dump", "(", "obj", ",", "_json_module", "=", "_json", ",", "*", "*", "options", ...
Serialize Python data to JSON. :param obj: the data structure to serialize :param options: options given to lower json/simplejson module.
[ "Serialize", "Python", "data", "to", "JSON", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/json.py#L51-L65
train
saltstack/salt
salt/states/mysql_database.py
present
def present(name, character_set=None, collate=None, **connection_args): ''' Ensure that the named database is present with the specified properties name The name of the database to manage ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'Da...
python
def present(name, character_set=None, collate=None, **connection_args): ''' Ensure that the named database is present with the specified properties name The name of the database to manage ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'Da...
[ "def", "present", "(", "name", ",", "character_set", "=", "None", ",", "collate", "=", "None", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "...
Ensure that the named database is present with the specified properties name The name of the database to manage
[ "Ensure", "that", "the", "named", "database", "is", "present", "with", "the", "specified", "properties" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mysql_database.py#L43-L105
train
saltstack/salt
salt/states/mysql_database.py
absent
def absent(name, **connection_args): ''' Ensure that the named database is absent name The name of the database to remove ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} #check if db exists and remove it if __salt__['mysql.db_...
python
def absent(name, **connection_args): ''' Ensure that the named database is absent name The name of the database to remove ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} #check if db exists and remove it if __salt__['mysql.db_...
[ "def", "absent", "(", "name", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "#check if db exists and remove it", "if", ...
Ensure that the named database is absent name The name of the database to remove
[ "Ensure", "that", "the", "named", "database", "is", "absent" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mysql_database.py#L108-L148
train
saltstack/salt
salt/runners/net.py
_get_net_runner_opts
def _get_net_runner_opts(): ''' Return the net.find runner options. ''' runner_opts = __opts__.get('runners', {}).get('net.find', {}) return { 'target': runner_opts.get('target', _DEFAULT_TARGET), 'expr_form': runner_opts.get('expr_form', _DEFAULT_EXPR_FORM), 'ignore_interfac...
python
def _get_net_runner_opts(): ''' Return the net.find runner options. ''' runner_opts = __opts__.get('runners', {}).get('net.find', {}) return { 'target': runner_opts.get('target', _DEFAULT_TARGET), 'expr_form': runner_opts.get('expr_form', _DEFAULT_EXPR_FORM), 'ignore_interfac...
[ "def", "_get_net_runner_opts", "(", ")", ":", "runner_opts", "=", "__opts__", ".", "get", "(", "'runners'", ",", "{", "}", ")", ".", "get", "(", "'net.find'", ",", "{", "}", ")", "return", "{", "'target'", ":", "runner_opts", ".", "get", "(", "'target'...
Return the net.find runner options.
[ "Return", "the", "net", ".", "find", "runner", "options", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L121-L132
train
saltstack/salt
salt/runners/net.py
_get_mine
def _get_mine(fun): ''' Return the mine function from all the targeted minions. Just a small helper to avoid redundant pieces of code. ''' if fun in _CACHE and _CACHE[fun]: return _CACHE[fun] net_runner_opts = _get_net_runner_opts() _CACHE[fun] = __salt__['mine.get'](net_runner_opts....
python
def _get_mine(fun): ''' Return the mine function from all the targeted minions. Just a small helper to avoid redundant pieces of code. ''' if fun in _CACHE and _CACHE[fun]: return _CACHE[fun] net_runner_opts = _get_net_runner_opts() _CACHE[fun] = __salt__['mine.get'](net_runner_opts....
[ "def", "_get_mine", "(", "fun", ")", ":", "if", "fun", "in", "_CACHE", "and", "_CACHE", "[", "fun", "]", ":", "return", "_CACHE", "[", "fun", "]", "net_runner_opts", "=", "_get_net_runner_opts", "(", ")", "_CACHE", "[", "fun", "]", "=", "__salt__", "["...
Return the mine function from all the targeted minions. Just a small helper to avoid redundant pieces of code.
[ "Return", "the", "mine", "function", "from", "all", "the", "targeted", "minions", ".", "Just", "a", "small", "helper", "to", "avoid", "redundant", "pieces", "of", "code", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L135-L146
train
saltstack/salt
salt/runners/net.py
_display_runner
def _display_runner(rows, labels, title, display=_DEFAULT_DISPLAY): ''' Display or return the rows. ''' if display: net_runner_opts = _get_net_runner_opts() if net_runner_opts.get('outputter') == 'table': ret = salt.output.out_format({'rows': rows, 'labels': labels}, ...
python
def _display_runner(rows, labels, title, display=_DEFAULT_DISPLAY): ''' Display or return the rows. ''' if display: net_runner_opts = _get_net_runner_opts() if net_runner_opts.get('outputter') == 'table': ret = salt.output.out_format({'rows': rows, 'labels': labels}, ...
[ "def", "_display_runner", "(", "rows", ",", "labels", ",", "title", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "if", "display", ":", "net_runner_opts", "=", "_get_net_runner_opts", "(", ")", "if", "net_runner_opts", ".", "get", "(", "'outputter'", ")",...
Display or return the rows.
[ "Display", "or", "return", "the", "rows", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L149-L168
train
saltstack/salt
salt/runners/net.py
_find_interfaces_ip
def _find_interfaces_ip(mac): ''' Helper to search the interfaces IPs using the MAC address. ''' try: mac = napalm_helpers.convert(napalm_helpers.mac, mac) except AddrFormatError: return ('', '', []) all_interfaces = _get_mine('net.interfaces') all_ipaddrs = _get_mine('net.i...
python
def _find_interfaces_ip(mac): ''' Helper to search the interfaces IPs using the MAC address. ''' try: mac = napalm_helpers.convert(napalm_helpers.mac, mac) except AddrFormatError: return ('', '', []) all_interfaces = _get_mine('net.interfaces') all_ipaddrs = _get_mine('net.i...
[ "def", "_find_interfaces_ip", "(", "mac", ")", ":", "try", ":", "mac", "=", "napalm_helpers", ".", "convert", "(", "napalm_helpers", ".", "mac", ",", "mac", ")", "except", "AddrFormatError", ":", "return", "(", "''", ",", "''", ",", "[", "]", ")", "all...
Helper to search the interfaces IPs using the MAC address.
[ "Helper", "to", "search", "the", "interfaces", "IPs", "using", "the", "MAC", "address", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L183-L213
train
saltstack/salt
salt/runners/net.py
_find_interfaces_mac
def _find_interfaces_mac(ip): # pylint: disable=invalid-name ''' Helper to get the interfaces hardware address using the IP Address. ''' all_interfaces = _get_mine('net.interfaces') all_ipaddrs = _get_mine('net.ipaddrs') for device, device_ipaddrs in six.iteritems(all_ipaddrs): if not ...
python
def _find_interfaces_mac(ip): # pylint: disable=invalid-name ''' Helper to get the interfaces hardware address using the IP Address. ''' all_interfaces = _get_mine('net.interfaces') all_ipaddrs = _get_mine('net.ipaddrs') for device, device_ipaddrs in six.iteritems(all_ipaddrs): if not ...
[ "def", "_find_interfaces_mac", "(", "ip", ")", ":", "# pylint: disable=invalid-name", "all_interfaces", "=", "_get_mine", "(", "'net.interfaces'", ")", "all_ipaddrs", "=", "_get_mine", "(", "'net.ipaddrs'", ")", "for", "device", ",", "device_ipaddrs", "in", "six", "...
Helper to get the interfaces hardware address using the IP Address.
[ "Helper", "to", "get", "the", "interfaces", "hardware", "address", "using", "the", "IP", "Address", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L216-L235
train
saltstack/salt
salt/runners/net.py
interfaces
def interfaces(device=None, interface=None, title=None, pattern=None, ipnet=None, best=True, display=_DEFAULT_DISPLAY): ''' Search for interfaces details in the following mine functions: - net.interfaces - net.ipa...
python
def interfaces(device=None, interface=None, title=None, pattern=None, ipnet=None, best=True, display=_DEFAULT_DISPLAY): ''' Search for interfaces details in the following mine functions: - net.interfaces - net.ipa...
[ "def", "interfaces", "(", "device", "=", "None", ",", "interface", "=", "None", ",", "title", "=", "None", ",", "pattern", "=", "None", ",", "ipnet", "=", "None", ",", "best", "=", "True", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "def", "_i...
Search for interfaces details in the following mine functions: - net.interfaces - net.ipaddrs Optional arguments: device Return interface data from a certain device only. interface Return data selecting by interface name. pattern Return interfaces that contain a cert...
[ "Search", "for", "interfaces", "details", "in", "the", "following", "mine", "functions", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L243-L431
train
saltstack/salt
salt/runners/net.py
findarp
def findarp(device=None, interface=None, mac=None, ip=None, display=_DEFAULT_DISPLAY): # pylint: disable=invalid-name ''' Search for entries in the ARP tables using the following mine functions: - net.arp Optional arguments: device Return i...
python
def findarp(device=None, interface=None, mac=None, ip=None, display=_DEFAULT_DISPLAY): # pylint: disable=invalid-name ''' Search for entries in the ARP tables using the following mine functions: - net.arp Optional arguments: device Return i...
[ "def", "findarp", "(", "device", "=", "None", ",", "interface", "=", "None", ",", "mac", "=", "None", ",", "ip", "=", "None", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "# pylint: disable=invalid-name", "labels", "=", "{", "'device'", ":", "'Device...
Search for entries in the ARP tables using the following mine functions: - net.arp Optional arguments: device Return interface data from a certain device only. interface Return data selecting by interface name. mac Search using a specific MAC Address. ip Sea...
[ "Search", "for", "entries", "in", "the", "ARP", "tables", "using", "the", "following", "mine", "functions", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L434-L521
train
saltstack/salt
salt/runners/net.py
findmac
def findmac(device=None, mac=None, interface=None, vlan=None, display=_DEFAULT_DISPLAY): ''' Search in the MAC Address tables, using the following mine functions: - net.mac Optional arguments: device Return interface data from a certain device only. interface Return data sele...
python
def findmac(device=None, mac=None, interface=None, vlan=None, display=_DEFAULT_DISPLAY): ''' Search in the MAC Address tables, using the following mine functions: - net.mac Optional arguments: device Return interface data from a certain device only. interface Return data sele...
[ "def", "findmac", "(", "device", "=", "None", ",", "mac", "=", "None", ",", "interface", "=", "None", ",", "vlan", "=", "None", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "labels", "=", "{", "'device'", ":", "'Device'", ",", "'interface'", ":",...
Search in the MAC Address tables, using the following mine functions: - net.mac Optional arguments: device Return interface data from a certain device only. interface Return data selecting by interface name. mac Search using a specific MAC Address. vlan Sear...
[ "Search", "in", "the", "MAC", "Address", "tables", "using", "the", "following", "mine", "functions", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L524-L612
train
saltstack/salt
salt/runners/net.py
lldp
def lldp(device=None, interface=None, title=None, pattern=None, chassis=None, display=_DEFAULT_DISPLAY): ''' Search in the LLDP neighbors, using the following mine functions: - net.lldp Optional arguments: device Return interface data from a ce...
python
def lldp(device=None, interface=None, title=None, pattern=None, chassis=None, display=_DEFAULT_DISPLAY): ''' Search in the LLDP neighbors, using the following mine functions: - net.lldp Optional arguments: device Return interface data from a ce...
[ "def", "lldp", "(", "device", "=", "None", ",", "interface", "=", "None", ",", "title", "=", "None", ",", "pattern", "=", "None", ",", "chassis", "=", "None", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "all_lldp", "=", "_get_mine", "(", "'net.l...
Search in the LLDP neighbors, using the following mine functions: - net.lldp Optional arguments: device Return interface data from a certain device only. interface Return data selecting by interface name. pattern Return LLDP neighbors that have contain this pattern in on...
[ "Search", "in", "the", "LLDP", "neighbors", "using", "the", "following", "mine", "functions", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L615-L752
train
saltstack/salt
salt/runners/net.py
find
def find(addr, best=True, display=_DEFAULT_DISPLAY): ''' Search in all possible entities (Interfaces, MAC tables, ARP tables, LLDP neighbors), using the following mine functions: - net.mac - net.arp - net.lldp - net.ipaddrs - net.interfaces This function has the advantage that it k...
python
def find(addr, best=True, display=_DEFAULT_DISPLAY): ''' Search in all possible entities (Interfaces, MAC tables, ARP tables, LLDP neighbors), using the following mine functions: - net.mac - net.arp - net.lldp - net.ipaddrs - net.interfaces This function has the advantage that it k...
[ "def", "find", "(", "addr", ",", "best", "=", "True", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "if", "not", "addr", ":", "if", "display", ":", "print", "(", "'Please type a valid MAC/IP Address / Device / Interface / VLAN'", ")", "return", "{", "}", ...
Search in all possible entities (Interfaces, MAC tables, ARP tables, LLDP neighbors), using the following mine functions: - net.mac - net.arp - net.lldp - net.ipaddrs - net.interfaces This function has the advantage that it knows where to look, but the output might become quite long as...
[ "Search", "in", "all", "possible", "entities", "(", "Interfaces", "MAC", "tables", "ARP", "tables", "LLDP", "neighbors", ")", "using", "the", "following", "mine", "functions", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L755-L907
train
saltstack/salt
salt/runners/net.py
multi_find
def multi_find(*patterns, **kwargs): ''' Execute multiple search tasks. This function is based on the `find` function. Depending on the search items, some information might overlap. Optional arguments: best: ``True`` Return only the best match with the interfaces IP networks wh...
python
def multi_find(*patterns, **kwargs): ''' Execute multiple search tasks. This function is based on the `find` function. Depending on the search items, some information might overlap. Optional arguments: best: ``True`` Return only the best match with the interfaces IP networks wh...
[ "def", "multi_find", "(", "*", "patterns", ",", "*", "*", "kwargs", ")", ":", "out", "=", "{", "}", "for", "pattern", "in", "set", "(", "patterns", ")", ":", "search_result", "=", "find", "(", "pattern", ",", "best", "=", "kwargs", ".", "get", "(",...
Execute multiple search tasks. This function is based on the `find` function. Depending on the search items, some information might overlap. Optional arguments: best: ``True`` Return only the best match with the interfaces IP networks when the saerching pattern is a valid IP Address or...
[ "Execute", "multiple", "search", "tasks", ".", "This", "function", "is", "based", "on", "the", "find", "function", ".", "Depending", "on", "the", "search", "items", "some", "information", "might", "overlap", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L910-L967
train
saltstack/salt
salt/modules/augeas_cfg.py
_recurmatch
def _recurmatch(path, aug): ''' Recursive generator providing the infrastructure for augtools print behavior. This function is based on test_augeas.py from Harald Hoyer <harald@redhat.com> in the python-augeas repository ''' if path: clean_path = path.rstrip('/*') yield...
python
def _recurmatch(path, aug): ''' Recursive generator providing the infrastructure for augtools print behavior. This function is based on test_augeas.py from Harald Hoyer <harald@redhat.com> in the python-augeas repository ''' if path: clean_path = path.rstrip('/*') yield...
[ "def", "_recurmatch", "(", "path", ",", "aug", ")", ":", "if", "path", ":", "clean_path", "=", "path", ".", "rstrip", "(", "'/*'", ")", "yield", "(", "clean_path", ",", "aug", ".", "get", "(", "path", ")", ")", "for", "i", "in", "aug", ".", "matc...
Recursive generator providing the infrastructure for augtools print behavior. This function is based on test_augeas.py from Harald Hoyer <harald@redhat.com> in the python-augeas repository
[ "Recursive", "generator", "providing", "the", "infrastructure", "for", "augtools", "print", "behavior", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L75-L91
train
saltstack/salt
salt/modules/augeas_cfg.py
_lstrip_word
def _lstrip_word(word, prefix): ''' Return a copy of the string after the specified prefix was removed from the beginning of the string ''' if six.text_type(word).startswith(prefix): return six.text_type(word)[len(prefix):] return word
python
def _lstrip_word(word, prefix): ''' Return a copy of the string after the specified prefix was removed from the beginning of the string ''' if six.text_type(word).startswith(prefix): return six.text_type(word)[len(prefix):] return word
[ "def", "_lstrip_word", "(", "word", ",", "prefix", ")", ":", "if", "six", ".", "text_type", "(", "word", ")", ".", "startswith", "(", "prefix", ")", ":", "return", "six", ".", "text_type", "(", "word", ")", "[", "len", "(", "prefix", ")", ":", "]",...
Return a copy of the string after the specified prefix was removed from the beginning of the string
[ "Return", "a", "copy", "of", "the", "string", "after", "the", "specified", "prefix", "was", "removed", "from", "the", "beginning", "of", "the", "string" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L94-L102
train
saltstack/salt
salt/modules/augeas_cfg.py
_check_load_paths
def _check_load_paths(load_path): ''' Checks the validity of the load_path, returns a sanitized version with invalid paths removed. ''' if load_path is None or not isinstance(load_path, six.string_types): return None _paths = [] for _path in load_path.split(':'): if os.path...
python
def _check_load_paths(load_path): ''' Checks the validity of the load_path, returns a sanitized version with invalid paths removed. ''' if load_path is None or not isinstance(load_path, six.string_types): return None _paths = [] for _path in load_path.split(':'): if os.path...
[ "def", "_check_load_paths", "(", "load_path", ")", ":", "if", "load_path", "is", "None", "or", "not", "isinstance", "(", "load_path", ",", "six", ".", "string_types", ")", ":", "return", "None", "_paths", "=", "[", "]", "for", "_path", "in", "load_path", ...
Checks the validity of the load_path, returns a sanitized version with invalid paths removed.
[ "Checks", "the", "validity", "of", "the", "load_path", "returns", "a", "sanitized", "version", "with", "invalid", "paths", "removed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L105-L124
train
saltstack/salt
salt/modules/augeas_cfg.py
execute
def execute(context=None, lens=None, commands=(), load_path=None): ''' Execute Augeas commands .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' augeas.execute /files/etc/redis/redis.conf \\ commands='["set bind 0.0.0.0", "set maxmemory 1G"]' context ...
python
def execute(context=None, lens=None, commands=(), load_path=None): ''' Execute Augeas commands .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' augeas.execute /files/etc/redis/redis.conf \\ commands='["set bind 0.0.0.0", "set maxmemory 1G"]' context ...
[ "def", "execute", "(", "context", "=", "None", ",", "lens", "=", "None", ",", "commands", "=", "(", ")", ",", "load_path", "=", "None", ")", ":", "ret", "=", "{", "'retval'", ":", "False", "}", "arg_map", "=", "{", "'set'", ":", "(", "1", ",", ...
Execute Augeas commands .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' augeas.execute /files/etc/redis/redis.conf \\ commands='["set bind 0.0.0.0", "set maxmemory 1G"]' context The Augeas context lens The Augeas lens to use commands ...
[ "Execute", "Augeas", "commands" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L127-L261
train
saltstack/salt
salt/modules/augeas_cfg.py
get
def get(path, value='', load_path=None): ''' Get a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.get /files/etc/hosts/1/ ipaddr path The path to get the value of value The optional value to get .. versionadded:: 2016.3.0 ...
python
def get(path, value='', load_path=None): ''' Get a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.get /files/etc/hosts/1/ ipaddr path The path to get the value of value The optional value to get .. versionadded:: 2016.3.0 ...
[ "def", "get", "(", "path", ",", "value", "=", "''", ",", "load_path", "=", "None", ")", ":", "load_path", "=", "_check_load_paths", "(", "load_path", ")", "aug", "=", "_Augeas", "(", "loadpath", "=", "load_path", ")", "ret", "=", "{", "}", "path", "=...
Get a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.get /files/etc/hosts/1/ ipaddr path The path to get the value of value The optional value to get .. versionadded:: 2016.3.0 load_path A colon-spearated list of director...
[ "Get", "a", "value", "for", "a", "specific", "augeas", "path" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L264-L306
train
saltstack/salt
salt/modules/augeas_cfg.py
setvalue
def setvalue(*args): ''' Set a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.setvalue /files/etc/hosts/1/canonical localhost This will set the first entry in /etc/hosts to localhost CLI Example: .. code-block:: bash salt '*' augeas....
python
def setvalue(*args): ''' Set a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.setvalue /files/etc/hosts/1/canonical localhost This will set the first entry in /etc/hosts to localhost CLI Example: .. code-block:: bash salt '*' augeas....
[ "def", "setvalue", "(", "*", "args", ")", ":", "load_path", "=", "None", "load_paths", "=", "[", "x", "for", "x", "in", "args", "if", "six", ".", "text_type", "(", "x", ")", ".", "startswith", "(", "'load_path='", ")", "]", "if", "load_paths", ":", ...
Set a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.setvalue /files/etc/hosts/1/canonical localhost This will set the first entry in /etc/hosts to localhost CLI Example: .. code-block:: bash salt '*' augeas.setvalue /files/etc/hosts/01/ipad...
[ "Set", "a", "value", "for", "a", "specific", "augeas", "path" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L309-L391
train
saltstack/salt
salt/modules/augeas_cfg.py
match
def match(path, value='', load_path=None): ''' Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.match /files/etc/services/service-name ssh path The path to match value The value to match on .. versionadded:: 2016.3.0 load_pa...
python
def match(path, value='', load_path=None): ''' Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.match /files/etc/services/service-name ssh path The path to match value The value to match on .. versionadded:: 2016.3.0 load_pa...
[ "def", "match", "(", "path", ",", "value", "=", "''", ",", "load_path", "=", "None", ")", ":", "load_path", "=", "_check_load_paths", "(", "load_path", ")", "aug", "=", "_Augeas", "(", "loadpath", "=", "load_path", ")", "ret", "=", "{", "}", "try", "...
Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.match /files/etc/services/service-name ssh path The path to match value The value to match on .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories that m...
[ "Get", "matches", "for", "path", "expression" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L394-L432
train
saltstack/salt
salt/modules/augeas_cfg.py
remove
def remove(path, load_path=None): ''' Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.remove \\ /files/etc/sysctl.conf/net.ipv4.conf.all.log_martians path The path to remove .. versionadded:: 2016.3.0 load_path A colon-s...
python
def remove(path, load_path=None): ''' Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.remove \\ /files/etc/sysctl.conf/net.ipv4.conf.all.log_martians path The path to remove .. versionadded:: 2016.3.0 load_path A colon-s...
[ "def", "remove", "(", "path", ",", "load_path", "=", "None", ")", ":", "load_path", "=", "_check_load_paths", "(", "load_path", ")", "aug", "=", "_Augeas", "(", "loadpath", "=", "load_path", ")", "ret", "=", "{", "'retval'", ":", "False", "}", "try", "...
Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.remove \\ /files/etc/sysctl.conf/net.ipv4.conf.all.log_martians path The path to remove .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories that modules shou...
[ "Get", "matches", "for", "path", "expression" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L435-L472
train
saltstack/salt
salt/modules/augeas_cfg.py
ls
def ls(path, load_path=None): # pylint: disable=C0103 ''' List the direct children of a node CLI Example: .. code-block:: bash salt '*' augeas.ls /files/etc/passwd path The path to list .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories ...
python
def ls(path, load_path=None): # pylint: disable=C0103 ''' List the direct children of a node CLI Example: .. code-block:: bash salt '*' augeas.ls /files/etc/passwd path The path to list .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories ...
[ "def", "ls", "(", "path", ",", "load_path", "=", "None", ")", ":", "# pylint: disable=C0103", "def", "_match", "(", "path", ")", ":", "''' Internal match function '''", "try", ":", "matches", "=", "aug", ".", "match", "(", "salt", ".", "utils", ".", "strin...
List the direct children of a node CLI Example: .. code-block:: bash salt '*' augeas.ls /files/etc/passwd path The path to list .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories that modules should be searched in. This is in addition to ...
[ "List", "the", "direct", "children", "of", "a", "node" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L475-L523
train
saltstack/salt
salt/modules/augeas_cfg.py
tree
def tree(path, load_path=None): ''' Returns recursively the complete tree of a node CLI Example: .. code-block:: bash salt '*' augeas.tree /files/etc/ path The base of the recursive listing .. versionadded:: 2016.3.0 load_path A colon-spearated list of directori...
python
def tree(path, load_path=None): ''' Returns recursively the complete tree of a node CLI Example: .. code-block:: bash salt '*' augeas.tree /files/etc/ path The base of the recursive listing .. versionadded:: 2016.3.0 load_path A colon-spearated list of directori...
[ "def", "tree", "(", "path", ",", "load_path", "=", "None", ")", ":", "load_path", "=", "_check_load_paths", "(", "load_path", ")", "aug", "=", "_Augeas", "(", "loadpath", "=", "load_path", ")", "path", "=", "path", ".", "rstrip", "(", "'/'", ")", "+", ...
Returns recursively the complete tree of a node CLI Example: .. code-block:: bash salt '*' augeas.tree /files/etc/ path The base of the recursive listing .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories that modules should be searched i...
[ "Returns", "recursively", "the", "complete", "tree", "of", "a", "node" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L526-L552
train
saltstack/salt
salt/modules/kernelpkg_linux_apt.py
list_installed
def list_installed(): ''' Return a list of all installed kernels. CLI Example: .. code-block:: bash salt '*' kernelpkg.list_installed ''' pkg_re = re.compile(r'^{0}-[\d.-]+-{1}$'.format( _package_prefix(), _kernel_type())) pkgs = __salt__['pkg.list_pkgs'](versions_as_list=...
python
def list_installed(): ''' Return a list of all installed kernels. CLI Example: .. code-block:: bash salt '*' kernelpkg.list_installed ''' pkg_re = re.compile(r'^{0}-[\d.-]+-{1}$'.format( _package_prefix(), _kernel_type())) pkgs = __salt__['pkg.list_pkgs'](versions_as_list=...
[ "def", "list_installed", "(", ")", ":", "pkg_re", "=", "re", ".", "compile", "(", "r'^{0}-[\\d.-]+-{1}$'", ".", "format", "(", "_package_prefix", "(", ")", ",", "_kernel_type", "(", ")", ")", ")", "pkgs", "=", "__salt__", "[", "'pkg.list_pkgs'", "]", "(", ...
Return a list of all installed kernels. CLI Example: .. code-block:: bash salt '*' kernelpkg.list_installed
[ "Return", "a", "list", "of", "all", "installed", "kernels", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_apt.py#L58-L83
train
saltstack/salt
salt/modules/kernelpkg_linux_apt.py
upgrade
def upgrade(reboot=False, at_time=None): ''' Upgrade the kernel and optionally reboot the system. reboot : False Request a reboot if a new kernel is available. at_time : immediate Schedule the reboot at some point in the future. This argument is ignored if ``reboot=False``. See...
python
def upgrade(reboot=False, at_time=None): ''' Upgrade the kernel and optionally reboot the system. reboot : False Request a reboot if a new kernel is available. at_time : immediate Schedule the reboot at some point in the future. This argument is ignored if ``reboot=False``. See...
[ "def", "upgrade", "(", "reboot", "=", "False", ",", "at_time", "=", "None", ")", ":", "result", "=", "__salt__", "[", "'pkg.install'", "]", "(", "name", "=", "'{0}-{1}'", ".", "format", "(", "_package_prefix", "(", ")", ",", "latest_available", "(", ")",...
Upgrade the kernel and optionally reboot the system. reboot : False Request a reboot if a new kernel is available. at_time : immediate Schedule the reboot at some point in the future. This argument is ignored if ``reboot=False``. See :py:func:`~salt.modules.system.reboot` for m...
[ "Upgrade", "the", "kernel", "and", "optionally", "reboot", "the", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_apt.py#L144-L185
train
saltstack/salt
salt/modules/kernelpkg_linux_apt.py
remove
def remove(release): ''' Remove a specific version of the kernel. release The release number of an installed kernel. This must be the entire release number as returned by :py:func:`~salt.modules.kernelpkg_linux_apt.list_installed`, not the package name. CLI Example: .. cod...
python
def remove(release): ''' Remove a specific version of the kernel. release The release number of an installed kernel. This must be the entire release number as returned by :py:func:`~salt.modules.kernelpkg_linux_apt.list_installed`, not the package name. CLI Example: .. cod...
[ "def", "remove", "(", "release", ")", ":", "if", "release", "not", "in", "list_installed", "(", ")", ":", "raise", "CommandExecutionError", "(", "'Kernel release \\'{0}\\' is not installed'", ".", "format", "(", "release", ")", ")", "if", "release", "==", "activ...
Remove a specific version of the kernel. release The release number of an installed kernel. This must be the entire release number as returned by :py:func:`~salt.modules.kernelpkg_linux_apt.list_installed`, not the package name. CLI Example: .. code-block:: bash salt '*' ...
[ "Remove", "a", "specific", "version", "of", "the", "kernel", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_apt.py#L202-L228
train
saltstack/salt
salt/modules/kernelpkg_linux_apt.py
cleanup
def cleanup(keep_latest=True): ''' Remove all unused kernel packages from the system. keep_latest : True In the event that the active kernel is not the latest one installed, setting this to True will retain the latest kernel package, in addition to the active one. If False, all kernel ...
python
def cleanup(keep_latest=True): ''' Remove all unused kernel packages from the system. keep_latest : True In the event that the active kernel is not the latest one installed, setting this to True will retain the latest kernel package, in addition to the active one. If False, all kernel ...
[ "def", "cleanup", "(", "keep_latest", "=", "True", ")", ":", "removed", "=", "[", "]", "# Loop over all installed kernel packages", "for", "kernel", "in", "list_installed", "(", ")", ":", "# Keep the active kernel package", "if", "kernel", "==", "active", "(", ")"...
Remove all unused kernel packages from the system. keep_latest : True In the event that the active kernel is not the latest one installed, setting this to True will retain the latest kernel package, in addition to the active one. If False, all kernel packages other than the active one will ...
[ "Remove", "all", "unused", "kernel", "packages", "from", "the", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_apt.py#L231-L262
train
saltstack/salt
salt/modules/kernelpkg_linux_apt.py
_cmp_version
def _cmp_version(item1, item2): ''' Compare function for package version sorting ''' vers1 = _LooseVersion(item1) vers2 = _LooseVersion(item2) if vers1 < vers2: return -1 if vers1 > vers2: return 1 return 0
python
def _cmp_version(item1, item2): ''' Compare function for package version sorting ''' vers1 = _LooseVersion(item1) vers2 = _LooseVersion(item2) if vers1 < vers2: return -1 if vers1 > vers2: return 1 return 0
[ "def", "_cmp_version", "(", "item1", ",", "item2", ")", ":", "vers1", "=", "_LooseVersion", "(", "item1", ")", "vers2", "=", "_LooseVersion", "(", "item2", ")", "if", "vers1", "<", "vers2", ":", "return", "-", "1", "if", "vers1", ">", "vers2", ":", "...
Compare function for package version sorting
[ "Compare", "function", "for", "package", "version", "sorting" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_apt.py#L279-L290
train
saltstack/salt
salt/states/redismod.py
string
def string(name, value, expire=None, expireat=None, **connection_args): ''' Ensure that the key exists in redis with the value specified name Redis key to manage value Data to persist in key expire Sets time to live for key in seconds expireat Sets expiration ...
python
def string(name, value, expire=None, expireat=None, **connection_args): ''' Ensure that the key exists in redis with the value specified name Redis key to manage value Data to persist in key expire Sets time to live for key in seconds expireat Sets expiration ...
[ "def", "string", "(", "name", ",", "value", ",", "expire", "=", "None", ",", "expireat", "=", "None", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True",...
Ensure that the key exists in redis with the value specified name Redis key to manage value Data to persist in key expire Sets time to live for key in seconds expireat Sets expiration time for key via UNIX timestamp, overrides `expire`
[ "Ensure", "that", "the", "key", "exists", "in", "redis", "with", "the", "value", "specified" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/redismod.py#L46-L81
train
saltstack/salt
salt/states/redismod.py
absent
def absent(name, keys=None, **connection_args): ''' Ensure key absent from redis name Key to ensure absent from redis keys list of keys to ensure absent, name will be ignored if this is used ''' ret = {'name': name, 'changes': {}, 'result': True, ...
python
def absent(name, keys=None, **connection_args): ''' Ensure key absent from redis name Key to ensure absent from redis keys list of keys to ensure absent, name will be ignored if this is used ''' ret = {'name': name, 'changes': {}, 'result': True, ...
[ "def", "absent", "(", "name", ",", "keys", "=", "None", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "'Key(s) specified already...
Ensure key absent from redis name Key to ensure absent from redis keys list of keys to ensure absent, name will be ignored if this is used
[ "Ensure", "key", "absent", "from", "redis" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/redismod.py#L84-L117
train
saltstack/salt
salt/states/redismod.py
slaveof
def slaveof(name, sentinel_host=None, sentinel_port=None, sentinel_password=None, **connection_args): ''' Set this redis instance as a slave. .. versionadded: 2016.3.0 name Master to make this a slave of sentinel_host Ip of the sentinel to check for the master sentinel_port ...
python
def slaveof(name, sentinel_host=None, sentinel_port=None, sentinel_password=None, **connection_args): ''' Set this redis instance as a slave. .. versionadded: 2016.3.0 name Master to make this a slave of sentinel_host Ip of the sentinel to check for the master sentinel_port ...
[ "def", "slaveof", "(", "name", ",", "sentinel_host", "=", "None", ",", "sentinel_port", "=", "None", ",", "sentinel_password", "=", "None", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", ...
Set this redis instance as a slave. .. versionadded: 2016.3.0 name Master to make this a slave of sentinel_host Ip of the sentinel to check for the master sentinel_port Port of the sentinel to check for the master
[ "Set", "this", "redis", "instance", "as", "a", "slave", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/redismod.py#L120-L173
train
saltstack/salt
salt/utils/pkg/win.py
__main
def __main(): '''This module can also be run directly for testing Args: detail|list : Provide ``detail`` or version ``list``. system|system+user: System installed and System and User installs. ''' if len(sys.argv) < 3: sys.stderr.write('usage: {0} <detail|list> <syste...
python
def __main(): '''This module can also be run directly for testing Args: detail|list : Provide ``detail`` or version ``list``. system|system+user: System installed and System and User installs. ''' if len(sys.argv) < 3: sys.stderr.write('usage: {0} <detail|list> <syste...
[ "def", "__main", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", "<", "3", ":", "sys", ".", "stderr", ".", "write", "(", "'usage: {0} <detail|list> <system|system+user>\\n'", ".", "format", "(", "sys", ".", "argv", "[", "0", "]", ")", ")", ...
This module can also be run directly for testing Args: detail|list : Provide ``detail`` or version ``list``. system|system+user: System installed and System and User installs.
[ "This", "module", "can", "also", "be", "run", "directly", "for", "testing", "Args", ":", "detail|list", ":", "Provide", "detail", "or", "version", "list", ".", "system|system", "+", "user", ":", "System", "installed", "and", "System", "and", "User", "install...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L1295-L1321
train
saltstack/salt
salt/utils/pkg/win.py
RegSoftwareInfo.__squid_to_guid
def __squid_to_guid(self, squid): ''' Squished GUID (SQUID) to GUID. A SQUID is a Squished/Compressed version of a GUID to use up less space in the registry. Args: squid (str): Squished GUID. Returns: str: the GUID if a valid SQUID provided. ...
python
def __squid_to_guid(self, squid): ''' Squished GUID (SQUID) to GUID. A SQUID is a Squished/Compressed version of a GUID to use up less space in the registry. Args: squid (str): Squished GUID. Returns: str: the GUID if a valid SQUID provided. ...
[ "def", "__squid_to_guid", "(", "self", ",", "squid", ")", ":", "if", "not", "squid", ":", "return", "''", "squid_match", "=", "self", ".", "__squid_pattern", ".", "match", "(", "squid", ")", "guid", "=", "''", "if", "squid_match", "is", "not", "None", ...
Squished GUID (SQUID) to GUID. A SQUID is a Squished/Compressed version of a GUID to use up less space in the registry. Args: squid (str): Squished GUID. Returns: str: the GUID if a valid SQUID provided.
[ "Squished", "GUID", "(", "SQUID", ")", "to", "GUID", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L235-L261
train
saltstack/salt
salt/utils/pkg/win.py
RegSoftwareInfo.__one_equals_true
def __one_equals_true(value): ''' Test for ``1`` as a number or a string and return ``True`` if it is. Args: value: string or number or None. Returns: bool: ``True`` if 1 otherwise ``False``. ''' if isinstance(value, six.integer_types) and value ...
python
def __one_equals_true(value): ''' Test for ``1`` as a number or a string and return ``True`` if it is. Args: value: string or number or None. Returns: bool: ``True`` if 1 otherwise ``False``. ''' if isinstance(value, six.integer_types) and value ...
[ "def", "__one_equals_true", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "integer_types", ")", "and", "value", "==", "1", ":", "return", "True", "elif", "(", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ...
Test for ``1`` as a number or a string and return ``True`` if it is. Args: value: string or number or None. Returns: bool: ``True`` if 1 otherwise ``False``.
[ "Test", "for", "1", "as", "a", "number", "or", "a", "string", "and", "return", "True", "if", "it", "is", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L264-L280
train
saltstack/salt
salt/utils/pkg/win.py
RegSoftwareInfo.__reg_query_value
def __reg_query_value(handle, value_name): ''' Calls RegQueryValueEx If PY2 ensure unicode string and expand REG_EXPAND_SZ before returning Remember to catch not found exceptions when calling. Args: handle (object): open registry handle. value_name (str)...
python
def __reg_query_value(handle, value_name): ''' Calls RegQueryValueEx If PY2 ensure unicode string and expand REG_EXPAND_SZ before returning Remember to catch not found exceptions when calling. Args: handle (object): open registry handle. value_name (str)...
[ "def", "__reg_query_value", "(", "handle", ",", "value_name", ")", ":", "# item_value, item_type = win32api.RegQueryValueEx(self.__reg_uninstall_handle, value_name)", "item_value", ",", "item_type", "=", "win32api", ".", "RegQueryValueEx", "(", "handle", ",", "value_name", ")...
Calls RegQueryValueEx If PY2 ensure unicode string and expand REG_EXPAND_SZ before returning Remember to catch not found exceptions when calling. Args: handle (object): open registry handle. value_name (str): Name of the value you wished returned Returns: ...
[ "Calls", "RegQueryValueEx" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L283-L308
train
saltstack/salt
salt/utils/pkg/win.py
RegSoftwareInfo.install_time
def install_time(self): ''' Return the install time, or provide an estimate of install time. Installers or even self upgrading software must/should update the date held within InstallDate field when they change versions. Some installers do not set ``InstallDate`` at all so we us...
python
def install_time(self): ''' Return the install time, or provide an estimate of install time. Installers or even self upgrading software must/should update the date held within InstallDate field when they change versions. Some installers do not set ``InstallDate`` at all so we us...
[ "def", "install_time", "(", "self", ")", ":", "time1970", "=", "self", ".", "__mod_time1970", "# time of last resort", "try", ":", "# pylint: disable=no-member", "date_string", ",", "item_type", "=", "win32api", ".", "RegQueryValueEx", "(", "self", ".", "__reg_unins...
Return the install time, or provide an estimate of install time. Installers or even self upgrading software must/should update the date held within InstallDate field when they change versions. Some installers do not set ``InstallDate`` at all so we use the last modified time on the regi...
[ "Return", "the", "install", "time", "or", "provide", "an", "estimate", "of", "install", "time", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L311-L341
train
saltstack/salt
salt/utils/pkg/win.py
RegSoftwareInfo.get_install_value
def get_install_value(self, value_name, wanted_type=None): ''' For the uninstall section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match ...
python
def get_install_value(self, value_name, wanted_type=None): ''' For the uninstall section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match ...
[ "def", "get_install_value", "(", "self", ",", "value_name", ",", "wanted_type", "=", "None", ")", ":", "try", ":", "item_value", ",", "item_type", "=", "self", ".", "__reg_query_value", "(", "self", ".", "__reg_uninstall_handle", ",", "value_name", ")", "excep...
For the uninstall section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match None is return. wanted_type support values are ``str`` ``i...
[ "For", "the", "uninstall", "section", "of", "the", "registry", "return", "the", "name", "value", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L343-L368
train
saltstack/salt
salt/utils/pkg/win.py
RegSoftwareInfo.get_product_value
def get_product_value(self, value_name, wanted_type=None): ''' For the product section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match ...
python
def get_product_value(self, value_name, wanted_type=None): ''' For the product section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match ...
[ "def", "get_product_value", "(", "self", ",", "value_name", ",", "wanted_type", "=", "None", ")", ":", "if", "not", "self", ".", "__reg_products_handle", ":", "return", "None", "subkey", ",", "search_value_name", "=", "os", ".", "path", ".", "split", "(", ...
For the product section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match None is return. wanted_type support values are ``str`` ``int...
[ "For", "the", "product", "section", "of", "the", "registry", "return", "the", "name", "value", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L382-L420
train
saltstack/salt
salt/utils/pkg/win.py
RegSoftwareInfo.upgrade_code
def upgrade_code(self): ''' For installers which follow the Microsoft Installer standard, returns the ``Upgrade code``. Returns: value (str): ``Upgrade code`` GUID for installed software. ''' if not self.__squid: # Must have a valid squid for an u...
python
def upgrade_code(self): ''' For installers which follow the Microsoft Installer standard, returns the ``Upgrade code``. Returns: value (str): ``Upgrade code`` GUID for installed software. ''' if not self.__squid: # Must have a valid squid for an u...
[ "def", "upgrade_code", "(", "self", ")", ":", "if", "not", "self", ".", "__squid", ":", "# Must have a valid squid for an upgrade code to exist", "return", "''", "# GUID/SQUID are unique, so it does not matter if they are 32bit or", "# 64bit or user install so all items are cached in...
For installers which follow the Microsoft Installer standard, returns the ``Upgrade code``. Returns: value (str): ``Upgrade code`` GUID for installed software.
[ "For", "installers", "which", "follow", "the", "Microsoft", "Installer", "standard", "returns", "the", "Upgrade", "code", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L423-L484
train
saltstack/salt
salt/utils/pkg/win.py
RegSoftwareInfo.list_patches
def list_patches(self): ''' For installers which follow the Microsoft Installer standard, returns a list of patches applied. Returns: value (list): Long name of the patch. ''' if not self.__squid: # Must have a valid squid for an upgrade code to e...
python
def list_patches(self): ''' For installers which follow the Microsoft Installer standard, returns a list of patches applied. Returns: value (list): Long name of the patch. ''' if not self.__squid: # Must have a valid squid for an upgrade code to e...
[ "def", "list_patches", "(", "self", ")", ":", "if", "not", "self", ".", "__squid", ":", "# Must have a valid squid for an upgrade code to exist", "return", "[", "]", "if", "self", ".", "__patch_list", "is", "None", ":", "# Read in the upgrade codes in this section of th...
For installers which follow the Microsoft Installer standard, returns a list of patches applied. Returns: value (list): Long name of the patch.
[ "For", "installers", "which", "follow", "the", "Microsoft", "Installer", "standard", "returns", "a", "list", "of", "patches", "applied", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L487-L548
train
saltstack/salt
salt/utils/pkg/win.py
RegSoftwareInfo.version_binary
def version_binary(self): ''' Return version number which is stored in binary format. Returns: str: <major 0-255>.<minior 0-255>.<build 0-65535> or None if not found ''' # Under MSI 'Version' is a 'REG_DWORD' which then sets other registry # values like Displ...
python
def version_binary(self): ''' Return version number which is stored in binary format. Returns: str: <major 0-255>.<minior 0-255>.<build 0-65535> or None if not found ''' # Under MSI 'Version' is a 'REG_DWORD' which then sets other registry # values like Displ...
[ "def", "version_binary", "(", "self", ")", ":", "# Under MSI 'Version' is a 'REG_DWORD' which then sets other registry", "# values like DisplayVersion to x.x.x to the same value.", "# However not everyone plays by the rules, so we need to check first.", "# version_binary_data will be None if the r...
Return version number which is stored in binary format. Returns: str: <major 0-255>.<minior 0-255>.<build 0-65535> or None if not found
[ "Return", "version", "number", "which", "is", "stored", "in", "binary", "format", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L601-L643
train
saltstack/salt
salt/utils/pkg/win.py
WinSoftware.pkg_version_list
def pkg_version_list(self, pkg_id): ''' Returns information on a package. Args: pkg_id (str): Package Id of the software/component. Returns: list: List of version numbers installed. ''' pkg_data = self.__reg_software.get(pkg_id, None) if ...
python
def pkg_version_list(self, pkg_id): ''' Returns information on a package. Args: pkg_id (str): Package Id of the software/component. Returns: list: List of version numbers installed. ''' pkg_data = self.__reg_software.get(pkg_id, None) if ...
[ "def", "pkg_version_list", "(", "self", ",", "pkg_id", ")", ":", "pkg_data", "=", "self", ".", "__reg_software", ".", "get", "(", "pkg_id", ",", "None", ")", "if", "not", "pkg_data", ":", "return", "[", "]", "if", "isinstance", "(", "pkg_data", ",", "l...
Returns information on a package. Args: pkg_id (str): Package Id of the software/component. Returns: list: List of version numbers installed.
[ "Returns", "information", "on", "a", "package", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L803-L823
train
saltstack/salt
salt/utils/pkg/win.py
WinSoftware.__sid_to_username
def __sid_to_username(sid): ''' Provided with a valid Windows Security Identifier (SID) and returns a Username Args: sid (str): Security Identifier (SID). Returns: str: Username in the format of username@realm or username@computer. ''' if sid is ...
python
def __sid_to_username(sid): ''' Provided with a valid Windows Security Identifier (SID) and returns a Username Args: sid (str): Security Identifier (SID). Returns: str: Username in the format of username@realm or username@computer. ''' if sid is ...
[ "def", "__sid_to_username", "(", "sid", ")", ":", "if", "sid", "is", "None", "or", "sid", "==", "''", ":", "return", "''", "try", ":", "sid_bin", "=", "win32security", ".", "GetBinarySid", "(", "sid", ")", "# pylint: disable=no-member", "except", "pywintypes...
Provided with a valid Windows Security Identifier (SID) and returns a Username Args: sid (str): Security Identifier (SID). Returns: str: Username in the format of username@realm or username@computer.
[ "Provided", "with", "a", "valid", "Windows", "Security", "Identifier", "(", "SID", ")", "and", "returns", "a", "Username" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L852-L902
train
saltstack/salt
salt/utils/pkg/win.py
WinSoftware.__software_to_pkg_id
def __software_to_pkg_id(self, publisher, name, is_component, is_32bit): ''' Determine the Package ID of a software/component using the software/component ``publisher``, ``name``, whether its a software or a component, and if its 32bit or 64bit archiecture. Args: pub...
python
def __software_to_pkg_id(self, publisher, name, is_component, is_32bit): ''' Determine the Package ID of a software/component using the software/component ``publisher``, ``name``, whether its a software or a component, and if its 32bit or 64bit archiecture. Args: pub...
[ "def", "__software_to_pkg_id", "(", "self", ",", "publisher", ",", "name", ",", "is_component", ",", "is_32bit", ")", ":", "if", "publisher", ":", "# remove , and lowercase as , are used as list separators", "pub_lc", "=", "publisher", ".", "replace", "(", "','", ",...
Determine the Package ID of a software/component using the software/component ``publisher``, ``name``, whether its a software or a component, and if its 32bit or 64bit archiecture. Args: publisher (str): Publisher of the software/component. name (str): Name of the softwa...
[ "Determine", "the", "Package", "ID", "of", "a", "software", "/", "component", "using", "the", "software", "/", "component", "publisher", "name", "whether", "its", "a", "software", "or", "a", "component", "and", "if", "its", "32bit", "or", "64bit", "archiectu...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L904-L950
train
saltstack/salt
salt/utils/pkg/win.py
WinSoftware.__version_capture_slp
def __version_capture_slp(self, pkg_id, version_binary, version_display, display_name): ''' This returns the version and where the version string came from, based on instructions under ``version_capture``, if ``version_capture`` is missing, it defaults to value of display-version. ...
python
def __version_capture_slp(self, pkg_id, version_binary, version_display, display_name): ''' This returns the version and where the version string came from, based on instructions under ``version_capture``, if ``version_capture`` is missing, it defaults to value of display-version. ...
[ "def", "__version_capture_slp", "(", "self", ",", "pkg_id", ",", "version_binary", ",", "version_display", ",", "display_name", ")", ":", "if", "self", ".", "__pkg_obj", "and", "hasattr", "(", "self", ".", "__pkg_obj", ",", "'version_capture'", ")", ":", "vers...
This returns the version and where the version string came from, based on instructions under ``version_capture``, if ``version_capture`` is missing, it defaults to value of display-version. Args: pkg_id (str): Publisher of the software/component. version_binary (str): Na...
[ "This", "returns", "the", "version", "and", "where", "the", "version", "string", "came", "from", "based", "on", "instructions", "under", "version_capture", "if", "version_capture", "is", "missing", "it", "defaults", "to", "value", "of", "display", "-", "version"...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L952-L993
train
saltstack/salt
salt/utils/pkg/win.py
WinSoftware.__collect_software_info
def __collect_software_info(self, sid, key_software, use_32bit): ''' Update data with the next software found ''' reg_soft_info = RegSoftwareInfo(key_software, sid, use_32bit) # Check if the registry entry is a valid. # a) Cannot manage software without at least a displ...
python
def __collect_software_info(self, sid, key_software, use_32bit): ''' Update data with the next software found ''' reg_soft_info = RegSoftwareInfo(key_software, sid, use_32bit) # Check if the registry entry is a valid. # a) Cannot manage software without at least a displ...
[ "def", "__collect_software_info", "(", "self", ",", "sid", ",", "key_software", ",", "use_32bit", ")", ":", "reg_soft_info", "=", "RegSoftwareInfo", "(", "key_software", ",", "sid", ",", "use_32bit", ")", "# Check if the registry entry is a valid.", "# a) Cannot manage ...
Update data with the next software found
[ "Update", "data", "with", "the", "next", "software", "found" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L995-L1209
train
saltstack/salt
salt/utils/pkg/win.py
WinSoftware.__get_software_details
def __get_software_details(self, user_pkgs): ''' This searches the uninstall keys in the registry to find a match in the sub keys, it will return a dict with the display name as the key and the version as the value .. sectionauthor:: Damon Atkins <https://github.com/damon-atkins>...
python
def __get_software_details(self, user_pkgs): ''' This searches the uninstall keys in the registry to find a match in the sub keys, it will return a dict with the display name as the key and the version as the value .. sectionauthor:: Damon Atkins <https://github.com/damon-atkins>...
[ "def", "__get_software_details", "(", "self", ",", "user_pkgs", ")", ":", "# FUNCTION MAIN CODE #", "# Search 64bit, on 64bit platform, on 32bit its ignored.", "if", "platform", ".", "architecture", "(", ")", "[", "0", "]", "==", "'32bit'", ":", "# Handle Python 32bit on ...
This searches the uninstall keys in the registry to find a match in the sub keys, it will return a dict with the display name as the key and the version as the value .. sectionauthor:: Damon Atkins <https://github.com/damon-atkins> .. versionadded:: Carbon
[ "This", "searches", "the", "uninstall", "keys", "in", "the", "registry", "to", "find", "a", "match", "in", "the", "sub", "keys", "it", "will", "return", "a", "dict", "with", "the", "display", "name", "as", "the", "key", "and", "the", "version", "as", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L1211-L1292
train
saltstack/salt
salt/utils/gitfs.py
enforce_types
def enforce_types(key, val): ''' Force params to be strings unless they should remain a different type ''' non_string_params = { 'ssl_verify': bool, 'insecure_auth': bool, 'disable_saltenv_mapping': bool, 'env_whitelist': 'stringlist', 'env_blacklist': 'stringlist...
python
def enforce_types(key, val): ''' Force params to be strings unless they should remain a different type ''' non_string_params = { 'ssl_verify': bool, 'insecure_auth': bool, 'disable_saltenv_mapping': bool, 'env_whitelist': 'stringlist', 'env_blacklist': 'stringlist...
[ "def", "enforce_types", "(", "key", ",", "val", ")", ":", "non_string_params", "=", "{", "'ssl_verify'", ":", "bool", ",", "'insecure_auth'", ":", "bool", ",", "'disable_saltenv_mapping'", ":", "bool", ",", "'env_whitelist'", ":", "'stringlist'", ",", "'env_blac...
Force params to be strings unless they should remain a different type
[ "Force", "params", "to", "be", "strings", "unless", "they", "should", "remain", "a", "different", "type" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L153-L204
train
saltstack/salt
salt/utils/gitfs.py
GitProvider._get_envs_from_ref_paths
def _get_envs_from_ref_paths(self, refs): ''' Return the names of remote refs (stripped of the remote name) and tags which are map to the branches and tags. ''' def _check_ref(env_set, rname): ''' Add the appropriate saltenv(s) to the set ''' ...
python
def _get_envs_from_ref_paths(self, refs): ''' Return the names of remote refs (stripped of the remote name) and tags which are map to the branches and tags. ''' def _check_ref(env_set, rname): ''' Add the appropriate saltenv(s) to the set ''' ...
[ "def", "_get_envs_from_ref_paths", "(", "self", ",", "refs", ")", ":", "def", "_check_ref", "(", "env_set", ",", "rname", ")", ":", "'''\n Add the appropriate saltenv(s) to the set\n '''", "if", "rname", "in", "self", ".", "saltenv_revmap", ":", ...
Return the names of remote refs (stripped of the remote name) and tags which are map to the branches and tags.
[ "Return", "the", "names", "of", "remote", "refs", "(", "stripped", "of", "the", "remote", "name", ")", "and", "tags", "which", "are", "map", "to", "the", "branches", "and", "tags", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L467-L503
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.add_conf_overlay
def add_conf_overlay(cls, name): ''' Programmatically determine config value based on the desired saltenv ''' def _getconf(self, tgt_env='base'): strip_sep = lambda x: x.rstrip(os.sep) \ if name in ('root', 'mountpoint') \ else x if...
python
def add_conf_overlay(cls, name): ''' Programmatically determine config value based on the desired saltenv ''' def _getconf(self, tgt_env='base'): strip_sep = lambda x: x.rstrip(os.sep) \ if name in ('root', 'mountpoint') \ else x if...
[ "def", "add_conf_overlay", "(", "cls", ",", "name", ")", ":", "def", "_getconf", "(", "self", ",", "tgt_env", "=", "'base'", ")", ":", "strip_sep", "=", "lambda", "x", ":", "x", ".", "rstrip", "(", "os", ".", "sep", ")", "if", "name", "in", "(", ...
Programmatically determine config value based on the desired saltenv
[ "Programmatically", "determine", "config", "value", "based", "on", "the", "desired", "saltenv" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L509-L570
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.check_root
def check_root(self): ''' Check if the relative root path exists in the checked-out copy of the remote. Return the full path to that relative root if it does exist, otherwise return None. ''' # No need to pass an environment to self.root() here since per-saltenv #...
python
def check_root(self): ''' Check if the relative root path exists in the checked-out copy of the remote. Return the full path to that relative root if it does exist, otherwise return None. ''' # No need to pass an environment to self.root() here since per-saltenv #...
[ "def", "check_root", "(", "self", ")", ":", "# No need to pass an environment to self.root() here since per-saltenv", "# configuration is a gitfs-only feature and check_root() is not used", "# for gitfs.", "root_dir", "=", "salt", ".", "utils", ".", "path", ".", "join", "(", "s...
Check if the relative root path exists in the checked-out copy of the remote. Return the full path to that relative root if it does exist, otherwise return None.
[ "Check", "if", "the", "relative", "root", "path", "exists", "in", "the", "checked", "-", "out", "copy", "of", "the", "remote", ".", "Return", "the", "full", "path", "to", "that", "relative", "root", "if", "it", "does", "exist", "otherwise", "return", "No...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L572-L588
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.clean_stale_refs
def clean_stale_refs(self): ''' Remove stale refs so that they are no longer seen as fileserver envs ''' cleaned = [] cmd_str = 'git remote prune origin' # Attempt to force all output to plain ascii english, which is what some parsing code # may expect. #...
python
def clean_stale_refs(self): ''' Remove stale refs so that they are no longer seen as fileserver envs ''' cleaned = [] cmd_str = 'git remote prune origin' # Attempt to force all output to plain ascii english, which is what some parsing code # may expect. #...
[ "def", "clean_stale_refs", "(", "self", ")", ":", "cleaned", "=", "[", "]", "cmd_str", "=", "'git remote prune origin'", "# Attempt to force all output to plain ascii english, which is what some parsing code", "# may expect.", "# According to stackoverflow (http://goo.gl/l74GC8), we ar...
Remove stale refs so that they are no longer seen as fileserver envs
[ "Remove", "stale", "refs", "so", "that", "they", "are", "no", "longer", "seen", "as", "fileserver", "envs" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L590-L631
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.clear_lock
def clear_lock(self, lock_type='update'): ''' Clear update.lk ''' lock_file = self._get_lock_file(lock_type=lock_type) def _add_error(errlist, exc): msg = ('Unable to remove update lock for {0} ({1}): {2} ' .format(self.url, lock_file, exc)) ...
python
def clear_lock(self, lock_type='update'): ''' Clear update.lk ''' lock_file = self._get_lock_file(lock_type=lock_type) def _add_error(errlist, exc): msg = ('Unable to remove update lock for {0} ({1}): {2} ' .format(self.url, lock_file, exc)) ...
[ "def", "clear_lock", "(", "self", ",", "lock_type", "=", "'update'", ")", ":", "lock_file", "=", "self", ".", "_get_lock_file", "(", "lock_type", "=", "lock_type", ")", "def", "_add_error", "(", "errlist", ",", "exc", ")", ":", "msg", "=", "(", "'Unable ...
Clear update.lk
[ "Clear", "update", ".", "lk" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L633-L672
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.enforce_git_config
def enforce_git_config(self): ''' For the config options which need to be maintained in the git config, ensure that the git config file is configured as desired. ''' git_config = os.path.join(self.gitdir, 'config') conf = salt.utils.configparser.GitConfigParser() ...
python
def enforce_git_config(self): ''' For the config options which need to be maintained in the git config, ensure that the git config file is configured as desired. ''' git_config = os.path.join(self.gitdir, 'config') conf = salt.utils.configparser.GitConfigParser() ...
[ "def", "enforce_git_config", "(", "self", ")", ":", "git_config", "=", "os", ".", "path", ".", "join", "(", "self", ".", "gitdir", ",", "'config'", ")", "conf", "=", "salt", ".", "utils", ".", "configparser", ".", "GitConfigParser", "(", ")", "if", "no...
For the config options which need to be maintained in the git config, ensure that the git config file is configured as desired.
[ "For", "the", "config", "options", "which", "need", "to", "be", "maintained", "in", "the", "git", "config", "ensure", "that", "the", "git", "config", "file", "is", "configured", "as", "desired", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L674-L762
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.fetch
def fetch(self): ''' Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. This function requires that a _fetch() function be implemented in a sub-class. ''' try: with self.gen_lock(lock_ty...
python
def fetch(self): ''' Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. This function requires that a _fetch() function be implemented in a sub-class. ''' try: with self.gen_lock(lock_ty...
[ "def", "fetch", "(", "self", ")", ":", "try", ":", "with", "self", ".", "gen_lock", "(", "lock_type", "=", "'update'", ")", ":", "log", ".", "debug", "(", "'Fetching %s remote \\'%s\\''", ",", "self", ".", "role", ",", "self", ".", "id", ")", "# Run pr...
Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. This function requires that a _fetch() function be implemented in a sub-class.
[ "Fetch", "the", "repo", ".", "If", "the", "local", "copy", "was", "updated", "return", "True", ".", "If", "the", "local", "copy", "was", "already", "up", "-", "to", "-", "date", "return", "False", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L764-L791
train
saltstack/salt
salt/utils/gitfs.py
GitProvider._lock
def _lock(self, lock_type='update', failhard=False): ''' Place a lock file if (and only if) it does not already exist. ''' try: fh_ = os.open(self._get_lock_file(lock_type), os.O_CREAT | os.O_EXCL | os.O_WRONLY) with os.fdopen(fh_, 'wb'):...
python
def _lock(self, lock_type='update', failhard=False): ''' Place a lock file if (and only if) it does not already exist. ''' try: fh_ = os.open(self._get_lock_file(lock_type), os.O_CREAT | os.O_EXCL | os.O_WRONLY) with os.fdopen(fh_, 'wb'):...
[ "def", "_lock", "(", "self", ",", "lock_type", "=", "'update'", ",", "failhard", "=", "False", ")", ":", "try", ":", "fh_", "=", "os", ".", "open", "(", "self", ".", "_get_lock_file", "(", "lock_type", ")", ",", "os", ".", "O_CREAT", "|", "os", "."...
Place a lock file if (and only if) it does not already exist.
[ "Place", "a", "lock", "file", "if", "(", "and", "only", "if", ")", "it", "does", "not", "already", "exist", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L793-L872
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.lock
def lock(self): ''' Place an lock file and report on the success/failure. This is an interface to be used by the fileserver runner, so it is hard-coded to perform an update lock. We aren't using the gen_lock() contextmanager here because the lock is meant to stay and not be ...
python
def lock(self): ''' Place an lock file and report on the success/failure. This is an interface to be used by the fileserver runner, so it is hard-coded to perform an update lock. We aren't using the gen_lock() contextmanager here because the lock is meant to stay and not be ...
[ "def", "lock", "(", "self", ")", ":", "success", "=", "[", "]", "failed", "=", "[", "]", "try", ":", "result", "=", "self", ".", "_lock", "(", "lock_type", "=", "'update'", ")", "except", "GitLockError", "as", "exc", ":", "failed", ".", "append", "...
Place an lock file and report on the success/failure. This is an interface to be used by the fileserver runner, so it is hard-coded to perform an update lock. We aren't using the gen_lock() contextmanager here because the lock is meant to stay and not be automatically removed.
[ "Place", "an", "lock", "file", "and", "report", "on", "the", "success", "/", "failure", ".", "This", "is", "an", "interface", "to", "be", "used", "by", "the", "fileserver", "runner", "so", "it", "is", "hard", "-", "coded", "to", "perform", "an", "updat...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L874-L891
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.gen_lock
def gen_lock(self, lock_type='update', timeout=0, poll_interval=0.5): ''' Set and automatically clear a lock ''' if not isinstance(lock_type, six.string_types): raise GitLockError( errno.EINVAL, 'Invalid lock_type \'{0}\''.format(lock_type) ...
python
def gen_lock(self, lock_type='update', timeout=0, poll_interval=0.5): ''' Set and automatically clear a lock ''' if not isinstance(lock_type, six.string_types): raise GitLockError( errno.EINVAL, 'Invalid lock_type \'{0}\''.format(lock_type) ...
[ "def", "gen_lock", "(", "self", ",", "lock_type", "=", "'update'", ",", "timeout", "=", "0", ",", "poll_interval", "=", "0.5", ")", ":", "if", "not", "isinstance", "(", "lock_type", ",", "six", ".", "string_types", ")", ":", "raise", "GitLockError", "(",...
Set and automatically clear a lock
[ "Set", "and", "automatically", "clear", "a", "lock" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L894-L945
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.env_is_exposed
def env_is_exposed(self, tgt_env): ''' Check if an environment is exposed by comparing it against a whitelist and blacklist. ''' return salt.utils.stringutils.check_whitelist_blacklist( tgt_env, whitelist=self.saltenv_whitelist, blacklist=self....
python
def env_is_exposed(self, tgt_env): ''' Check if an environment is exposed by comparing it against a whitelist and blacklist. ''' return salt.utils.stringutils.check_whitelist_blacklist( tgt_env, whitelist=self.saltenv_whitelist, blacklist=self....
[ "def", "env_is_exposed", "(", "self", ",", "tgt_env", ")", ":", "return", "salt", ".", "utils", ".", "stringutils", ".", "check_whitelist_blacklist", "(", "tgt_env", ",", "whitelist", "=", "self", ".", "saltenv_whitelist", ",", "blacklist", "=", "self", ".", ...
Check if an environment is exposed by comparing it against a whitelist and blacklist.
[ "Check", "if", "an", "environment", "is", "exposed", "by", "comparing", "it", "against", "a", "whitelist", "and", "blacklist", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L965-L974
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.get_checkout_target
def get_checkout_target(self): ''' Resolve dynamically-set branch ''' if self.role == 'git_pillar' and self.branch == '__env__': try: return self.all_saltenvs except AttributeError: # all_saltenvs not configured for this remote ...
python
def get_checkout_target(self): ''' Resolve dynamically-set branch ''' if self.role == 'git_pillar' and self.branch == '__env__': try: return self.all_saltenvs except AttributeError: # all_saltenvs not configured for this remote ...
[ "def", "get_checkout_target", "(", "self", ")", ":", "if", "self", ".", "role", "==", "'git_pillar'", "and", "self", ".", "branch", "==", "'__env__'", ":", "try", ":", "return", "self", ".", "all_saltenvs", "except", "AttributeError", ":", "# all_saltenvs not ...
Resolve dynamically-set branch
[ "Resolve", "dynamically", "-", "set", "branch" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1001-L1017
train
saltstack/salt
salt/utils/gitfs.py
GitProvider.get_tree
def get_tree(self, tgt_env): ''' Return a tree object for the specified environment ''' if not self.env_is_exposed(tgt_env): return None tgt_ref = self.ref(tgt_env) if tgt_ref is None: return None for ref_type in self.ref_types: ...
python
def get_tree(self, tgt_env): ''' Return a tree object for the specified environment ''' if not self.env_is_exposed(tgt_env): return None tgt_ref = self.ref(tgt_env) if tgt_ref is None: return None for ref_type in self.ref_types: ...
[ "def", "get_tree", "(", "self", ",", "tgt_env", ")", ":", "if", "not", "self", ".", "env_is_exposed", "(", "tgt_env", ")", ":", "return", "None", "tgt_ref", "=", "self", ".", "ref", "(", "tgt_env", ")", "if", "tgt_ref", "is", "None", ":", "return", "...
Return a tree object for the specified environment
[ "Return", "a", "tree", "object", "for", "the", "specified", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1019-L1045
train