id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,900 | saltstack/salt | salt/modules/cyg.py | install | def install(packages=None,
cyg_arch='x86_64',
mirrors=None):
'''
Install one or several packages.
packages : None
The packages to install
cyg_arch : x86_64
Specify the architecture to install the package under
Current options are x86 and x86_64
CLI ... | python | def install(packages=None,
cyg_arch='x86_64',
mirrors=None):
'''
Install one or several packages.
packages : None
The packages to install
cyg_arch : x86_64
Specify the architecture to install the package under
Current options are x86 and x86_64
CLI ... | [
"def",
"install",
"(",
"packages",
"=",
"None",
",",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"# If we want to install packages",
"if",
"packages",
"is",
"not",
"None",
":",
"args",
".",
"append",
"(",
"'... | Install one or several packages.
packages : None
The packages to install
cyg_arch : x86_64
Specify the architecture to install the package under
Current options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.install dos2unix
salt '*' cyg.in... | [
"Install",
"one",
"or",
"several",
"packages",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L210-L239 |
35,901 | saltstack/salt | salt/modules/cyg.py | uninstall | def uninstall(packages,
cyg_arch='x86_64',
mirrors=None):
'''
Uninstall one or several packages.
packages
The packages to uninstall.
cyg_arch : x86_64
Specify the architecture to remove the package from
Current options are x86 and x86_64
CLI Exa... | python | def uninstall(packages,
cyg_arch='x86_64',
mirrors=None):
'''
Uninstall one or several packages.
packages
The packages to uninstall.
cyg_arch : x86_64
Specify the architecture to remove the package from
Current options are x86 and x86_64
CLI Exa... | [
"def",
"uninstall",
"(",
"packages",
",",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"if",
"packages",
"is",
"not",
"None",
":",
"args",
".",
"append",
"(",
"'--remove-packages {pkgs}'",
".",
"format",
"(",... | Uninstall one or several packages.
packages
The packages to uninstall.
cyg_arch : x86_64
Specify the architecture to remove the package from
Current options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.uninstall dos2unix
salt '*' cyg.unin... | [
"Uninstall",
"one",
"or",
"several",
"packages",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L242-L270 |
35,902 | saltstack/salt | salt/modules/cyg.py | update | def update(cyg_arch='x86_64', mirrors=None):
'''
Update all packages.
cyg_arch : x86_64
Specify the cygwin architecture update
Current options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.update
salt '*' cyg.update dos2unix mirrors="[{'http://... | python | def update(cyg_arch='x86_64', mirrors=None):
'''
Update all packages.
cyg_arch : x86_64
Specify the cygwin architecture update
Current options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.update
salt '*' cyg.update dos2unix mirrors="[{'http://... | [
"def",
"update",
"(",
"cyg_arch",
"=",
"'x86_64'",
",",
"mirrors",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"args",
".",
"append",
"(",
"'--upgrade-also'",
")",
"# Can't update something that isn't installed",
"if",
"not",
"_check_cygwin_installed",
"(",
"c... | Update all packages.
cyg_arch : x86_64
Specify the cygwin architecture update
Current options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.update
salt '*' cyg.update dos2unix mirrors="[{'http://mirror': 'http://url/to/public/key}]" | [
"Update",
"all",
"packages",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L273-L296 |
35,903 | saltstack/salt | salt/modules/cyg.py | list_ | def list_(package='', cyg_arch='x86_64'):
'''
List locally installed packages.
package : ''
package name to check. else all
cyg_arch :
Cygwin architecture to use
Options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.list
'''
pkgs =... | python | def list_(package='', cyg_arch='x86_64'):
'''
List locally installed packages.
package : ''
package name to check. else all
cyg_arch :
Cygwin architecture to use
Options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.list
'''
pkgs =... | [
"def",
"list_",
"(",
"package",
"=",
"''",
",",
"cyg_arch",
"=",
"'x86_64'",
")",
":",
"pkgs",
"=",
"{",
"}",
"args",
"=",
"' '",
".",
"join",
"(",
"[",
"'-c'",
",",
"'-d'",
",",
"package",
"]",
")",
"stdout",
"=",
"_cygcheck",
"(",
"args",
",",
... | List locally installed packages.
package : ''
package name to check. else all
cyg_arch :
Cygwin architecture to use
Options are x86 and x86_64
CLI Example:
.. code-block:: bash
salt '*' cyg.list | [
"List",
"locally",
"installed",
"packages",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cyg.py#L299-L328 |
35,904 | saltstack/salt | salt/roster/cloud.py | extract_ipv4 | def extract_ipv4(roster_order, ipv4):
'''
Extract the preferred IP address from the ipv4 grain
'''
for ip_type in roster_order:
for ip_ in ipv4:
if ':' in ip_:
continue
if not salt.utils.validate.net.ipv4_addr(ip_):
continue
if ... | python | def extract_ipv4(roster_order, ipv4):
'''
Extract the preferred IP address from the ipv4 grain
'''
for ip_type in roster_order:
for ip_ in ipv4:
if ':' in ip_:
continue
if not salt.utils.validate.net.ipv4_addr(ip_):
continue
if ... | [
"def",
"extract_ipv4",
"(",
"roster_order",
",",
"ipv4",
")",
":",
"for",
"ip_type",
"in",
"roster_order",
":",
"for",
"ip_",
"in",
"ipv4",
":",
"if",
"':'",
"in",
"ip_",
":",
"continue",
"if",
"not",
"salt",
".",
"utils",
".",
"validate",
".",
"net",
... | Extract the preferred IP address from the ipv4 grain | [
"Extract",
"the",
"preferred",
"IP",
"address",
"from",
"the",
"ipv4",
"grain"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/cloud.py#L97-L113 |
35,905 | saltstack/salt | salt/utils/reactor.py | Reactor.render_reaction | def render_reaction(self, glob_ref, tag, data):
'''
Execute the render system against a single reaction file and return
the data structure
'''
react = {}
if glob_ref.startswith('salt://'):
glob_ref = self.minion.functions['cp.cache_file'](glob_ref) or ''
... | python | def render_reaction(self, glob_ref, tag, data):
'''
Execute the render system against a single reaction file and return
the data structure
'''
react = {}
if glob_ref.startswith('salt://'):
glob_ref = self.minion.functions['cp.cache_file'](glob_ref) or ''
... | [
"def",
"render_reaction",
"(",
"self",
",",
"glob_ref",
",",
"tag",
",",
"data",
")",
":",
"react",
"=",
"{",
"}",
"if",
"glob_ref",
".",
"startswith",
"(",
"'salt://'",
")",
":",
"glob_ref",
"=",
"self",
".",
"minion",
".",
"functions",
"[",
"'cp.cach... | Execute the render system against a single reaction file and return
the data structure | [
"Execute",
"the",
"render",
"system",
"against",
"a",
"single",
"reaction",
"file",
"and",
"return",
"the",
"data",
"structure"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/reactor.py#L100-L127 |
35,906 | saltstack/salt | salt/utils/reactor.py | Reactor.list_reactors | def list_reactors(self, tag):
'''
Take in the tag from an event and return a list of the reactors to
process
'''
log.debug('Gathering reactors for tag %s', tag)
reactors = []
if isinstance(self.opts['reactor'], six.string_types):
try:
w... | python | def list_reactors(self, tag):
'''
Take in the tag from an event and return a list of the reactors to
process
'''
log.debug('Gathering reactors for tag %s', tag)
reactors = []
if isinstance(self.opts['reactor'], six.string_types):
try:
w... | [
"def",
"list_reactors",
"(",
"self",
",",
"tag",
")",
":",
"log",
".",
"debug",
"(",
"'Gathering reactors for tag %s'",
",",
"tag",
")",
"reactors",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"self",
".",
"opts",
"[",
"'reactor'",
"]",
",",
"six",
".",
"s... | Take in the tag from an event and return a list of the reactors to
process | [
"Take",
"in",
"the",
"tag",
"from",
"an",
"event",
"and",
"return",
"a",
"list",
"of",
"the",
"reactors",
"to",
"process"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/reactor.py#L129-L158 |
35,907 | saltstack/salt | salt/utils/reactor.py | Reactor.list_all | def list_all(self):
'''
Return a list of the reactors
'''
if isinstance(self.minion.opts['reactor'], six.string_types):
log.debug('Reading reactors from yaml %s', self.opts['reactor'])
try:
with salt.utils.files.fopen(self.opts['reactor']) as fp_:
... | python | def list_all(self):
'''
Return a list of the reactors
'''
if isinstance(self.minion.opts['reactor'], six.string_types):
log.debug('Reading reactors from yaml %s', self.opts['reactor'])
try:
with salt.utils.files.fopen(self.opts['reactor']) as fp_:
... | [
"def",
"list_all",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"minion",
".",
"opts",
"[",
"'reactor'",
"]",
",",
"six",
".",
"string_types",
")",
":",
"log",
".",
"debug",
"(",
"'Reading reactors from yaml %s'",
",",
"self",
".",
"opts"... | Return a list of the reactors | [
"Return",
"a",
"list",
"of",
"the",
"reactors"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/reactor.py#L160-L179 |
35,908 | saltstack/salt | salt/utils/reactor.py | Reactor.add_reactor | def add_reactor(self, tag, reaction):
'''
Add a reactor
'''
reactors = self.list_all()
for reactor in reactors:
_tag = next(six.iterkeys(reactor))
if _tag == tag:
return {'status': False, 'comment': 'Reactor already exists.'}
self.... | python | def add_reactor(self, tag, reaction):
'''
Add a reactor
'''
reactors = self.list_all()
for reactor in reactors:
_tag = next(six.iterkeys(reactor))
if _tag == tag:
return {'status': False, 'comment': 'Reactor already exists.'}
self.... | [
"def",
"add_reactor",
"(",
"self",
",",
"tag",
",",
"reaction",
")",
":",
"reactors",
"=",
"self",
".",
"list_all",
"(",
")",
"for",
"reactor",
"in",
"reactors",
":",
"_tag",
"=",
"next",
"(",
"six",
".",
"iterkeys",
"(",
"reactor",
")",
")",
"if",
... | Add a reactor | [
"Add",
"a",
"reactor"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/reactor.py#L181-L192 |
35,909 | saltstack/salt | salt/utils/reactor.py | Reactor.resolve_aliases | def resolve_aliases(self, chunks):
'''
Preserve backward compatibility by rewriting the 'state' key in the low
chunks if it is using a legacy type.
'''
for idx, _ in enumerate(chunks):
new_state = self.aliases.get(chunks[idx]['state'])
if new_state is not ... | python | def resolve_aliases(self, chunks):
'''
Preserve backward compatibility by rewriting the 'state' key in the low
chunks if it is using a legacy type.
'''
for idx, _ in enumerate(chunks):
new_state = self.aliases.get(chunks[idx]['state'])
if new_state is not ... | [
"def",
"resolve_aliases",
"(",
"self",
",",
"chunks",
")",
":",
"for",
"idx",
",",
"_",
"in",
"enumerate",
"(",
"chunks",
")",
":",
"new_state",
"=",
"self",
".",
"aliases",
".",
"get",
"(",
"chunks",
"[",
"idx",
"]",
"[",
"'state'",
"]",
")",
"if"... | Preserve backward compatibility by rewriting the 'state' key in the low
chunks if it is using a legacy type. | [
"Preserve",
"backward",
"compatibility",
"by",
"rewriting",
"the",
"state",
"key",
"in",
"the",
"low",
"chunks",
"if",
"it",
"is",
"using",
"a",
"legacy",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/reactor.py#L207-L215 |
35,910 | saltstack/salt | salt/utils/reactor.py | Reactor.reactions | def reactions(self, tag, data, reactors):
'''
Render a list of reactor files and returns a reaction struct
'''
log.debug('Compiling reactions for tag %s', tag)
high = {}
chunks = []
try:
for fn_ in reactors:
high.update(self.render_reac... | python | def reactions(self, tag, data, reactors):
'''
Render a list of reactor files and returns a reaction struct
'''
log.debug('Compiling reactions for tag %s', tag)
high = {}
chunks = []
try:
for fn_ in reactors:
high.update(self.render_reac... | [
"def",
"reactions",
"(",
"self",
",",
"tag",
",",
"data",
",",
"reactors",
")",
":",
"log",
".",
"debug",
"(",
"'Compiling reactions for tag %s'",
",",
"tag",
")",
"high",
"=",
"{",
"}",
"chunks",
"=",
"[",
"]",
"try",
":",
"for",
"fn_",
"in",
"react... | Render a list of reactor files and returns a reaction struct | [
"Render",
"a",
"list",
"of",
"reactor",
"files",
"and",
"returns",
"a",
"reaction",
"struct"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/reactor.py#L217-L241 |
35,911 | saltstack/salt | salt/utils/reactor.py | ReactWrap.populate_client_cache | def populate_client_cache(self, low):
'''
Populate the client cache with an instance of the specified type
'''
reaction_type = low['state']
if reaction_type not in self.client_cache:
log.debug('Reactor is populating %s client cache', reaction_type)
if reac... | python | def populate_client_cache(self, low):
'''
Populate the client cache with an instance of the specified type
'''
reaction_type = low['state']
if reaction_type not in self.client_cache:
log.debug('Reactor is populating %s client cache', reaction_type)
if reac... | [
"def",
"populate_client_cache",
"(",
"self",
",",
"low",
")",
":",
"reaction_type",
"=",
"low",
"[",
"'state'",
"]",
"if",
"reaction_type",
"not",
"in",
"self",
".",
"client_cache",
":",
"log",
".",
"debug",
"(",
"'Reactor is populating %s client cache'",
",",
... | Populate the client cache with an instance of the specified type | [
"Populate",
"the",
"client",
"cache",
"with",
"an",
"instance",
"of",
"the",
"specified",
"type"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/reactor.py#L353-L376 |
35,912 | saltstack/salt | salt/utils/reactor.py | ReactWrap.caller | def caller(self, fun, **kwargs):
'''
Wrap LocalCaller to execute remote exec functions locally on the Minion
'''
self.client_cache['caller'].cmd(fun, *kwargs['arg'], **kwargs['kwarg']) | python | def caller(self, fun, **kwargs):
'''
Wrap LocalCaller to execute remote exec functions locally on the Minion
'''
self.client_cache['caller'].cmd(fun, *kwargs['arg'], **kwargs['kwarg']) | [
"def",
"caller",
"(",
"self",
",",
"fun",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"client_cache",
"[",
"'caller'",
"]",
".",
"cmd",
"(",
"fun",
",",
"*",
"kwargs",
"[",
"'arg'",
"]",
",",
"*",
"*",
"kwargs",
"[",
"'kwarg'",
"]",
")"
] | Wrap LocalCaller to execute remote exec functions locally on the Minion | [
"Wrap",
"LocalCaller",
"to",
"execute",
"remote",
"exec",
"functions",
"locally",
"on",
"the",
"Minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/reactor.py#L510-L514 |
35,913 | saltstack/salt | salt/runners/auth.py | mk_token | def mk_token(**load):
r'''
Create an eauth token using provided credentials
Non-root users may specify an expiration date -- if allowed via the
:conf_master:`token_expire_user_override` setting -- by passing an
additional ``token_expire`` param. This overrides the
:conf_master:`token_expire` se... | python | def mk_token(**load):
r'''
Create an eauth token using provided credentials
Non-root users may specify an expiration date -- if allowed via the
:conf_master:`token_expire_user_override` setting -- by passing an
additional ``token_expire`` param. This overrides the
:conf_master:`token_expire` se... | [
"def",
"mk_token",
"(",
"*",
"*",
"load",
")",
":",
"# This will hang if the master daemon is not running.",
"netapi",
"=",
"salt",
".",
"netapi",
".",
"NetapiClient",
"(",
"__opts__",
")",
"if",
"not",
"netapi",
".",
"_is_master_running",
"(",
")",
":",
"raise"... | r'''
Create an eauth token using provided credentials
Non-root users may specify an expiration date -- if allowed via the
:conf_master:`token_expire_user_override` setting -- by passing an
additional ``token_expire`` param. This overrides the
:conf_master:`token_expire` setting of the same name in ... | [
"r",
"Create",
"an",
"eauth",
"token",
"using",
"provided",
"credentials"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/auth.py#L19-L50 |
35,914 | saltstack/salt | salt/runners/auth.py | del_token | def del_token(token):
'''
Delete an eauth token by name
CLI Example:
.. code-block:: shell
salt-run auth.del_token 6556760736e4077daa601baec2b67c24
'''
token_path = os.path.join(__opts__['token_dir'], token)
if os.path.exists(token_path):
return os.remove(token_path) is No... | python | def del_token(token):
'''
Delete an eauth token by name
CLI Example:
.. code-block:: shell
salt-run auth.del_token 6556760736e4077daa601baec2b67c24
'''
token_path = os.path.join(__opts__['token_dir'], token)
if os.path.exists(token_path):
return os.remove(token_path) is No... | [
"def",
"del_token",
"(",
"token",
")",
":",
"token_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'token_dir'",
"]",
",",
"token",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"token_path",
")",
":",
"return",
"os",
".",
"r... | Delete an eauth token by name
CLI Example:
.. code-block:: shell
salt-run auth.del_token 6556760736e4077daa601baec2b67c24 | [
"Delete",
"an",
"eauth",
"token",
"by",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/auth.py#L53-L66 |
35,915 | saltstack/salt | salt/serializers/configparser.py | serialize | def serialize(obj, **options):
'''
Serialize Python data to a configparser formatted string or file.
:param obj: the data structure to serialize
:param options: options given to lower configparser module.
'''
try:
if not isinstance(obj, dict):
raise TypeError("configparser ... | python | def serialize(obj, **options):
'''
Serialize Python data to a configparser formatted string or file.
:param obj: the data structure to serialize
:param options: options given to lower configparser module.
'''
try:
if not isinstance(obj, dict):
raise TypeError("configparser ... | [
"def",
"serialize",
"(",
"obj",
",",
"*",
"*",
"options",
")",
":",
"try",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"\"configparser can only serialize dictionaries, not {0}\"",
".",
"format",
"(",
"type",
... | Serialize Python data to a configparser formatted string or file.
:param obj: the data structure to serialize
:param options: options given to lower configparser module. | [
"Serialize",
"Python",
"data",
"to",
"a",
"configparser",
"formatted",
"string",
"or",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/configparser.py#L60-L85 |
35,916 | saltstack/salt | salt/serializers/configparser.py | _read_dict | def _read_dict(cp, dictionary):
'''
Cribbed from python3's ConfigParser.read_dict function.
'''
for section, keys in dictionary.items():
section = six.text_type(section)
if _is_defaultsect(section):
if six.PY2:
section = configparser.DEFAULTSECT
else:... | python | def _read_dict(cp, dictionary):
'''
Cribbed from python3's ConfigParser.read_dict function.
'''
for section, keys in dictionary.items():
section = six.text_type(section)
if _is_defaultsect(section):
if six.PY2:
section = configparser.DEFAULTSECT
else:... | [
"def",
"_read_dict",
"(",
"cp",
",",
"dictionary",
")",
":",
"for",
"section",
",",
"keys",
"in",
"dictionary",
".",
"items",
"(",
")",
":",
"section",
"=",
"six",
".",
"text_type",
"(",
"section",
")",
"if",
"_is_defaultsect",
"(",
"section",
")",
":"... | Cribbed from python3's ConfigParser.read_dict function. | [
"Cribbed",
"from",
"python3",
"s",
"ConfigParser",
".",
"read_dict",
"function",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/configparser.py#L95-L112 |
35,917 | saltstack/salt | salt/states/pecl.py | removed | def removed(name):
'''
Make sure that a pecl extension is not installed.
name
The pecl extension name to uninstall
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
if name not in __salt__['pecl.list']():
ret['result'] = True
ret['comment'] = 'Pecl e... | python | def removed(name):
'''
Make sure that a pecl extension is not installed.
name
The pecl extension name to uninstall
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
if name not in __salt__['pecl.list']():
ret['result'] = True
ret['comment'] = 'Pecl e... | [
"def",
"removed",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if",
"name",
"not",
"in",
"__salt__",
"[",
"'pecl.list'",
"]",
"(",
... | Make sure that a pecl extension is not installed.
name
The pecl extension name to uninstall | [
"Make",
"sure",
"that",
"a",
"pecl",
"extension",
"is",
"not",
"installed",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pecl.py#L108-L133 |
35,918 | saltstack/salt | salt/states/boto_kms.py | key_present | def key_present(
name,
policy,
description=None,
key_usage=None,
grants=None,
manage_grants=False,
key_rotation=False,
enabled=True,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the KMS key exists. KM... | python | def key_present(
name,
policy,
description=None,
key_usage=None,
grants=None,
manage_grants=False,
key_rotation=False,
enabled=True,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the KMS key exists. KM... | [
"def",
"key_present",
"(",
"name",
",",
"policy",
",",
"description",
"=",
"None",
",",
"key_usage",
"=",
"None",
",",
"grants",
"=",
"None",
",",
"manage_grants",
"=",
"False",
",",
"key_rotation",
"=",
"False",
",",
"enabled",
"=",
"True",
",",
"region... | Ensure the KMS key exists. KMS keys can not be deleted, so this function
must be used to ensure the key is enabled or disabled.
name
Name of the key.
policy
Key usage policy.
description
Description of the key.
key_usage
Specifies the intended use of the key. Can ... | [
"Ensure",
"the",
"KMS",
"key",
"exists",
".",
"KMS",
"keys",
"can",
"not",
"be",
"deleted",
"so",
"this",
"function",
"must",
"be",
"used",
"to",
"ensure",
"the",
"key",
"is",
"enabled",
"or",
"disabled",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_kms.py#L71-L151 |
35,919 | saltstack/salt | salt/roster/__init__.py | get_roster_file | def get_roster_file(options):
'''
Find respective roster file.
:param options:
:return:
'''
template = None
# The __disable_custom_roster is always True if Salt SSH Client comes
# from Salt API. In that case no way to define own 'roster_file', instead
# this file needs to be chosen ... | python | def get_roster_file(options):
'''
Find respective roster file.
:param options:
:return:
'''
template = None
# The __disable_custom_roster is always True if Salt SSH Client comes
# from Salt API. In that case no way to define own 'roster_file', instead
# this file needs to be chosen ... | [
"def",
"get_roster_file",
"(",
"options",
")",
":",
"template",
"=",
"None",
"# The __disable_custom_roster is always True if Salt SSH Client comes",
"# from Salt API. In that case no way to define own 'roster_file', instead",
"# this file needs to be chosen from already validated rosters",
... | Find respective roster file.
:param options:
:return: | [
"Find",
"respective",
"roster",
"file",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/__init__.py#L21-L59 |
35,920 | saltstack/salt | salt/roster/__init__.py | Roster._gen_back | def _gen_back(self):
'''
Return a list of loaded roster backends
'''
back = set()
if self.backends:
for backend in self.backends:
fun = '{0}.targets'.format(backend)
if fun in self.rosters:
back.add(backend)
... | python | def _gen_back(self):
'''
Return a list of loaded roster backends
'''
back = set()
if self.backends:
for backend in self.backends:
fun = '{0}.targets'.format(backend)
if fun in self.rosters:
back.add(backend)
... | [
"def",
"_gen_back",
"(",
"self",
")",
":",
"back",
"=",
"set",
"(",
")",
"if",
"self",
".",
"backends",
":",
"for",
"backend",
"in",
"self",
".",
"backends",
":",
"fun",
"=",
"'{0}.targets'",
".",
"format",
"(",
"backend",
")",
"if",
"fun",
"in",
"... | Return a list of loaded roster backends | [
"Return",
"a",
"list",
"of",
"loaded",
"roster",
"backends"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/__init__.py#L81-L92 |
35,921 | saltstack/salt | salt/utils/args.py | invalid_kwargs | def invalid_kwargs(invalid_kwargs, raise_exc=True):
'''
Raise a SaltInvocationError if invalid_kwargs is non-empty
'''
if invalid_kwargs:
if isinstance(invalid_kwargs, dict):
new_invalid = [
'{0}={1}'.format(x, y)
for x, y in six.iteritems(invalid_kwar... | python | def invalid_kwargs(invalid_kwargs, raise_exc=True):
'''
Raise a SaltInvocationError if invalid_kwargs is non-empty
'''
if invalid_kwargs:
if isinstance(invalid_kwargs, dict):
new_invalid = [
'{0}={1}'.format(x, y)
for x, y in six.iteritems(invalid_kwar... | [
"def",
"invalid_kwargs",
"(",
"invalid_kwargs",
",",
"raise_exc",
"=",
"True",
")",
":",
"if",
"invalid_kwargs",
":",
"if",
"isinstance",
"(",
"invalid_kwargs",
",",
"dict",
")",
":",
"new_invalid",
"=",
"[",
"'{0}={1}'",
".",
"format",
"(",
"x",
",",
"y",... | Raise a SaltInvocationError if invalid_kwargs is non-empty | [
"Raise",
"a",
"SaltInvocationError",
"if",
"invalid_kwargs",
"is",
"non",
"-",
"empty"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L51-L69 |
35,922 | saltstack/salt | salt/utils/args.py | condition_input | def condition_input(args, kwargs):
'''
Return a single arg structure for the publisher to safely use
'''
ret = []
for arg in args:
if (six.PY3 and isinstance(arg, six.integer_types) and salt.utils.jid.is_jid(six.text_type(arg))) or \
(six.PY2 and isinstance(arg, long)): # pylint: di... | python | def condition_input(args, kwargs):
'''
Return a single arg structure for the publisher to safely use
'''
ret = []
for arg in args:
if (six.PY3 and isinstance(arg, six.integer_types) and salt.utils.jid.is_jid(six.text_type(arg))) or \
(six.PY2 and isinstance(arg, long)): # pylint: di... | [
"def",
"condition_input",
"(",
"args",
",",
"kwargs",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"arg",
"in",
"args",
":",
"if",
"(",
"six",
".",
"PY3",
"and",
"isinstance",
"(",
"arg",
",",
"six",
".",
"integer_types",
")",
"and",
"salt",
".",
"utils"... | Return a single arg structure for the publisher to safely use | [
"Return",
"a",
"single",
"arg",
"structure",
"for",
"the",
"publisher",
"to",
"safely",
"use"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L72-L88 |
35,923 | saltstack/salt | salt/utils/args.py | yamlify_arg | def yamlify_arg(arg):
'''
yaml.safe_load the arg
'''
if not isinstance(arg, six.string_types):
return arg
if arg.strip() == '':
# Because YAML loads empty (or all whitespace) strings as None, we
# return the original string
# >>> import yaml
# >>> yaml.load('... | python | def yamlify_arg(arg):
'''
yaml.safe_load the arg
'''
if not isinstance(arg, six.string_types):
return arg
if arg.strip() == '':
# Because YAML loads empty (or all whitespace) strings as None, we
# return the original string
# >>> import yaml
# >>> yaml.load('... | [
"def",
"yamlify_arg",
"(",
"arg",
")",
":",
"if",
"not",
"isinstance",
"(",
"arg",
",",
"six",
".",
"string_types",
")",
":",
"return",
"arg",
"if",
"arg",
".",
"strip",
"(",
")",
"==",
"''",
":",
"# Because YAML loads empty (or all whitespace) strings as None... | yaml.safe_load the arg | [
"yaml",
".",
"safe_load",
"the",
"arg"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L146-L217 |
35,924 | saltstack/salt | salt/utils/args.py | shlex_split | def shlex_split(s, **kwargs):
'''
Only split if variable is a string
'''
if isinstance(s, six.string_types):
# On PY2, shlex.split will fail with unicode types if there are
# non-ascii characters in the string. So, we need to make sure we
# invoke it with a str type, and then dec... | python | def shlex_split(s, **kwargs):
'''
Only split if variable is a string
'''
if isinstance(s, six.string_types):
# On PY2, shlex.split will fail with unicode types if there are
# non-ascii characters in the string. So, we need to make sure we
# invoke it with a str type, and then dec... | [
"def",
"shlex_split",
"(",
"s",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"six",
".",
"string_types",
")",
":",
"# On PY2, shlex.split will fail with unicode types if there are",
"# non-ascii characters in the string. So, we need to make sure we"... | Only split if variable is a string | [
"Only",
"split",
"if",
"variable",
"is",
"a",
"string"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L288-L301 |
35,925 | saltstack/salt | salt/utils/args.py | arg_lookup | def arg_lookup(fun, aspec=None):
'''
Return a dict containing the arguments and default arguments to the
function.
'''
ret = {'kwargs': {}}
if aspec is None:
aspec = get_function_argspec(fun)
if aspec.defaults:
ret['kwargs'] = dict(zip(aspec.args[::-1], aspec.defaults[::-1]))... | python | def arg_lookup(fun, aspec=None):
'''
Return a dict containing the arguments and default arguments to the
function.
'''
ret = {'kwargs': {}}
if aspec is None:
aspec = get_function_argspec(fun)
if aspec.defaults:
ret['kwargs'] = dict(zip(aspec.args[::-1], aspec.defaults[::-1]))... | [
"def",
"arg_lookup",
"(",
"fun",
",",
"aspec",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'kwargs'",
":",
"{",
"}",
"}",
"if",
"aspec",
"is",
"None",
":",
"aspec",
"=",
"get_function_argspec",
"(",
"fun",
")",
"if",
"aspec",
".",
"defaults",
":",
"re... | Return a dict containing the arguments and default arguments to the
function. | [
"Return",
"a",
"dict",
"containing",
"the",
"arguments",
"and",
"default",
"arguments",
"to",
"the",
"function",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L304-L315 |
35,926 | saltstack/salt | salt/utils/args.py | argspec_report | def argspec_report(functions, module=''):
'''
Pass in a functions dict as it is returned from the loader and return the
argspec function signatures
'''
ret = {}
if '*' in module or '.' in module:
for fun in fnmatch.filter(functions, module):
try:
aspec = get_f... | python | def argspec_report(functions, module=''):
'''
Pass in a functions dict as it is returned from the loader and return the
argspec function signatures
'''
ret = {}
if '*' in module or '.' in module:
for fun in fnmatch.filter(functions, module):
try:
aspec = get_f... | [
"def",
"argspec_report",
"(",
"functions",
",",
"module",
"=",
"''",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"'*'",
"in",
"module",
"or",
"'.'",
"in",
"module",
":",
"for",
"fun",
"in",
"fnmatch",
".",
"filter",
"(",
"functions",
",",
"module",
")",
... | Pass in a functions dict as it is returned from the loader and return the
argspec function signatures | [
"Pass",
"in",
"a",
"functions",
"dict",
"as",
"it",
"is",
"returned",
"from",
"the",
"loader",
"and",
"return",
"the",
"argspec",
"function",
"signatures"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L318-L360 |
35,927 | saltstack/salt | salt/utils/args.py | split_input | def split_input(val, mapper=None):
'''
Take an input value and split it into a list, returning the resulting list
'''
if mapper is None:
mapper = lambda x: x
if isinstance(val, list):
return list(map(mapper, val))
try:
return list(map(mapper, [x.strip() for x in val.split... | python | def split_input(val, mapper=None):
'''
Take an input value and split it into a list, returning the resulting list
'''
if mapper is None:
mapper = lambda x: x
if isinstance(val, list):
return list(map(mapper, val))
try:
return list(map(mapper, [x.strip() for x in val.split... | [
"def",
"split_input",
"(",
"val",
",",
"mapper",
"=",
"None",
")",
":",
"if",
"mapper",
"is",
"None",
":",
"mapper",
"=",
"lambda",
"x",
":",
"x",
"if",
"isinstance",
"(",
"val",
",",
"list",
")",
":",
"return",
"list",
"(",
"map",
"(",
"mapper",
... | Take an input value and split it into a list, returning the resulting list | [
"Take",
"an",
"input",
"value",
"and",
"split",
"it",
"into",
"a",
"list",
"returning",
"the",
"resulting",
"list"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L363-L374 |
35,928 | saltstack/salt | salt/utils/args.py | format_call | def format_call(fun,
data,
initial_ret=None,
expected_extra_kws=(),
is_class_method=None):
'''
Build the required arguments and keyword arguments required for the passed
function.
:param fun: The function to get the argspec from
:param... | python | def format_call(fun,
data,
initial_ret=None,
expected_extra_kws=(),
is_class_method=None):
'''
Build the required arguments and keyword arguments required for the passed
function.
:param fun: The function to get the argspec from
:param... | [
"def",
"format_call",
"(",
"fun",
",",
"data",
",",
"initial_ret",
"=",
"None",
",",
"expected_extra_kws",
"=",
"(",
")",
",",
"is_class_method",
"=",
"None",
")",
":",
"ret",
"=",
"initial_ret",
"is",
"not",
"None",
"and",
"initial_ret",
"or",
"{",
"}",... | Build the required arguments and keyword arguments required for the passed
function.
:param fun: The function to get the argspec from
:param data: A dictionary containing the required data to build the
arguments and keyword arguments.
:param initial_ret: The initial return data pre-pop... | [
"Build",
"the",
"required",
"arguments",
"and",
"keyword",
"arguments",
"required",
"for",
"the",
"passed",
"function",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L394-L509 |
35,929 | saltstack/salt | salt/utils/args.py | parse_function | def parse_function(s):
'''
Parse a python-like function call syntax.
For example: module.function(arg, arg, kw=arg, kw=arg)
This function takes care only about the function name and arguments list carying on quoting
and bracketing. It doesn't perform identifiers and other syntax validity check.
... | python | def parse_function(s):
'''
Parse a python-like function call syntax.
For example: module.function(arg, arg, kw=arg, kw=arg)
This function takes care only about the function name and arguments list carying on quoting
and bracketing. It doesn't perform identifiers and other syntax validity check.
... | [
"def",
"parse_function",
"(",
"s",
")",
":",
"sh",
"=",
"shlex",
".",
"shlex",
"(",
"s",
",",
"posix",
"=",
"True",
")",
"sh",
".",
"escapedquotes",
"=",
"'\"\\''",
"word",
"=",
"[",
"]",
"args",
"=",
"[",
"]",
"kwargs",
"=",
"{",
"}",
"brackets"... | Parse a python-like function call syntax.
For example: module.function(arg, arg, kw=arg, kw=arg)
This function takes care only about the function name and arguments list carying on quoting
and bracketing. It doesn't perform identifiers and other syntax validity check.
Returns a tuple of three values:... | [
"Parse",
"a",
"python",
"-",
"like",
"function",
"call",
"syntax",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L512-L568 |
35,930 | saltstack/salt | salt/utils/args.py | prepare_kwargs | def prepare_kwargs(all_kwargs, class_init_kwargs):
'''
Filter out the kwargs used for the init of the class and the kwargs used to
invoke the command required.
all_kwargs
All the kwargs the Execution Function has been invoked.
class_init_kwargs
The kwargs of the ``__init__`` of the... | python | def prepare_kwargs(all_kwargs, class_init_kwargs):
'''
Filter out the kwargs used for the init of the class and the kwargs used to
invoke the command required.
all_kwargs
All the kwargs the Execution Function has been invoked.
class_init_kwargs
The kwargs of the ``__init__`` of the... | [
"def",
"prepare_kwargs",
"(",
"all_kwargs",
",",
"class_init_kwargs",
")",
":",
"fun_kwargs",
"=",
"{",
"}",
"init_kwargs",
"=",
"{",
"}",
"for",
"karg",
",",
"warg",
"in",
"six",
".",
"iteritems",
"(",
"all_kwargs",
")",
":",
"if",
"karg",
"not",
"in",
... | Filter out the kwargs used for the init of the class and the kwargs used to
invoke the command required.
all_kwargs
All the kwargs the Execution Function has been invoked.
class_init_kwargs
The kwargs of the ``__init__`` of the class. | [
"Filter",
"out",
"the",
"kwargs",
"used",
"for",
"the",
"init",
"of",
"the",
"class",
"and",
"the",
"kwargs",
"used",
"to",
"invoke",
"the",
"command",
"required",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/args.py#L571-L591 |
35,931 | saltstack/salt | salt/modules/aixpkg.py | _check_pkg | def _check_pkg(target):
'''
Return name, version and if rpm package for specified target
'''
ret = {}
cmd = ['/usr/bin/lslpp', '-Lc', target]
lines = __salt__['cmd.run'](
cmd,
python_shell=False).splitlines()
name = ''
version_num = ''
rpmpkg = False
for ... | python | def _check_pkg(target):
'''
Return name, version and if rpm package for specified target
'''
ret = {}
cmd = ['/usr/bin/lslpp', '-Lc', target]
lines = __salt__['cmd.run'](
cmd,
python_shell=False).splitlines()
name = ''
version_num = ''
rpmpkg = False
for ... | [
"def",
"_check_pkg",
"(",
"target",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"[",
"'/usr/bin/lslpp'",
",",
"'-Lc'",
",",
"target",
"]",
"lines",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
".",
"spli... | Return name, version and if rpm package for specified target | [
"Return",
"name",
"version",
"and",
"if",
"rpm",
"package",
"for",
"specified",
"target"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aixpkg.py#L42-L75 |
35,932 | saltstack/salt | salt/modules/data.py | clear | def clear():
'''
Clear out all of the data in the minion datastore, this function is
destructive!
CLI Example:
.. code-block:: bash
salt '*' data.clear
'''
try:
os.remove(os.path.join(__opts__['cachedir'], 'datastore'))
except (IOError, OSError):
pass
retur... | python | def clear():
'''
Clear out all of the data in the minion datastore, this function is
destructive!
CLI Example:
.. code-block:: bash
salt '*' data.clear
'''
try:
os.remove(os.path.join(__opts__['cachedir'], 'datastore'))
except (IOError, OSError):
pass
retur... | [
"def",
"clear",
"(",
")",
":",
"try",
":",
"os",
".",
"remove",
"(",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'datastore'",
")",
")",
"except",
"(",
"IOError",
",",
"OSError",
")",
":",
"pass",
"return",
"True"... | Clear out all of the data in the minion datastore, this function is
destructive!
CLI Example:
.. code-block:: bash
salt '*' data.clear | [
"Clear",
"out",
"all",
"of",
"the",
"data",
"in",
"the",
"minion",
"datastore",
"this",
"function",
"is",
"destructive!"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/data.py#L23-L38 |
35,933 | saltstack/salt | salt/modules/data.py | load | def load():
'''
Return all of the data in the minion datastore
CLI Example:
.. code-block:: bash
salt '*' data.load
'''
serial = salt.payload.Serial(__opts__)
try:
datastore_path = os.path.join(__opts__['cachedir'], 'datastore')
with salt.utils.files.fopen(datasto... | python | def load():
'''
Return all of the data in the minion datastore
CLI Example:
.. code-block:: bash
salt '*' data.load
'''
serial = salt.payload.Serial(__opts__)
try:
datastore_path = os.path.join(__opts__['cachedir'], 'datastore')
with salt.utils.files.fopen(datasto... | [
"def",
"load",
"(",
")",
":",
"serial",
"=",
"salt",
".",
"payload",
".",
"Serial",
"(",
"__opts__",
")",
"try",
":",
"datastore_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'datastore'",
")",
"with",
"sa... | Return all of the data in the minion datastore
CLI Example:
.. code-block:: bash
salt '*' data.load | [
"Return",
"all",
"of",
"the",
"data",
"in",
"the",
"minion",
"datastore"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/data.py#L41-L58 |
35,934 | saltstack/salt | salt/modules/data.py | dump | def dump(new_data):
'''
Replace the entire datastore with a passed data structure
CLI Example:
.. code-block:: bash
salt '*' data.dump '{'eggs': 'spam'}'
'''
if not isinstance(new_data, dict):
if isinstance(ast.literal_eval(new_data), dict):
new_data = ast.literal_... | python | def dump(new_data):
'''
Replace the entire datastore with a passed data structure
CLI Example:
.. code-block:: bash
salt '*' data.dump '{'eggs': 'spam'}'
'''
if not isinstance(new_data, dict):
if isinstance(ast.literal_eval(new_data), dict):
new_data = ast.literal_... | [
"def",
"dump",
"(",
"new_data",
")",
":",
"if",
"not",
"isinstance",
"(",
"new_data",
",",
"dict",
")",
":",
"if",
"isinstance",
"(",
"ast",
".",
"literal_eval",
"(",
"new_data",
")",
",",
"dict",
")",
":",
"new_data",
"=",
"ast",
".",
"literal_eval",
... | Replace the entire datastore with a passed data structure
CLI Example:
.. code-block:: bash
salt '*' data.dump '{'eggs': 'spam'}' | [
"Replace",
"the",
"entire",
"datastore",
"with",
"a",
"passed",
"data",
"structure"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/data.py#L61-L86 |
35,935 | saltstack/salt | salt/modules/data.py | update | def update(key, value):
'''
Update a key with a value in the minion datastore
CLI Example:
.. code-block:: bash
salt '*' data.update <key> <value>
'''
store = load()
store[key] = value
dump(store)
return True | python | def update(key, value):
'''
Update a key with a value in the minion datastore
CLI Example:
.. code-block:: bash
salt '*' data.update <key> <value>
'''
store = load()
store[key] = value
dump(store)
return True | [
"def",
"update",
"(",
"key",
",",
"value",
")",
":",
"store",
"=",
"load",
"(",
")",
"store",
"[",
"key",
"]",
"=",
"value",
"dump",
"(",
"store",
")",
"return",
"True"
] | Update a key with a value in the minion datastore
CLI Example:
.. code-block:: bash
salt '*' data.update <key> <value> | [
"Update",
"a",
"key",
"with",
"a",
"value",
"in",
"the",
"minion",
"datastore"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/data.py#L89-L102 |
35,936 | saltstack/salt | salt/modules/data.py | cas | def cas(key, value, old_value):
'''
Check and set a value in the minion datastore
CLI Example:
.. code-block:: bash
salt '*' data.cas <key> <value> <old_value>
'''
store = load()
if key not in store:
return False
if store[key] != old_value:
return False
s... | python | def cas(key, value, old_value):
'''
Check and set a value in the minion datastore
CLI Example:
.. code-block:: bash
salt '*' data.cas <key> <value> <old_value>
'''
store = load()
if key not in store:
return False
if store[key] != old_value:
return False
s... | [
"def",
"cas",
"(",
"key",
",",
"value",
",",
"old_value",
")",
":",
"store",
"=",
"load",
"(",
")",
"if",
"key",
"not",
"in",
"store",
":",
"return",
"False",
"if",
"store",
"[",
"key",
"]",
"!=",
"old_value",
":",
"return",
"False",
"store",
"[",
... | Check and set a value in the minion datastore
CLI Example:
.. code-block:: bash
salt '*' data.cas <key> <value> <old_value> | [
"Check",
"and",
"set",
"a",
"value",
"in",
"the",
"minion",
"datastore"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/data.py#L105-L124 |
35,937 | saltstack/salt | salt/modules/keystoneng.py | get_entity | def get_entity(ent_type, **kwargs):
'''
Attempt to query Keystone for more information about an entity
'''
try:
func = 'keystoneng.{}_get'.format(ent_type)
ent = __salt__[func](**kwargs)
except OpenStackCloudException as e:
# NOTE(SamYaple): If this error was something other ... | python | def get_entity(ent_type, **kwargs):
'''
Attempt to query Keystone for more information about an entity
'''
try:
func = 'keystoneng.{}_get'.format(ent_type)
ent = __salt__[func](**kwargs)
except OpenStackCloudException as e:
# NOTE(SamYaple): If this error was something other ... | [
"def",
"get_entity",
"(",
"ent_type",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"func",
"=",
"'keystoneng.{}_get'",
".",
"format",
"(",
"ent_type",
")",
"ent",
"=",
"__salt__",
"[",
"func",
"]",
"(",
"*",
"*",
"kwargs",
")",
"except",
"OpenStackCl... | Attempt to query Keystone for more information about an entity | [
"Attempt",
"to",
"query",
"Keystone",
"for",
"more",
"information",
"about",
"an",
"entity"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L64-L83 |
35,938 | saltstack/salt | salt/modules/keystoneng.py | _clean_kwargs | def _clean_kwargs(keep_name=False, **kwargs):
'''
Sanatize the the arguments for use with shade
'''
if 'name' in kwargs and not keep_name:
kwargs['name_or_id'] = kwargs.pop('name')
return __utils__['args.clean_kwargs'](**kwargs) | python | def _clean_kwargs(keep_name=False, **kwargs):
'''
Sanatize the the arguments for use with shade
'''
if 'name' in kwargs and not keep_name:
kwargs['name_or_id'] = kwargs.pop('name')
return __utils__['args.clean_kwargs'](**kwargs) | [
"def",
"_clean_kwargs",
"(",
"keep_name",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'name'",
"in",
"kwargs",
"and",
"not",
"keep_name",
":",
"kwargs",
"[",
"'name_or_id'",
"]",
"=",
"kwargs",
".",
"pop",
"(",
"'name'",
")",
"return",
"__u... | Sanatize the the arguments for use with shade | [
"Sanatize",
"the",
"the",
"arguments",
"for",
"use",
"with",
"shade"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L86-L93 |
35,939 | saltstack/salt | salt/modules/keystoneng.py | get_operator_cloud | def get_operator_cloud(auth=None):
'''
Return an operator_cloud
'''
if auth is None:
auth = __salt__['config.option']('keystone', {})
if 'shade_opcloud' in __context__:
if __context__['shade_opcloud'].auth == auth:
return __context__['shade_opcloud']
__context__['shad... | python | def get_operator_cloud(auth=None):
'''
Return an operator_cloud
'''
if auth is None:
auth = __salt__['config.option']('keystone', {})
if 'shade_opcloud' in __context__:
if __context__['shade_opcloud'].auth == auth:
return __context__['shade_opcloud']
__context__['shad... | [
"def",
"get_operator_cloud",
"(",
"auth",
"=",
"None",
")",
":",
"if",
"auth",
"is",
"None",
":",
"auth",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'keystone'",
",",
"{",
"}",
")",
"if",
"'shade_opcloud'",
"in",
"__context__",
":",
"if",
"__con... | Return an operator_cloud | [
"Return",
"an",
"operator_cloud"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L105-L115 |
35,940 | saltstack/salt | salt/modules/keystoneng.py | get_openstack_cloud | def get_openstack_cloud(auth=None):
'''
Return an openstack_cloud
'''
if auth is None:
auth = __salt__['config.option']('keystone', {})
if 'shade_oscloud' in __context__:
if __context__['shade_oscloud'].auth == auth:
return __context__['shade_oscloud']
__context__['sh... | python | def get_openstack_cloud(auth=None):
'''
Return an openstack_cloud
'''
if auth is None:
auth = __salt__['config.option']('keystone', {})
if 'shade_oscloud' in __context__:
if __context__['shade_oscloud'].auth == auth:
return __context__['shade_oscloud']
__context__['sh... | [
"def",
"get_openstack_cloud",
"(",
"auth",
"=",
"None",
")",
":",
"if",
"auth",
"is",
"None",
":",
"auth",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"'keystone'",
",",
"{",
"}",
")",
"if",
"'shade_oscloud'",
"in",
"__context__",
":",
"if",
"__co... | Return an openstack_cloud | [
"Return",
"an",
"openstack_cloud"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L118-L128 |
35,941 | saltstack/salt | salt/modules/keystoneng.py | group_delete | def group_delete(auth=None, **kwargs):
'''
Delete a group
CLI Example:
.. code-block:: bash
salt '*' keystoneng.group_delete name=group1
salt '*' keystoneng.group_delete name=group2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.group_delete name=0e4febc2a5ab4f... | python | def group_delete(auth=None, **kwargs):
'''
Delete a group
CLI Example:
.. code-block:: bash
salt '*' keystoneng.group_delete name=group1
salt '*' keystoneng.group_delete name=group2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.group_delete name=0e4febc2a5ab4f... | [
"def",
"group_delete",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"delete_group",
"(",
"*",
"*... | Delete a group
CLI Example:
.. code-block:: bash
salt '*' keystoneng.group_delete name=group1
salt '*' keystoneng.group_delete name=group2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.group_delete name=0e4febc2a5ab4f2c8f374b054162506d | [
"Delete",
"a",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L147-L161 |
35,942 | saltstack/salt | salt/modules/keystoneng.py | group_update | def group_update(auth=None, **kwargs):
'''
Update a group
CLI Example:
.. code-block:: bash
salt '*' keystoneng.group_update name=group1 description='new description'
salt '*' keystoneng.group_create name=group2 domain_id=b62e76fbeeff4e8fb77073f591cf211e new_name=newgroupname
... | python | def group_update(auth=None, **kwargs):
'''
Update a group
CLI Example:
.. code-block:: bash
salt '*' keystoneng.group_update name=group1 description='new description'
salt '*' keystoneng.group_create name=group2 domain_id=b62e76fbeeff4e8fb77073f591cf211e new_name=newgroupname
... | [
"def",
"group_update",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"if",
"'new_name'",
"in",
"kwargs",
":",
"kwargs",
"... | Update a group
CLI Example:
.. code-block:: bash
salt '*' keystoneng.group_update name=group1 description='new description'
salt '*' keystoneng.group_create name=group2 domain_id=b62e76fbeeff4e8fb77073f591cf211e new_name=newgroupname
salt '*' keystoneng.group_create name=0e4febc2a5ab4... | [
"Update",
"a",
"group"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L164-L180 |
35,943 | saltstack/salt | salt/modules/keystoneng.py | group_search | def group_search(auth=None, **kwargs):
'''
Search for groups
CLI Example:
.. code-block:: bash
salt '*' keystoneng.group_search name=group1
salt '*' keystoneng.group_search domain_id=b62e76fbeeff4e8fb77073f591cf211e
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwar... | python | def group_search(auth=None, **kwargs):
'''
Search for groups
CLI Example:
.. code-block:: bash
salt '*' keystoneng.group_search name=group1
salt '*' keystoneng.group_search domain_id=b62e76fbeeff4e8fb77073f591cf211e
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwar... | [
"def",
"group_search",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"search_groups",
"(",
"*",
"... | Search for groups
CLI Example:
.. code-block:: bash
salt '*' keystoneng.group_search name=group1
salt '*' keystoneng.group_search domain_id=b62e76fbeeff4e8fb77073f591cf211e | [
"Search",
"for",
"groups"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L199-L212 |
35,944 | saltstack/salt | salt/modules/keystoneng.py | project_create | def project_create(auth=None, **kwargs):
'''
Create a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_create name=project1
salt '*' keystoneng.project_create name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_create name=... | python | def project_create(auth=None, **kwargs):
'''
Create a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_create name=project1
salt '*' keystoneng.project_create name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_create name=... | [
"def",
"project_create",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_openstack_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"keep_name",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
... | Create a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_create name=project1
salt '*' keystoneng.project_create name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_create name=project3 enabled=False description='my project3' | [
"Create",
"a",
"project"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L232-L246 |
35,945 | saltstack/salt | salt/modules/keystoneng.py | project_delete | def project_delete(auth=None, **kwargs):
'''
Delete a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_delete name=project1
salt '*' keystoneng.project_delete name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_delete name=... | python | def project_delete(auth=None, **kwargs):
'''
Delete a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_delete name=project1
salt '*' keystoneng.project_delete name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_delete name=... | [
"def",
"project_delete",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_openstack_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"delete_project",
"(",
"*",... | Delete a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_delete name=project1
salt '*' keystoneng.project_delete name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_delete name=f315afcf12f24ad88c92b936c38f2d5a | [
"Delete",
"a",
"project"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L249-L263 |
35,946 | saltstack/salt | salt/modules/keystoneng.py | project_update | def project_update(auth=None, **kwargs):
'''
Update a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_update name=project1 new_name=newproject
salt '*' keystoneng.project_update name=project2 enabled=False description='new description'
'''
cloud = get_ope... | python | def project_update(auth=None, **kwargs):
'''
Update a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_update name=project1 new_name=newproject
salt '*' keystoneng.project_update name=project2 enabled=False description='new description'
'''
cloud = get_ope... | [
"def",
"project_update",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_openstack_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"if",
"'new_name'",
"in",
"kwargs",
":",
"kwargs",
... | Update a project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_update name=project1 new_name=newproject
salt '*' keystoneng.project_update name=project2 enabled=False description='new description' | [
"Update",
"a",
"project"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L266-L281 |
35,947 | saltstack/salt | salt/modules/keystoneng.py | project_get | def project_get(auth=None, **kwargs):
'''
Get a single project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_get name=project1
salt '*' keystoneng.project_get name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_get name=f315afcf... | python | def project_get(auth=None, **kwargs):
'''
Get a single project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_get name=project1
salt '*' keystoneng.project_get name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_get name=f315afcf... | [
"def",
"project_get",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_openstack_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"get_project",
"(",
"*",
"*"... | Get a single project
CLI Example:
.. code-block:: bash
salt '*' keystoneng.project_get name=project1
salt '*' keystoneng.project_get name=project2 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.project_get name=f315afcf12f24ad88c92b936c38f2d5a | [
"Get",
"a",
"single",
"project"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L317-L331 |
35,948 | saltstack/salt | salt/modules/keystoneng.py | domain_create | def domain_create(auth=None, **kwargs):
'''
Create a domain
CLI Example:
.. code-block:: bash
salt '*' keystoneng.domain_create name=domain1
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(keep_name=True, **kwargs)
return cloud.create_domain(**kwargs) | python | def domain_create(auth=None, **kwargs):
'''
Create a domain
CLI Example:
.. code-block:: bash
salt '*' keystoneng.domain_create name=domain1
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(keep_name=True, **kwargs)
return cloud.create_domain(**kwargs) | [
"def",
"domain_create",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"keep_name",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
"... | Create a domain
CLI Example:
.. code-block:: bash
salt '*' keystoneng.domain_create name=domain1 | [
"Create",
"a",
"domain"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L334-L346 |
35,949 | saltstack/salt | salt/modules/keystoneng.py | domain_delete | def domain_delete(auth=None, **kwargs):
'''
Delete a domain
CLI Example:
.. code-block:: bash
salt '*' keystoneng.domain_delete name=domain1
salt '*' keystoneng.domain_delete name=b62e76fbeeff4e8fb77073f591cf211e
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(... | python | def domain_delete(auth=None, **kwargs):
'''
Delete a domain
CLI Example:
.. code-block:: bash
salt '*' keystoneng.domain_delete name=domain1
salt '*' keystoneng.domain_delete name=b62e76fbeeff4e8fb77073f591cf211e
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(... | [
"def",
"domain_delete",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"delete_domain",
"(",
"*",
... | Delete a domain
CLI Example:
.. code-block:: bash
salt '*' keystoneng.domain_delete name=domain1
salt '*' keystoneng.domain_delete name=b62e76fbeeff4e8fb77073f591cf211e | [
"Delete",
"a",
"domain"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L349-L362 |
35,950 | saltstack/salt | salt/modules/keystoneng.py | domain_get | def domain_get(auth=None, **kwargs):
'''
Get a single domain
CLI Example:
.. code-block:: bash
salt '*' keystoneng.domain_get name=domain1
salt '*' keystoneng.domain_get name=b62e76fbeeff4e8fb77073f591cf211e
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwa... | python | def domain_get(auth=None, **kwargs):
'''
Get a single domain
CLI Example:
.. code-block:: bash
salt '*' keystoneng.domain_get name=domain1
salt '*' keystoneng.domain_get name=b62e76fbeeff4e8fb77073f591cf211e
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwa... | [
"def",
"domain_get",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"get_domain",
"(",
"*",
"*",
... | Get a single domain
CLI Example:
.. code-block:: bash
salt '*' keystoneng.domain_get name=domain1
salt '*' keystoneng.domain_get name=b62e76fbeeff4e8fb77073f591cf211e | [
"Get",
"a",
"single",
"domain"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L414-L427 |
35,951 | saltstack/salt | salt/modules/keystoneng.py | role_update | def role_update(auth=None, **kwargs):
'''
Update a role
CLI Example:
.. code-block:: bash
salt '*' keystoneng.role_update name=role1 new_name=newrole
salt '*' keystoneng.role_update name=1eb6edd5525e4ac39af571adee673559 new_name=newrole
'''
cloud = get_operator_cloud(auth)
... | python | def role_update(auth=None, **kwargs):
'''
Update a role
CLI Example:
.. code-block:: bash
salt '*' keystoneng.role_update name=role1 new_name=newrole
salt '*' keystoneng.role_update name=1eb6edd5525e4ac39af571adee673559 new_name=newrole
'''
cloud = get_operator_cloud(auth)
... | [
"def",
"role_update",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"if",
"'new_name'",
"in",
"kwargs",
":",
"kwargs",
"[... | Update a role
CLI Example:
.. code-block:: bash
salt '*' keystoneng.role_update name=role1 new_name=newrole
salt '*' keystoneng.role_update name=1eb6edd5525e4ac39af571adee673559 new_name=newrole | [
"Update",
"a",
"role"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L462-L477 |
35,952 | saltstack/salt | salt/modules/keystoneng.py | role_get | def role_get(auth=None, **kwargs):
'''
Get a single role
CLI Example:
.. code-block:: bash
salt '*' keystoneng.role_get name=role1
salt '*' keystoneng.role_get name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.role_get name=1eb6edd5525e4ac39af571adee673... | python | def role_get(auth=None, **kwargs):
'''
Get a single role
CLI Example:
.. code-block:: bash
salt '*' keystoneng.role_get name=role1
salt '*' keystoneng.role_get name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.role_get name=1eb6edd5525e4ac39af571adee673... | [
"def",
"role_get",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"get_role",
"(",
"*",
"*",
"kw... | Get a single role
CLI Example:
.. code-block:: bash
salt '*' keystoneng.role_get name=role1
salt '*' keystoneng.role_get name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e
salt '*' keystoneng.role_get name=1eb6edd5525e4ac39af571adee673559 | [
"Get",
"a",
"single",
"role"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L513-L527 |
35,953 | saltstack/salt | salt/modules/keystoneng.py | user_update | def user_update(auth=None, **kwargs):
'''
Update a user
CLI Example:
.. code-block:: bash
salt '*' keystoneng.user_update name=user1 enabled=False description='new description'
salt '*' keystoneng.user_update name=user1 new_name=newuser
'''
cloud = get_openstack_cloud(auth)
... | python | def user_update(auth=None, **kwargs):
'''
Update a user
CLI Example:
.. code-block:: bash
salt '*' keystoneng.user_update name=user1 enabled=False description='new description'
salt '*' keystoneng.user_update name=user1 new_name=newuser
'''
cloud = get_openstack_cloud(auth)
... | [
"def",
"user_update",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_openstack_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"if",
"'new_name'",
"in",
"kwargs",
":",
"kwargs",
"... | Update a user
CLI Example:
.. code-block:: bash
salt '*' keystoneng.user_update name=user1 enabled=False description='new description'
salt '*' keystoneng.user_update name=user1 new_name=newuser | [
"Update",
"a",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L564-L579 |
35,954 | saltstack/salt | salt/modules/keystoneng.py | endpoint_create | def endpoint_create(auth=None, **kwargs):
'''
Create an endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_create interface=admin service=glance url=https://example.org:9292
salt '*' keystoneng.endpoint_create interface=public service=glance region=RegionOne url=h... | python | def endpoint_create(auth=None, **kwargs):
'''
Create an endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_create interface=admin service=glance url=https://example.org:9292
salt '*' keystoneng.endpoint_create interface=public service=glance region=RegionOne url=h... | [
"def",
"endpoint_create",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"keep_name",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
... | Create an endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_create interface=admin service=glance url=https://example.org:9292
salt '*' keystoneng.endpoint_create interface=public service=glance region=RegionOne url=https://example.org:9292
salt '*' keystoneng.en... | [
"Create",
"an",
"endpoint"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L631-L645 |
35,955 | saltstack/salt | salt/modules/keystoneng.py | endpoint_delete | def endpoint_delete(auth=None, **kwargs):
'''
Delete an endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_delete id=3bee4bd8c2b040ee966adfda1f0bfca9
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwargs)
return cloud.delete_endpoint(**kwarg... | python | def endpoint_delete(auth=None, **kwargs):
'''
Delete an endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_delete id=3bee4bd8c2b040ee966adfda1f0bfca9
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwargs)
return cloud.delete_endpoint(**kwarg... | [
"def",
"endpoint_delete",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"delete_endpoint",
"(",
"*"... | Delete an endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_delete id=3bee4bd8c2b040ee966adfda1f0bfca9 | [
"Delete",
"an",
"endpoint"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L648-L660 |
35,956 | saltstack/salt | salt/modules/keystoneng.py | endpoint_update | def endpoint_update(auth=None, **kwargs):
'''
Update an endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 interface=public enabled=False
salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6... | python | def endpoint_update(auth=None, **kwargs):
'''
Update an endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 interface=public enabled=False
salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6... | [
"def",
"endpoint_update",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"update_endpoint",
"(",
"*"... | Update an endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 interface=public enabled=False
salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 region=newregion
salt '*' keystoneng.en... | [
"Update",
"an",
"endpoint"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L663-L677 |
35,957 | saltstack/salt | salt/modules/keystoneng.py | endpoint_get | def endpoint_get(auth=None, **kwargs):
'''
Get a single endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_get id=02cffaa173b2460f98e40eda3748dae5
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwargs)
return cloud.get_endpoint(**kwargs) | python | def endpoint_get(auth=None, **kwargs):
'''
Get a single endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_get id=02cffaa173b2460f98e40eda3748dae5
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwargs)
return cloud.get_endpoint(**kwargs) | [
"def",
"endpoint_get",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"get_endpoint",
"(",
"*",
"*... | Get a single endpoint
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_get id=02cffaa173b2460f98e40eda3748dae5 | [
"Get",
"a",
"single",
"endpoint"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L711-L723 |
35,958 | saltstack/salt | salt/modules/keystoneng.py | service_delete | def service_delete(auth=None, **kwargs):
'''
Delete a service
CLI Example:
.. code-block:: bash
salt '*' keystoneng.service_delete name=glance
salt '*' keystoneng.service_delete name=39cc1327cdf744ab815331554430e8ec
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwar... | python | def service_delete(auth=None, **kwargs):
'''
Delete a service
CLI Example:
.. code-block:: bash
salt '*' keystoneng.service_delete name=glance
salt '*' keystoneng.service_delete name=39cc1327cdf744ab815331554430e8ec
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwar... | [
"def",
"service_delete",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"delete_service",
"(",
"*",
... | Delete a service
CLI Example:
.. code-block:: bash
salt '*' keystoneng.service_delete name=glance
salt '*' keystoneng.service_delete name=39cc1327cdf744ab815331554430e8ec | [
"Delete",
"a",
"service"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L742-L755 |
35,959 | saltstack/salt | salt/modules/keystoneng.py | service_update | def service_update(auth=None, **kwargs):
'''
Update a service
CLI Example:
.. code-block:: bash
salt '*' keystoneng.service_update name=cinder type=volumev2
salt '*' keystoneng.service_update name=cinder description='new description'
salt '*' keystoneng.service_update name=ab4... | python | def service_update(auth=None, **kwargs):
'''
Update a service
CLI Example:
.. code-block:: bash
salt '*' keystoneng.service_update name=cinder type=volumev2
salt '*' keystoneng.service_update name=cinder description='new description'
salt '*' keystoneng.service_update name=ab4... | [
"def",
"service_update",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"update_service",
"(",
"*",
... | Update a service
CLI Example:
.. code-block:: bash
salt '*' keystoneng.service_update name=cinder type=volumev2
salt '*' keystoneng.service_update name=cinder description='new description'
salt '*' keystoneng.service_update name=ab4d35e269f147b3ae2d849f77f5c88f enabled=False | [
"Update",
"a",
"service"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L758-L772 |
35,960 | saltstack/salt | salt/modules/keystoneng.py | service_get | def service_get(auth=None, **kwargs):
'''
Get a single service
CLI Example:
.. code-block:: bash
salt '*' keystoneng.service_get name=glance
salt '*' keystoneng.service_get name=75a5804638944b3ab54f7fbfcec2305a
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**... | python | def service_get(auth=None, **kwargs):
'''
Get a single service
CLI Example:
.. code-block:: bash
salt '*' keystoneng.service_get name=glance
salt '*' keystoneng.service_get name=75a5804638944b3ab54f7fbfcec2305a
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**... | [
"def",
"service_get",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"get_service",
"(",
"*",
"*",... | Get a single service
CLI Example:
.. code-block:: bash
salt '*' keystoneng.service_get name=glance
salt '*' keystoneng.service_get name=75a5804638944b3ab54f7fbfcec2305a | [
"Get",
"a",
"single",
"service"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L807-L820 |
35,961 | saltstack/salt | salt/modules/keystoneng.py | role_assignment_list | def role_assignment_list(auth=None, **kwargs):
'''
List role assignments
CLI Example:
.. code-block:: bash
salt '*' keystoneng.role_assignment_list
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwargs)
return cloud.list_role_assignments(**kwargs) | python | def role_assignment_list(auth=None, **kwargs):
'''
List role assignments
CLI Example:
.. code-block:: bash
salt '*' keystoneng.role_assignment_list
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwargs)
return cloud.list_role_assignments(**kwargs) | [
"def",
"role_assignment_list",
"(",
"auth",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cloud",
"=",
"get_operator_cloud",
"(",
"auth",
")",
"kwargs",
"=",
"_clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloud",
".",
"list_role_assignments",
... | List role assignments
CLI Example:
.. code-block:: bash
salt '*' keystoneng.role_assignment_list | [
"List",
"role",
"assignments"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L823-L835 |
35,962 | saltstack/salt | salt/modules/hosts.py | _list_hosts | def _list_hosts():
'''
Return the hosts found in the hosts file in as an OrderedDict
'''
try:
return __context__['hosts._list_hosts']
except KeyError:
count = 0
hfn = __get_hosts_filename()
ret = odict.OrderedDict()
try:
with salt.utils.files.fopen... | python | def _list_hosts():
'''
Return the hosts found in the hosts file in as an OrderedDict
'''
try:
return __context__['hosts._list_hosts']
except KeyError:
count = 0
hfn = __get_hosts_filename()
ret = odict.OrderedDict()
try:
with salt.utils.files.fopen... | [
"def",
"_list_hosts",
"(",
")",
":",
"try",
":",
"return",
"__context__",
"[",
"'hosts._list_hosts'",
"]",
"except",
"KeyError",
":",
"count",
"=",
"0",
"hfn",
"=",
"__get_hosts_filename",
"(",
")",
"ret",
"=",
"odict",
".",
"OrderedDict",
"(",
")",
"try",... | Return the hosts found in the hosts file in as an OrderedDict | [
"Return",
"the",
"hosts",
"found",
"in",
"the",
"hosts",
"file",
"in",
"as",
"an",
"OrderedDict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L48-L80 |
35,963 | saltstack/salt | salt/modules/hosts.py | get_ip | def get_ip(host):
'''
Return the ip associated with the named host
CLI Example:
.. code-block:: bash
salt '*' hosts.get_ip <hostname>
'''
hosts = _list_hosts()
if not hosts:
return ''
# Look for the op
for addr in hosts:
if host in hosts[addr]:
... | python | def get_ip(host):
'''
Return the ip associated with the named host
CLI Example:
.. code-block:: bash
salt '*' hosts.get_ip <hostname>
'''
hosts = _list_hosts()
if not hosts:
return ''
# Look for the op
for addr in hosts:
if host in hosts[addr]:
... | [
"def",
"get_ip",
"(",
"host",
")",
":",
"hosts",
"=",
"_list_hosts",
"(",
")",
"if",
"not",
"hosts",
":",
"return",
"''",
"# Look for the op",
"for",
"addr",
"in",
"hosts",
":",
"if",
"host",
"in",
"hosts",
"[",
"addr",
"]",
":",
"return",
"addr",
"#... | Return the ip associated with the named host
CLI Example:
.. code-block:: bash
salt '*' hosts.get_ip <hostname> | [
"Return",
"the",
"ip",
"associated",
"with",
"the",
"named",
"host"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L99-L117 |
35,964 | saltstack/salt | salt/modules/hosts.py | has_pair | def has_pair(ip, alias):
'''
Return true if the alias is set
CLI Example:
.. code-block:: bash
salt '*' hosts.has_pair <ip> <alias>
'''
hosts = _list_hosts()
try:
return alias in hosts[ip]
except KeyError:
return False | python | def has_pair(ip, alias):
'''
Return true if the alias is set
CLI Example:
.. code-block:: bash
salt '*' hosts.has_pair <ip> <alias>
'''
hosts = _list_hosts()
try:
return alias in hosts[ip]
except KeyError:
return False | [
"def",
"has_pair",
"(",
"ip",
",",
"alias",
")",
":",
"hosts",
"=",
"_list_hosts",
"(",
")",
"try",
":",
"return",
"alias",
"in",
"hosts",
"[",
"ip",
"]",
"except",
"KeyError",
":",
"return",
"False"
] | Return true if the alias is set
CLI Example:
.. code-block:: bash
salt '*' hosts.has_pair <ip> <alias> | [
"Return",
"true",
"if",
"the",
"alias",
"is",
"set"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L140-L154 |
35,965 | saltstack/salt | salt/modules/hosts.py | set_host | def set_host(ip, alias):
'''
Set the host entry in the hosts file for the given ip, this will overwrite
any previous entry for the given ip
.. versionchanged:: 2016.3.0
If ``alias`` does not include any host names (it is the empty
string or contains only whitespace), all entries for the... | python | def set_host(ip, alias):
'''
Set the host entry in the hosts file for the given ip, this will overwrite
any previous entry for the given ip
.. versionchanged:: 2016.3.0
If ``alias`` does not include any host names (it is the empty
string or contains only whitespace), all entries for the... | [
"def",
"set_host",
"(",
"ip",
",",
"alias",
")",
":",
"hfn",
"=",
"_get_or_create_hostfile",
"(",
")",
"ovr",
"=",
"False",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"hfn",
")",
":",
"return",
"False",
"# Make sure future calls to _list_hosts() wil... | Set the host entry in the hosts file for the given ip, this will overwrite
any previous entry for the given ip
.. versionchanged:: 2016.3.0
If ``alias`` does not include any host names (it is the empty
string or contains only whitespace), all entries for the given
IP address are removed... | [
"Set",
"the",
"host",
"entry",
"in",
"the",
"hosts",
"file",
"for",
"the",
"given",
"ip",
"this",
"will",
"overwrite",
"any",
"previous",
"entry",
"for",
"the",
"given",
"ip"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L157-L212 |
35,966 | saltstack/salt | salt/modules/hosts.py | rm_host | def rm_host(ip, alias):
'''
Remove a host entry from the hosts file
CLI Example:
.. code-block:: bash
salt '*' hosts.rm_host <ip> <alias>
'''
if not has_pair(ip, alias):
return True
# Make sure future calls to _list_hosts() will re-read the file
__context__.pop('hosts.... | python | def rm_host(ip, alias):
'''
Remove a host entry from the hosts file
CLI Example:
.. code-block:: bash
salt '*' hosts.rm_host <ip> <alias>
'''
if not has_pair(ip, alias):
return True
# Make sure future calls to _list_hosts() will re-read the file
__context__.pop('hosts.... | [
"def",
"rm_host",
"(",
"ip",
",",
"alias",
")",
":",
"if",
"not",
"has_pair",
"(",
"ip",
",",
"alias",
")",
":",
"return",
"True",
"# Make sure future calls to _list_hosts() will re-read the file",
"__context__",
".",
"pop",
"(",
"'hosts._list_hosts'",
",",
"None"... | Remove a host entry from the hosts file
CLI Example:
.. code-block:: bash
salt '*' hosts.rm_host <ip> <alias> | [
"Remove",
"a",
"host",
"entry",
"from",
"the",
"hosts",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L215-L255 |
35,967 | saltstack/salt | salt/modules/hosts.py | add_host | def add_host(ip, alias):
'''
Add a host to an existing entry, if the entry is not in place then create
it with the given host
CLI Example:
.. code-block:: bash
salt '*' hosts.add_host <ip> <alias>
'''
hfn = _get_or_create_hostfile()
if not os.path.isfile(hfn):
return F... | python | def add_host(ip, alias):
'''
Add a host to an existing entry, if the entry is not in place then create
it with the given host
CLI Example:
.. code-block:: bash
salt '*' hosts.add_host <ip> <alias>
'''
hfn = _get_or_create_hostfile()
if not os.path.isfile(hfn):
return F... | [
"def",
"add_host",
"(",
"ip",
",",
"alias",
")",
":",
"hfn",
"=",
"_get_or_create_hostfile",
"(",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"hfn",
")",
":",
"return",
"False",
"if",
"has_pair",
"(",
"ip",
",",
"alias",
")",
":",
"ret... | Add a host to an existing entry, if the entry is not in place then create
it with the given host
CLI Example:
.. code-block:: bash
salt '*' hosts.add_host <ip> <alias> | [
"Add",
"a",
"host",
"to",
"an",
"existing",
"entry",
"if",
"the",
"entry",
"is",
"not",
"in",
"place",
"then",
"create",
"it",
"with",
"the",
"given",
"host"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L258-L290 |
35,968 | saltstack/salt | salt/proxy/arista_pyeapi.py | init | def init(opts):
'''
Open the connection to the Arista switch over the eAPI.
'''
proxy_dict = opts.get('proxy', {})
conn_args = proxy_dict.copy()
conn_args.pop('proxytype', None)
opts['multiprocessing'] = conn_args.get('multiprocessing', True)
# This is not a SSH-based proxy, so it should... | python | def init(opts):
'''
Open the connection to the Arista switch over the eAPI.
'''
proxy_dict = opts.get('proxy', {})
conn_args = proxy_dict.copy()
conn_args.pop('proxytype', None)
opts['multiprocessing'] = conn_args.get('multiprocessing', True)
# This is not a SSH-based proxy, so it should... | [
"def",
"init",
"(",
"opts",
")",
":",
"proxy_dict",
"=",
"opts",
".",
"get",
"(",
"'proxy'",
",",
"{",
"}",
")",
"conn_args",
"=",
"proxy_dict",
".",
"copy",
"(",
")",
"conn_args",
".",
"pop",
"(",
"'proxytype'",
",",
"None",
")",
"opts",
"[",
"'mu... | Open the connection to the Arista switch over the eAPI. | [
"Open",
"the",
"connection",
"to",
"the",
"Arista",
"switch",
"over",
"the",
"eAPI",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/arista_pyeapi.py#L119-L138 |
35,969 | saltstack/salt | salt/proxy/arista_pyeapi.py | call | def call(method, *args, **kwargs):
'''
Calls an arbitrary pyeapi method.
'''
kwargs = clean_kwargs(**kwargs)
return getattr(pyeapi_device['connection'], method)(*args, **kwargs) | python | def call(method, *args, **kwargs):
'''
Calls an arbitrary pyeapi method.
'''
kwargs = clean_kwargs(**kwargs)
return getattr(pyeapi_device['connection'], method)(*args, **kwargs) | [
"def",
"call",
"(",
"method",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"return",
"getattr",
"(",
"pyeapi_device",
"[",
"'connection'",
"]",
",",
"method",
")",
"(",
"*",
"args",... | Calls an arbitrary pyeapi method. | [
"Calls",
"an",
"arbitrary",
"pyeapi",
"method",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/arista_pyeapi.py#L173-L178 |
35,970 | saltstack/salt | salt/beacons/sh.py | _get_shells | def _get_shells():
'''
Return the valid shells on this system
'''
start = time.time()
if 'sh.last_shells' in __context__:
if start - __context__['sh.last_shells'] > 5:
__context__['sh.last_shells'] = start
else:
__context__['sh.shells'] = __salt__['cmd.shells'... | python | def _get_shells():
'''
Return the valid shells on this system
'''
start = time.time()
if 'sh.last_shells' in __context__:
if start - __context__['sh.last_shells'] > 5:
__context__['sh.last_shells'] = start
else:
__context__['sh.shells'] = __salt__['cmd.shells'... | [
"def",
"_get_shells",
"(",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"if",
"'sh.last_shells'",
"in",
"__context__",
":",
"if",
"start",
"-",
"__context__",
"[",
"'sh.last_shells'",
"]",
">",
"5",
":",
"__context__",
"[",
"'sh.last_shells'",
"]... | Return the valid shells on this system | [
"Return",
"the",
"valid",
"shells",
"on",
"this",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/sh.py#L29-L42 |
35,971 | saltstack/salt | salt/beacons/sh.py | beacon | def beacon(config):
'''
Scan the shell execve routines. This beacon will convert all login shells
.. code-block:: yaml
beacons:
sh: []
'''
ret = []
pkey = 'sh.vt'
shells = _get_shells()
ps_out = __salt__['status.procs']()
track_pids = []
for pid in ps_out:
... | python | def beacon(config):
'''
Scan the shell execve routines. This beacon will convert all login shells
.. code-block:: yaml
beacons:
sh: []
'''
ret = []
pkey = 'sh.vt'
shells = _get_shells()
ps_out = __salt__['status.procs']()
track_pids = []
for pid in ps_out:
... | [
"def",
"beacon",
"(",
"config",
")",
":",
"ret",
"=",
"[",
"]",
"pkey",
"=",
"'sh.vt'",
"shells",
"=",
"_get_shells",
"(",
")",
"ps_out",
"=",
"__salt__",
"[",
"'status.procs'",
"]",
"(",
")",
"track_pids",
"=",
"[",
"]",
"for",
"pid",
"in",
"ps_out"... | Scan the shell execve routines. This beacon will convert all login shells
.. code-block:: yaml
beacons:
sh: [] | [
"Scan",
"the",
"shell",
"execve",
"routines",
".",
"This",
"beacon",
"will",
"convert",
"all",
"login",
"shells"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/sh.py#L55-L110 |
35,972 | saltstack/salt | salt/modules/gcp_addon.py | _get_network | def _get_network(project_id, network_name, service):
'''
Fetch network selfLink from network name.
'''
return service.networks().get(project=project_id,
network=network_name).execute() | python | def _get_network(project_id, network_name, service):
'''
Fetch network selfLink from network name.
'''
return service.networks().get(project=project_id,
network=network_name).execute() | [
"def",
"_get_network",
"(",
"project_id",
",",
"network_name",
",",
"service",
")",
":",
"return",
"service",
".",
"networks",
"(",
")",
".",
"get",
"(",
"project",
"=",
"project_id",
",",
"network",
"=",
"network_name",
")",
".",
"execute",
"(",
")"
] | Fetch network selfLink from network name. | [
"Fetch",
"network",
"selfLink",
"from",
"network",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gcp_addon.py#L49-L54 |
35,973 | saltstack/salt | salt/modules/gcp_addon.py | _get_instance | def _get_instance(project_id, instance_zone, name, service):
'''
Get instance details
'''
return service.instances().get(project=project_id,
zone=instance_zone,
instance=name).execute() | python | def _get_instance(project_id, instance_zone, name, service):
'''
Get instance details
'''
return service.instances().get(project=project_id,
zone=instance_zone,
instance=name).execute() | [
"def",
"_get_instance",
"(",
"project_id",
",",
"instance_zone",
",",
"name",
",",
"service",
")",
":",
"return",
"service",
".",
"instances",
"(",
")",
".",
"get",
"(",
"project",
"=",
"project_id",
",",
"zone",
"=",
"instance_zone",
",",
"instance",
"=",... | Get instance details | [
"Get",
"instance",
"details"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gcp_addon.py#L57-L63 |
35,974 | saltstack/salt | salt/modules/gcp_addon.py | route_create | def route_create(credential_file=None,
project_id=None,
name=None,
dest_range=None,
next_hop_instance=None,
instance_zone=None,
tags=None,
network=None,
priority=None
... | python | def route_create(credential_file=None,
project_id=None,
name=None,
dest_range=None,
next_hop_instance=None,
instance_zone=None,
tags=None,
network=None,
priority=None
... | [
"def",
"route_create",
"(",
"credential_file",
"=",
"None",
",",
"project_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"dest_range",
"=",
"None",
",",
"next_hop_instance",
"=",
"None",
",",
"instance_zone",
"=",
"None",
",",
"tags",
"=",
"None",
",",
... | Create a route to send traffic destined to the Internet through your
gateway instance
credential_file : string
File location of application default credential. For more information,
refer: https://developers.google.com/identity/protocols/application-default-credentials
project_id : string
... | [
"Create",
"a",
"route",
"to",
"send",
"traffic",
"destined",
"to",
"the",
"Internet",
"through",
"your",
"gateway",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gcp_addon.py#L66-L137 |
35,975 | saltstack/salt | salt/utils/dicttrim.py | _trim_dict_in_dict | def _trim_dict_in_dict(data, max_val_size, replace_with):
'''
Takes a dictionary, max_val_size and replace_with
and recursively loops through and replaces any values
that are greater than max_val_size.
'''
for key in data:
if isinstance(data[key], dict):
_trim_dict_in_dict(da... | python | def _trim_dict_in_dict(data, max_val_size, replace_with):
'''
Takes a dictionary, max_val_size and replace_with
and recursively loops through and replaces any values
that are greater than max_val_size.
'''
for key in data:
if isinstance(data[key], dict):
_trim_dict_in_dict(da... | [
"def",
"_trim_dict_in_dict",
"(",
"data",
",",
"max_val_size",
",",
"replace_with",
")",
":",
"for",
"key",
"in",
"data",
":",
"if",
"isinstance",
"(",
"data",
"[",
"key",
"]",
",",
"dict",
")",
":",
"_trim_dict_in_dict",
"(",
"data",
"[",
"key",
"]",
... | Takes a dictionary, max_val_size and replace_with
and recursively loops through and replaces any values
that are greater than max_val_size. | [
"Takes",
"a",
"dictionary",
"max_val_size",
"and",
"replace_with",
"and",
"recursively",
"loops",
"through",
"and",
"replaces",
"any",
"values",
"that",
"are",
"greater",
"than",
"max_val_size",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dicttrim.py#L9-L22 |
35,976 | saltstack/salt | salt/utils/dicttrim.py | trim_dict | def trim_dict(
data,
max_dict_bytes,
percent=50.0,
stepper_size=10,
replace_with='VALUE_TRIMMED',
is_msgpacked=False,
use_bin_type=False):
'''
Takes a dictionary and iterates over its keys, looking for
large values and replacing them with a trimmed str... | python | def trim_dict(
data,
max_dict_bytes,
percent=50.0,
stepper_size=10,
replace_with='VALUE_TRIMMED',
is_msgpacked=False,
use_bin_type=False):
'''
Takes a dictionary and iterates over its keys, looking for
large values and replacing them with a trimmed str... | [
"def",
"trim_dict",
"(",
"data",
",",
"max_dict_bytes",
",",
"percent",
"=",
"50.0",
",",
"stepper_size",
"=",
"10",
",",
"replace_with",
"=",
"'VALUE_TRIMMED'",
",",
"is_msgpacked",
"=",
"False",
",",
"use_bin_type",
"=",
"False",
")",
":",
"serializer",
"=... | Takes a dictionary and iterates over its keys, looking for
large values and replacing them with a trimmed string.
If after the first pass over dictionary keys, the dictionary
is not sufficiently small, the stepper_size will be increased
and the dictionary will be rescanned. This allows for progressive
... | [
"Takes",
"a",
"dictionary",
"and",
"iterates",
"over",
"its",
"keys",
"looking",
"for",
"large",
"values",
"and",
"replacing",
"them",
"with",
"a",
"trimmed",
"string",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dicttrim.py#L25-L116 |
35,977 | saltstack/salt | salt/modules/ldapmod.py | _connect | def _connect(**kwargs):
'''
Instantiate LDAP Connection class and return an LDAP connection object
'''
connargs = {}
for name in ['uri', 'server', 'port', 'tls', 'no_verify', 'binddn',
'bindpw', 'anonymous']:
connargs[name] = _config(name, **kwargs)
return _LDAPConnecti... | python | def _connect(**kwargs):
'''
Instantiate LDAP Connection class and return an LDAP connection object
'''
connargs = {}
for name in ['uri', 'server', 'port', 'tls', 'no_verify', 'binddn',
'bindpw', 'anonymous']:
connargs[name] = _config(name, **kwargs)
return _LDAPConnecti... | [
"def",
"_connect",
"(",
"*",
"*",
"kwargs",
")",
":",
"connargs",
"=",
"{",
"}",
"for",
"name",
"in",
"[",
"'uri'",
",",
"'server'",
",",
"'port'",
",",
"'tls'",
",",
"'no_verify'",
",",
"'binddn'",
",",
"'bindpw'",
",",
"'anonymous'",
"]",
":",
"con... | Instantiate LDAP Connection class and return an LDAP connection object | [
"Instantiate",
"LDAP",
"Connection",
"class",
"and",
"return",
"an",
"LDAP",
"connection",
"object"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldapmod.py#L92-L101 |
35,978 | saltstack/salt | salt/modules/ldapmod.py | search | def search(filter, # pylint: disable=C0103
dn=None, # pylint: disable=C0103
scope=None,
attrs=None,
**kwargs):
'''
Run an arbitrary LDAP query and return the results.
CLI Example:
.. code-block:: bash
salt 'ldaphost' ldap.search "filter=cn=... | python | def search(filter, # pylint: disable=C0103
dn=None, # pylint: disable=C0103
scope=None,
attrs=None,
**kwargs):
'''
Run an arbitrary LDAP query and return the results.
CLI Example:
.. code-block:: bash
salt 'ldaphost' ldap.search "filter=cn=... | [
"def",
"search",
"(",
"filter",
",",
"# pylint: disable=C0103",
"dn",
"=",
"None",
",",
"# pylint: disable=C0103",
"scope",
"=",
"None",
",",
"attrs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"dn",
":",
"dn",
"=",
"_config",
"(",
"'... | Run an arbitrary LDAP query and return the results.
CLI Example:
.. code-block:: bash
salt 'ldaphost' ldap.search "filter=cn=myhost"
Return data:
.. code-block:: python
{'myhost': {'count': 1,
'results': [['cn=myhost,ou=hosts,o=acme,c=gb',
... | [
"Run",
"an",
"arbitrary",
"LDAP",
"query",
"and",
"return",
"the",
"results",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldapmod.py#L104-L163 |
35,979 | saltstack/salt | salt/modules/capirca_acl.py | _translate_port | def _translate_port(port):
'''
Look into services and return the port value using the
service name as lookup value.
'''
services = _get_services_mapping()
if port in services and services[port]['port']:
return services[port]['port'][0]
return port | python | def _translate_port(port):
'''
Look into services and return the port value using the
service name as lookup value.
'''
services = _get_services_mapping()
if port in services and services[port]['port']:
return services[port]['port'][0]
return port | [
"def",
"_translate_port",
"(",
"port",
")",
":",
"services",
"=",
"_get_services_mapping",
"(",
")",
"if",
"port",
"in",
"services",
"and",
"services",
"[",
"port",
"]",
"[",
"'port'",
"]",
":",
"return",
"services",
"[",
"port",
"]",
"[",
"'port'",
"]",... | Look into services and return the port value using the
service name as lookup value. | [
"Look",
"into",
"services",
"and",
"return",
"the",
"port",
"value",
"using",
"the",
"service",
"name",
"as",
"lookup",
"value",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L261-L269 |
35,980 | saltstack/salt | salt/modules/capirca_acl.py | _make_it_list | def _make_it_list(dict_, field_name, value):
'''
Return the object list.
'''
prev_value = []
# firsly we'll collect the prev value
if field_name in dict_:
prev_value = dict_[field_name]
if value is None:
return prev_value
elif isinstance(value, (tuple, list)):
# o... | python | def _make_it_list(dict_, field_name, value):
'''
Return the object list.
'''
prev_value = []
# firsly we'll collect the prev value
if field_name in dict_:
prev_value = dict_[field_name]
if value is None:
return prev_value
elif isinstance(value, (tuple, list)):
# o... | [
"def",
"_make_it_list",
"(",
"dict_",
",",
"field_name",
",",
"value",
")",
":",
"prev_value",
"=",
"[",
"]",
"# firsly we'll collect the prev value",
"if",
"field_name",
"in",
"dict_",
":",
"prev_value",
"=",
"dict_",
"[",
"field_name",
"]",
"if",
"value",
"i... | Return the object list. | [
"Return",
"the",
"object",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L272-L320 |
35,981 | saltstack/salt | salt/modules/capirca_acl.py | _lookup_element | def _lookup_element(lst, key):
'''
Find an dictionary in a list of dictionaries, given its main key.
'''
if not lst:
return {}
for ele in lst:
if not ele or not isinstance(ele, dict):
continue
if ele.keys()[0] == key:
return ele.values()[0]
return ... | python | def _lookup_element(lst, key):
'''
Find an dictionary in a list of dictionaries, given its main key.
'''
if not lst:
return {}
for ele in lst:
if not ele or not isinstance(ele, dict):
continue
if ele.keys()[0] == key:
return ele.values()[0]
return ... | [
"def",
"_lookup_element",
"(",
"lst",
",",
"key",
")",
":",
"if",
"not",
"lst",
":",
"return",
"{",
"}",
"for",
"ele",
"in",
"lst",
":",
"if",
"not",
"ele",
"or",
"not",
"isinstance",
"(",
"ele",
",",
"dict",
")",
":",
"continue",
"if",
"ele",
".... | Find an dictionary in a list of dictionaries, given its main key. | [
"Find",
"an",
"dictionary",
"in",
"a",
"list",
"of",
"dictionaries",
"given",
"its",
"main",
"key",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L393-L404 |
35,982 | saltstack/salt | salt/modules/capirca_acl.py | _get_pillar_cfg | def _get_pillar_cfg(pillar_key,
pillarenv=None,
saltenv=None):
'''
Retrieve the pillar data from the right environment.
'''
pillar_cfg = __salt__['pillar.get'](pillar_key,
pillarenv=pillarenv,
... | python | def _get_pillar_cfg(pillar_key,
pillarenv=None,
saltenv=None):
'''
Retrieve the pillar data from the right environment.
'''
pillar_cfg = __salt__['pillar.get'](pillar_key,
pillarenv=pillarenv,
... | [
"def",
"_get_pillar_cfg",
"(",
"pillar_key",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
")",
":",
"pillar_cfg",
"=",
"__salt__",
"[",
"'pillar.get'",
"]",
"(",
"pillar_key",
",",
"pillarenv",
"=",
"pillarenv",
",",
"saltenv",
"=",
"saltenv",... | Retrieve the pillar data from the right environment. | [
"Retrieve",
"the",
"pillar",
"data",
"from",
"the",
"right",
"environment",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L407-L416 |
35,983 | saltstack/salt | salt/modules/capirca_acl.py | _cleanup | def _cleanup(lst):
'''
Return a list of non-empty dictionaries.
'''
clean = []
for ele in lst:
if ele and isinstance(ele, dict):
clean.append(ele)
return clean | python | def _cleanup(lst):
'''
Return a list of non-empty dictionaries.
'''
clean = []
for ele in lst:
if ele and isinstance(ele, dict):
clean.append(ele)
return clean | [
"def",
"_cleanup",
"(",
"lst",
")",
":",
"clean",
"=",
"[",
"]",
"for",
"ele",
"in",
"lst",
":",
"if",
"ele",
"and",
"isinstance",
"(",
"ele",
",",
"dict",
")",
":",
"clean",
".",
"append",
"(",
"ele",
")",
"return",
"clean"
] | Return a list of non-empty dictionaries. | [
"Return",
"a",
"list",
"of",
"non",
"-",
"empty",
"dictionaries",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L419-L427 |
35,984 | saltstack/salt | salt/modules/capirca_acl.py | _merge_list_of_dict | def _merge_list_of_dict(first, second, prepend=True):
'''
Merge lists of dictionaries.
Each element of the list is a dictionary having one single key.
That key is then used as unique lookup.
The first element list has higher priority than the second.
When there's an overlap between the two lists... | python | def _merge_list_of_dict(first, second, prepend=True):
'''
Merge lists of dictionaries.
Each element of the list is a dictionary having one single key.
That key is then used as unique lookup.
The first element list has higher priority than the second.
When there's an overlap between the two lists... | [
"def",
"_merge_list_of_dict",
"(",
"first",
",",
"second",
",",
"prepend",
"=",
"True",
")",
":",
"first",
"=",
"_cleanup",
"(",
"first",
")",
"second",
"=",
"_cleanup",
"(",
"second",
")",
"if",
"not",
"first",
"and",
"not",
"second",
":",
"return",
"... | Merge lists of dictionaries.
Each element of the list is a dictionary having one single key.
That key is then used as unique lookup.
The first element list has higher priority than the second.
When there's an overlap between the two lists,
it won't change the position, but the content. | [
"Merge",
"lists",
"of",
"dictionaries",
".",
"Each",
"element",
"of",
"the",
"list",
"is",
"a",
"dictionary",
"having",
"one",
"single",
"key",
".",
"That",
"key",
"is",
"then",
"used",
"as",
"unique",
"lookup",
".",
"The",
"first",
"element",
"list",
"h... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L430-L470 |
35,985 | saltstack/salt | salt/modules/capirca_acl.py | _get_term_object | def _get_term_object(filter_name,
term_name,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
**term_fields):
'''
Return an instance of the ``_Term`` class given the te... | python | def _get_term_object(filter_name,
term_name,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
**term_fields):
'''
Return an instance of the ``_Term`` class given the te... | [
"def",
"_get_term_object",
"(",
"filter_name",
",",
"term_name",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
"merge_pillar",
"=",
"True",
",",
"*",
"*",
"term_fields",
")",
":",
"log",
".",
"debug",
"... | Return an instance of the ``_Term`` class given the term options. | [
"Return",
"an",
"instance",
"of",
"the",
"_Term",
"class",
"given",
"the",
"term",
"options",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L473-L511 |
35,986 | saltstack/salt | salt/modules/capirca_acl.py | _get_policy_object | def _get_policy_object(platform,
filters=None,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True):
'''
Return an instance of the ``_Policy`` class given the filters config.
'''
... | python | def _get_policy_object(platform,
filters=None,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True):
'''
Return an instance of the ``_Policy`` class given the filters config.
'''
... | [
"def",
"_get_policy_object",
"(",
"platform",
",",
"filters",
"=",
"None",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
"merge_pillar",
"=",
"True",
")",
":",
"policy",
"=",
"_Policy",
"(",
")",
"polic... | Return an instance of the ``_Policy`` class given the filters config. | [
"Return",
"an",
"instance",
"of",
"the",
"_Policy",
"class",
"given",
"the",
"filters",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L514-L567 |
35,987 | saltstack/salt | salt/modules/capirca_acl.py | get_term_config | def get_term_config(platform,
filter_name,
term_name,
filter_options=None,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
revision_id=None,
... | python | def get_term_config(platform,
filter_name,
term_name,
filter_options=None,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
revision_id=None,
... | [
"def",
"get_term_config",
"(",
"platform",
",",
"filter_name",
",",
"term_name",
",",
"filter_options",
"=",
"None",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
"merge_pillar",
"=",
"True",
",",
"revision... | Return the configuration of a single policy term.
platform
The name of the Capirca platform.
filter_name
The name of the policy filter.
term_name
The name of the term.
filter_options
Additional filter options. These options are platform-specific.
E.g.: ``inet6... | [
"Return",
"the",
"configuration",
"of",
"a",
"single",
"policy",
"term",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L610-L885 |
35,988 | saltstack/salt | salt/modules/capirca_acl.py | get_filter_config | def get_filter_config(platform,
filter_name,
filter_options=None,
terms=None,
prepend=True,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merg... | python | def get_filter_config(platform,
filter_name,
filter_options=None,
terms=None,
prepend=True,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merg... | [
"def",
"get_filter_config",
"(",
"platform",
",",
"filter_name",
",",
"filter_options",
"=",
"None",
",",
"terms",
"=",
"None",
",",
"prepend",
"=",
"True",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
... | Return the configuration of a policy filter.
platform
The name of the Capirca platform.
filter_name
The name of the policy filter.
filter_options
Additional filter options. These options are platform-specific.
See the complete list of options_.
.. _options: https:... | [
"Return",
"the",
"configuration",
"of",
"a",
"policy",
"filter",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L888-L1031 |
35,989 | saltstack/salt | salt/modules/capirca_acl.py | get_policy_config | def get_policy_config(platform,
filters=None,
prepend=True,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
only_lower_merge=False,
... | python | def get_policy_config(platform,
filters=None,
prepend=True,
pillar_key='acl',
pillarenv=None,
saltenv=None,
merge_pillar=True,
only_lower_merge=False,
... | [
"def",
"get_policy_config",
"(",
"platform",
",",
"filters",
"=",
"None",
",",
"prepend",
"=",
"True",
",",
"pillar_key",
"=",
"'acl'",
",",
"pillarenv",
"=",
"None",
",",
"saltenv",
"=",
"None",
",",
"merge_pillar",
"=",
"True",
",",
"only_lower_merge",
"... | Return the configuration of the whole policy.
platform
The name of the Capirca platform.
filters
List of filters for this policy.
If not specified or empty, will try to load the configuration from the pillar,
unless ``merge_pillar`` is set as ``False``.
prepend: ``True``
... | [
"Return",
"the",
"configuration",
"of",
"the",
"whole",
"policy",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/capirca_acl.py#L1034-L1202 |
35,990 | saltstack/salt | salt/cli/call.py | SaltCall.run | def run(self):
'''
Execute the salt call!
'''
self.parse_args()
if self.options.file_root:
# check if the argument is pointing to a file on disk
file_root = os.path.abspath(self.options.file_root)
self.config['file_roots'] = {'base': _expand_g... | python | def run(self):
'''
Execute the salt call!
'''
self.parse_args()
if self.options.file_root:
# check if the argument is pointing to a file on disk
file_root = os.path.abspath(self.options.file_root)
self.config['file_roots'] = {'base': _expand_g... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"parse_args",
"(",
")",
"if",
"self",
".",
"options",
".",
"file_root",
":",
"# check if the argument is pointing to a file on disk",
"file_root",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"self",
".",
"op... | Execute the salt call! | [
"Execute",
"the",
"salt",
"call!"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/call.py#L17-L57 |
35,991 | saltstack/salt | salt/states/highstate_doc.py | note | def note(name, source=None, contents=None, **kwargs):
'''
Add content to a document generated using `highstate_doc.render`.
This state does not preform any tasks on the host. It only is used in highstate_doc lowstate proccessers
to include extra documents.
.. code-block:: yaml
{{sls}} exa... | python | def note(name, source=None, contents=None, **kwargs):
'''
Add content to a document generated using `highstate_doc.render`.
This state does not preform any tasks on the host. It only is used in highstate_doc lowstate proccessers
to include extra documents.
.. code-block:: yaml
{{sls}} exa... | [
"def",
"note",
"(",
"name",
",",
"source",
"=",
"None",
",",
"contents",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"comment",
"=",
"''",
"if",
"source",
":",
"comment",
"+=",
"'include file: {0}\\n'",
".",
"format",
"(",
"source",
")",
"if",
"c... | Add content to a document generated using `highstate_doc.render`.
This state does not preform any tasks on the host. It only is used in highstate_doc lowstate proccessers
to include extra documents.
.. code-block:: yaml
{{sls}} example note:
highstate_doc.note:
- name:... | [
"Add",
"content",
"to",
"a",
"document",
"generated",
"using",
"highstate_doc",
".",
"render",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/highstate_doc.py#L12-L45 |
35,992 | saltstack/salt | salt/modules/win_wua.py | get_wu_settings | def get_wu_settings():
'''
Get current Windows Update settings.
Returns:
dict: A dictionary of Windows Update settings:
Featured Updates:
Boolean value that indicates whether to display notifications for
featured updates.
Group Policy Required (Read-only):
... | python | def get_wu_settings():
'''
Get current Windows Update settings.
Returns:
dict: A dictionary of Windows Update settings:
Featured Updates:
Boolean value that indicates whether to display notifications for
featured updates.
Group Policy Required (Read-only):
... | [
"def",
"get_wu_settings",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"day",
"=",
"[",
"'Every Day'",
",",
"'Sunday'",
",",
"'Monday'",
",",
"'Tuesday'",
",",
"'Wednesday'",
",",
"'Thursday'",
",",
"'Friday'",
",",
"'Saturday'",
"]",
"# Initialize the PyCom system",
... | Get current Windows Update settings.
Returns:
dict: A dictionary of Windows Update settings:
Featured Updates:
Boolean value that indicates whether to display notifications for
featured updates.
Group Policy Required (Read-only):
Boolean value that indi... | [
"Get",
"current",
"Windows",
"Update",
"settings",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L866-L953 |
35,993 | saltstack/salt | salt/modules/win_wua.py | _get_msupdate_status | def _get_msupdate_status():
'''
Check to see if Microsoft Update is Enabled
Return Boolean
'''
# To get the status of Microsoft Update we actually have to check the
# Microsoft Update Service Manager
# Initialize the PyCom system
with salt.utils.winapi.Com():
# Create a ServiceMa... | python | def _get_msupdate_status():
'''
Check to see if Microsoft Update is Enabled
Return Boolean
'''
# To get the status of Microsoft Update we actually have to check the
# Microsoft Update Service Manager
# Initialize the PyCom system
with salt.utils.winapi.Com():
# Create a ServiceMa... | [
"def",
"_get_msupdate_status",
"(",
")",
":",
"# To get the status of Microsoft Update we actually have to check the",
"# Microsoft Update Service Manager",
"# Initialize the PyCom system",
"with",
"salt",
".",
"utils",
".",
"winapi",
".",
"Com",
"(",
")",
":",
"# Create a Serv... | Check to see if Microsoft Update is Enabled
Return Boolean | [
"Check",
"to",
"see",
"if",
"Microsoft",
"Update",
"is",
"Enabled",
"Return",
"Boolean"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L956-L977 |
35,994 | saltstack/salt | salt/modules/boto_s3.py | get_object_metadata | def get_object_metadata(
name,
extra_args=None,
region=None,
key=None,
keyid=None,
profile=None,
):
'''
Get metadata about an S3 object.
Returns None if the object does not exist.
You can pass AWS SSE-C related args and/or RequestPayer in extra_args.
CLI Example:
.. co... | python | def get_object_metadata(
name,
extra_args=None,
region=None,
key=None,
keyid=None,
profile=None,
):
'''
Get metadata about an S3 object.
Returns None if the object does not exist.
You can pass AWS SSE-C related args and/or RequestPayer in extra_args.
CLI Example:
.. co... | [
"def",
"get_object_metadata",
"(",
"name",
",",
"extra_args",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
")",
":",
"bucket",
",",
"_",
",",
"s3_key",
"=",
"name",
"... | Get metadata about an S3 object.
Returns None if the object does not exist.
You can pass AWS SSE-C related args and/or RequestPayer in extra_args.
CLI Example:
.. code-block:: bash
salt myminion boto_s3.get_object_metadata \\
my_bucket/path/to/object \\
... | [
"Get",
"metadata",
"about",
"an",
"S3",
"object",
".",
"Returns",
"None",
"if",
"the",
"object",
"does",
"not",
"exist",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3.py#L90-L132 |
35,995 | saltstack/salt | salt/modules/boto_s3.py | upload_file | def upload_file(
source,
name,
extra_args=None,
region=None,
key=None,
keyid=None,
profile=None,
):
'''
Upload a local file as an S3 object.
CLI Example:
.. code-block:: bash
salt myminion boto_s3.upload_file \\
/path/to/local/file \\
... | python | def upload_file(
source,
name,
extra_args=None,
region=None,
key=None,
keyid=None,
profile=None,
):
'''
Upload a local file as an S3 object.
CLI Example:
.. code-block:: bash
salt myminion boto_s3.upload_file \\
/path/to/local/file \\
... | [
"def",
"upload_file",
"(",
"source",
",",
"name",
",",
"extra_args",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
")",
":",
"bucket",
",",
"_",
",",
"s3_key",
"=",
... | Upload a local file as an S3 object.
CLI Example:
.. code-block:: bash
salt myminion boto_s3.upload_file \\
/path/to/local/file \\
my_bucket/path/to/object \\
region=us-east-1 \\
key=key \\
... | [
"Upload",
"a",
"local",
"file",
"as",
"an",
"S3",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_s3.py#L135-L169 |
35,996 | saltstack/salt | salt/utils/profile.py | profile_func | def profile_func(filename=None):
'''
Decorator for adding profiling to a nested function in Salt
'''
def proffunc(fun):
def profiled_func(*args, **kwargs):
logging.info('Profiling function %s', fun.__name__)
try:
profiler = cProfile.Profile()
... | python | def profile_func(filename=None):
'''
Decorator for adding profiling to a nested function in Salt
'''
def proffunc(fun):
def profiled_func(*args, **kwargs):
logging.info('Profiling function %s', fun.__name__)
try:
profiler = cProfile.Profile()
... | [
"def",
"profile_func",
"(",
"filename",
"=",
"None",
")",
":",
"def",
"proffunc",
"(",
"fun",
")",
":",
"def",
"profiled_func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"logging",
".",
"info",
"(",
"'Profiling function %s'",
",",
"fun",
"."... | Decorator for adding profiling to a nested function in Salt | [
"Decorator",
"for",
"adding",
"profiling",
"to",
"a",
"nested",
"function",
"in",
"Salt"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/profile.py#L30-L47 |
35,997 | saltstack/salt | salt/modules/djangomod.py | _get_django_admin | def _get_django_admin(bin_env):
'''
Return the django admin
'''
if not bin_env:
if salt.utils.path.which('django-admin.py'):
return 'django-admin.py'
elif salt.utils.path.which('django-admin'):
return 'django-admin'
else:
raise salt.exceptions.... | python | def _get_django_admin(bin_env):
'''
Return the django admin
'''
if not bin_env:
if salt.utils.path.which('django-admin.py'):
return 'django-admin.py'
elif salt.utils.path.which('django-admin'):
return 'django-admin'
else:
raise salt.exceptions.... | [
"def",
"_get_django_admin",
"(",
"bin_env",
")",
":",
"if",
"not",
"bin_env",
":",
"if",
"salt",
".",
"utils",
".",
"path",
".",
"which",
"(",
"'django-admin.py'",
")",
":",
"return",
"'django-admin.py'",
"elif",
"salt",
".",
"utils",
".",
"path",
".",
"... | Return the django admin | [
"Return",
"the",
"django",
"admin"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L26-L42 |
35,998 | saltstack/salt | salt/modules/djangomod.py | command | def command(settings_module,
command,
bin_env=None,
pythonpath=None,
env=None,
runas=None,
*args, **kwargs):
'''
Run arbitrary django management command
CLI Example:
.. code-block:: bash
salt '*' django.command <settings_... | python | def command(settings_module,
command,
bin_env=None,
pythonpath=None,
env=None,
runas=None,
*args, **kwargs):
'''
Run arbitrary django management command
CLI Example:
.. code-block:: bash
salt '*' django.command <settings_... | [
"def",
"command",
"(",
"settings_module",
",",
"command",
",",
"bin_env",
"=",
"None",
",",
"pythonpath",
"=",
"None",
",",
"env",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"dja",
"=",
"_get_django_a... | Run arbitrary django management command
CLI Example:
.. code-block:: bash
salt '*' django.command <settings_module> <command> | [
"Run",
"arbitrary",
"django",
"management",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L45-L73 |
35,999 | saltstack/salt | salt/modules/djangomod.py | loaddata | def loaddata(settings_module,
fixtures,
bin_env=None,
database=None,
pythonpath=None,
env=None):
'''
Load fixture data
Fixtures:
comma separated list of fixtures to load
CLI Example:
.. code-block:: bash
salt '*' dj... | python | def loaddata(settings_module,
fixtures,
bin_env=None,
database=None,
pythonpath=None,
env=None):
'''
Load fixture data
Fixtures:
comma separated list of fixtures to load
CLI Example:
.. code-block:: bash
salt '*' dj... | [
"def",
"loaddata",
"(",
"settings_module",
",",
"fixtures",
",",
"bin_env",
"=",
"None",
",",
"database",
"=",
"None",
",",
"pythonpath",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"kwargs",
"=",
"{",
"}",
"if",
"database"... | Load fixture data
Fixtures:
comma separated list of fixtures to load
CLI Example:
.. code-block:: bash
salt '*' django.loaddata <settings_module> <comma delimited list of fixtures> | [
"Load",
"fixture",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/djangomod.py#L249-L280 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.