repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/publish.py | runner | def runner(fun, arg=None, timeout=5):
'''
Execute a runner on the master and return the data from the runner
function
CLI Example:
.. code-block:: bash
salt publish.runner manage.down
'''
arg = _parse_args(arg)
if 'master_uri' not in __opts__:
return 'No access to mas... | python | def runner(fun, arg=None, timeout=5):
'''
Execute a runner on the master and return the data from the runner
function
CLI Example:
.. code-block:: bash
salt publish.runner manage.down
'''
arg = _parse_args(arg)
if 'master_uri' not in __opts__:
return 'No access to mas... | [
"def",
"runner",
"(",
"fun",
",",
"arg",
"=",
"None",
",",
"timeout",
"=",
"5",
")",
":",
"arg",
"=",
"_parse_args",
"(",
"arg",
")",
"if",
"'master_uri'",
"not",
"in",
"__opts__",
":",
"return",
"'No access to master. If using salt-call with --local, please rem... | Execute a runner on the master and return the data from the runner
function
CLI Example:
.. code-block:: bash
salt publish.runner manage.down | [
"Execute",
"a",
"runner",
"on",
"the",
"master",
"and",
"return",
"the",
"data",
"from",
"the",
"runner",
"function"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/publish.py#L303-L335 | train |
saltstack/salt | salt/modules/kerberos.py | __execute_kadmin | def __execute_kadmin(cmd):
'''
Execute kadmin commands
'''
ret = {}
auth_keytab = __opts__.get('auth_keytab', None)
auth_principal = __opts__.get('auth_principal', None)
if __salt__['file.file_exists'](auth_keytab) and auth_principal:
return __salt__['cmd.run_all'](
'ka... | python | def __execute_kadmin(cmd):
'''
Execute kadmin commands
'''
ret = {}
auth_keytab = __opts__.get('auth_keytab', None)
auth_principal = __opts__.get('auth_principal', None)
if __salt__['file.file_exists'](auth_keytab) and auth_principal:
return __salt__['cmd.run_all'](
'ka... | [
"def",
"__execute_kadmin",
"(",
"cmd",
")",
":",
"ret",
"=",
"{",
"}",
"auth_keytab",
"=",
"__opts__",
".",
"get",
"(",
"'auth_keytab'",
",",
"None",
")",
"auth_principal",
"=",
"__opts__",
".",
"get",
"(",
"'auth_principal'",
",",
"None",
")",
"if",
"__... | Execute kadmin commands | [
"Execute",
"kadmin",
"commands"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L40-L60 | train |
saltstack/salt | salt/modules/kerberos.py | list_principals | def list_principals():
'''
Get all principals
CLI Example:
.. code-block:: bash
salt 'kde.example.com' kerberos.list_principals
'''
ret = {}
cmd = __execute_kadmin('list_principals')
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] = cmd['stderr'].splitlines()... | python | def list_principals():
'''
Get all principals
CLI Example:
.. code-block:: bash
salt 'kde.example.com' kerberos.list_principals
'''
ret = {}
cmd = __execute_kadmin('list_principals')
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] = cmd['stderr'].splitlines()... | [
"def",
"list_principals",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"__execute_kadmin",
"(",
"'list_principals'",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"cmd",
"[",
"'stderr'",
"]",
":",
"ret",
"[",
"'comment'",
"]",
"=",
"c... | Get all principals
CLI Example:
.. code-block:: bash
salt 'kde.example.com' kerberos.list_principals | [
"Get",
"all",
"principals"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L63-L88 | train |
saltstack/salt | salt/modules/kerberos.py | get_principal | def get_principal(name):
'''
Get princial details
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.get_principal root/admin
'''
ret = {}
cmd = __execute_kadmin('get_principal {0}'.format(name))
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] ... | python | def get_principal(name):
'''
Get princial details
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.get_principal root/admin
'''
ret = {}
cmd = __execute_kadmin('get_principal {0}'.format(name))
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] ... | [
"def",
"get_principal",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"__execute_kadmin",
"(",
"'get_principal {0}'",
".",
"format",
"(",
"name",
")",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"cmd",
"[",
"'stderr'",
"]",
"... | Get princial details
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.get_principal root/admin | [
"Get",
"princial",
"details"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L91-L116 | train |
saltstack/salt | salt/modules/kerberos.py | list_policies | def list_policies():
'''
List policies
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.list_policies
'''
ret = {}
cmd = __execute_kadmin('list_policies')
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] = cmd['stderr'].splitlines()[-1]
... | python | def list_policies():
'''
List policies
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.list_policies
'''
ret = {}
cmd = __execute_kadmin('list_policies')
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] = cmd['stderr'].splitlines()[-1]
... | [
"def",
"list_policies",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"__execute_kadmin",
"(",
"'list_policies'",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"cmd",
"[",
"'stderr'",
"]",
":",
"ret",
"[",
"'comment'",
"]",
"=",
"cmd",... | List policies
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.list_policies | [
"List",
"policies"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L119-L144 | train |
saltstack/salt | salt/modules/kerberos.py | get_privs | def get_privs():
'''
Current privileges
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.get_privs
'''
ret = {}
cmd = __execute_kadmin('get_privs')
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] = cmd['stderr'].splitlines()[-1]
ret['... | python | def get_privs():
'''
Current privileges
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.get_privs
'''
ret = {}
cmd = __execute_kadmin('get_privs')
if cmd['retcode'] != 0 or cmd['stderr']:
ret['comment'] = cmd['stderr'].splitlines()[-1]
ret['... | [
"def",
"get_privs",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"__execute_kadmin",
"(",
"'get_privs'",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"cmd",
"[",
"'stderr'",
"]",
":",
"ret",
"[",
"'comment'",
"]",
"=",
"cmd",
"[",
... | Current privileges
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.get_privs | [
"Current",
"privileges"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L175-L200 | train |
saltstack/salt | salt/modules/kerberos.py | create_principal | def create_principal(name, enctypes=None):
'''
Create Principal
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.create_principal host/example.com
'''
ret = {}
krb_cmd = 'addprinc -randkey'
if enctypes:
krb_cmd += ' -e {0}'.format(enctypes)
krb_... | python | def create_principal(name, enctypes=None):
'''
Create Principal
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.create_principal host/example.com
'''
ret = {}
krb_cmd = 'addprinc -randkey'
if enctypes:
krb_cmd += ' -e {0}'.format(enctypes)
krb_... | [
"def",
"create_principal",
"(",
"name",
",",
"enctypes",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"krb_cmd",
"=",
"'addprinc -randkey'",
"if",
"enctypes",
":",
"krb_cmd",
"+=",
"' -e {0}'",
".",
"format",
"(",
"enctypes",
")",
"krb_cmd",
"+=",
"' {0}'"... | Create Principal
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.create_principal host/example.com | [
"Create",
"Principal"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L203-L231 | train |
saltstack/salt | salt/modules/kerberos.py | delete_principal | def delete_principal(name):
'''
Delete Principal
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.delete_principal host/example.com@EXAMPLE.COM
'''
ret = {}
cmd = __execute_kadmin('delprinc -force {0}'.format(name))
if cmd['retcode'] != 0 or cmd['stderr']:
... | python | def delete_principal(name):
'''
Delete Principal
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.delete_principal host/example.com@EXAMPLE.COM
'''
ret = {}
cmd = __execute_kadmin('delprinc -force {0}'.format(name))
if cmd['retcode'] != 0 or cmd['stderr']:
... | [
"def",
"delete_principal",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"__execute_kadmin",
"(",
"'delprinc -force {0}'",
".",
"format",
"(",
"name",
")",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
"or",
"cmd",
"[",
"'stderr'",
"]"... | Delete Principal
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.delete_principal host/example.com@EXAMPLE.COM | [
"Delete",
"Principal"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L234-L254 | train |
saltstack/salt | salt/modules/kerberos.py | create_keytab | def create_keytab(name, keytab, enctypes=None):
'''
Create keytab
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.create_keytab host/host1.example.com host1.example.com.keytab
'''
ret = {}
krb_cmd = 'ktadd -k {0}'.format(keytab)
if enctypes:
krb_cmd... | python | def create_keytab(name, keytab, enctypes=None):
'''
Create keytab
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.create_keytab host/host1.example.com host1.example.com.keytab
'''
ret = {}
krb_cmd = 'ktadd -k {0}'.format(keytab)
if enctypes:
krb_cmd... | [
"def",
"create_keytab",
"(",
"name",
",",
"keytab",
",",
"enctypes",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"krb_cmd",
"=",
"'ktadd -k {0}'",
".",
"format",
"(",
"keytab",
")",
"if",
"enctypes",
":",
"krb_cmd",
"+=",
"' -e {0}'",
".",
"format",
"... | Create keytab
CLI Example:
.. code-block:: bash
salt 'kdc.example.com' kerberos.create_keytab host/host1.example.com host1.example.com.keytab | [
"Create",
"keytab"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kerberos.py#L257-L284 | train |
saltstack/salt | salt/states/host.py | present | def present(name, ip, clean=False): # pylint: disable=C0103
'''
Ensures that the named host is present with the given ip
name
The host to assign an ip to
ip
The ip addr(s) to apply to the host. Can be a single IP or a list of IP
addresses.
clean : False
Remove any... | python | def present(name, ip, clean=False): # pylint: disable=C0103
'''
Ensures that the named host is present with the given ip
name
The host to assign an ip to
ip
The ip addr(s) to apply to the host. Can be a single IP or a list of IP
addresses.
clean : False
Remove any... | [
"def",
"present",
"(",
"name",
",",
"ip",
",",
"clean",
"=",
"False",
")",
":",
"# pylint: disable=C0103",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
"if",
"__opts__",
"[",
"'test'",
"]",
"e... | Ensures that the named host is present with the given ip
name
The host to assign an ip to
ip
The ip addr(s) to apply to the host. Can be a single IP or a list of IP
addresses.
clean : False
Remove any entries which don't match those configured in the ``ip``
option.... | [
"Ensures",
"that",
"the",
"named",
"host",
"is",
"present",
"with",
"the",
"given",
"ip"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/host.py#L70-L165 | train |
saltstack/salt | salt/states/host.py | absent | def absent(name, ip): # pylint: disable=C0103
'''
Ensure that the named host is absent
name
The host to remove
ip
The ip addr(s) of the host to remove
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
if not isinstance... | python | def absent(name, ip): # pylint: disable=C0103
'''
Ensure that the named host is absent
name
The host to remove
ip
The ip addr(s) of the host to remove
'''
ret = {'name': name,
'changes': {},
'result': None,
'comment': ''}
if not isinstance... | [
"def",
"absent",
"(",
"name",
",",
"ip",
")",
":",
"# pylint: disable=C0103",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"not",
"isinstance",
"(",
"ip... | Ensure that the named host is absent
name
The host to remove
ip
The ip addr(s) of the host to remove | [
"Ensure",
"that",
"the",
"named",
"host",
"is",
"absent"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/host.py#L168-L203 | train |
saltstack/salt | salt/states/host.py | only | def only(name, hostnames):
'''
Ensure that only the given hostnames are associated with the
given IP address.
.. versionadded:: 2016.3.0
name
The IP address to associate with the given hostnames.
hostnames
Either a single hostname or a list of hostnames to associate
wi... | python | def only(name, hostnames):
'''
Ensure that only the given hostnames are associated with the
given IP address.
.. versionadded:: 2016.3.0
name
The IP address to associate with the given hostnames.
hostnames
Either a single hostname or a list of hostnames to associate
wi... | [
"def",
"only",
"(",
"name",
",",
"hostnames",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"isinstance",
"(",
"hostnames",
",",
"six",
".",
... | Ensure that only the given hostnames are associated with the
given IP address.
.. versionadded:: 2016.3.0
name
The IP address to associate with the given hostnames.
hostnames
Either a single hostname or a list of hostnames to associate
with the given IP address in the given or... | [
"Ensure",
"that",
"only",
"the",
"given",
"hostnames",
"are",
"associated",
"with",
"the",
"given",
"IP",
"address",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/host.py#L206-L254 | train |
saltstack/salt | salt/fileserver/svnfs.py | _rev | def _rev(repo):
'''
Returns revision ID of repo
'''
try:
repo_info = dict(six.iteritems(CLIENT.info(repo['repo'])))
except (pysvn._pysvn.ClientError, TypeError,
KeyError, AttributeError) as exc:
log.error(
'Error retrieving revision ID for svnfs remote %s '
... | python | def _rev(repo):
'''
Returns revision ID of repo
'''
try:
repo_info = dict(six.iteritems(CLIENT.info(repo['repo'])))
except (pysvn._pysvn.ClientError, TypeError,
KeyError, AttributeError) as exc:
log.error(
'Error retrieving revision ID for svnfs remote %s '
... | [
"def",
"_rev",
"(",
"repo",
")",
":",
"try",
":",
"repo_info",
"=",
"dict",
"(",
"six",
".",
"iteritems",
"(",
"CLIENT",
".",
"info",
"(",
"repo",
"[",
"'repo'",
"]",
")",
")",
")",
"except",
"(",
"pysvn",
".",
"_pysvn",
".",
"ClientError",
",",
... | Returns revision ID of repo | [
"Returns",
"revision",
"ID",
"of",
"repo"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L103-L118 | train |
saltstack/salt | salt/fileserver/svnfs.py | init | def init():
'''
Return the list of svn remotes and their configuration information
'''
bp_ = os.path.join(__opts__['cachedir'], 'svnfs')
new_remote = False
repos = []
per_remote_defaults = {}
for param in PER_REMOTE_OVERRIDES:
per_remote_defaults[param] = \
six.text_... | python | def init():
'''
Return the list of svn remotes and their configuration information
'''
bp_ = os.path.join(__opts__['cachedir'], 'svnfs')
new_remote = False
repos = []
per_remote_defaults = {}
for param in PER_REMOTE_OVERRIDES:
per_remote_defaults[param] = \
six.text_... | [
"def",
"init",
"(",
")",
":",
"bp_",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'svnfs'",
")",
"new_remote",
"=",
"False",
"repos",
"=",
"[",
"]",
"per_remote_defaults",
"=",
"{",
"}",
"for",
"param",
"in",
... | Return the list of svn remotes and their configuration information | [
"Return",
"the",
"list",
"of",
"svn",
"remotes",
"and",
"their",
"configuration",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L130-L252 | train |
saltstack/salt | salt/fileserver/svnfs.py | _clear_old_remotes | def _clear_old_remotes():
'''
Remove cache directories for remotes no longer configured
'''
bp_ = os.path.join(__opts__['cachedir'], 'svnfs')
try:
cachedir_ls = os.listdir(bp_)
except OSError:
cachedir_ls = []
repos = init()
# Remove actively-used remotes from list
fo... | python | def _clear_old_remotes():
'''
Remove cache directories for remotes no longer configured
'''
bp_ = os.path.join(__opts__['cachedir'], 'svnfs')
try:
cachedir_ls = os.listdir(bp_)
except OSError:
cachedir_ls = []
repos = init()
# Remove actively-used remotes from list
fo... | [
"def",
"_clear_old_remotes",
"(",
")",
":",
"bp_",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'svnfs'",
")",
"try",
":",
"cachedir_ls",
"=",
"os",
".",
"listdir",
"(",
"bp_",
")",
"except",
"OSError",
":",
"ca... | Remove cache directories for remotes no longer configured | [
"Remove",
"cache",
"directories",
"for",
"remotes",
"no",
"longer",
"configured"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L255-L293 | train |
saltstack/salt | salt/fileserver/svnfs.py | clear_cache | def clear_cache():
'''
Completely clear svnfs cache
'''
fsb_cachedir = os.path.join(__opts__['cachedir'], 'svnfs')
list_cachedir = os.path.join(__opts__['cachedir'], 'file_lists/svnfs')
errors = []
for rdir in (fsb_cachedir, list_cachedir):
if os.path.exists(rdir):
try:
... | python | def clear_cache():
'''
Completely clear svnfs cache
'''
fsb_cachedir = os.path.join(__opts__['cachedir'], 'svnfs')
list_cachedir = os.path.join(__opts__['cachedir'], 'file_lists/svnfs')
errors = []
for rdir in (fsb_cachedir, list_cachedir):
if os.path.exists(rdir):
try:
... | [
"def",
"clear_cache",
"(",
")",
":",
"fsb_cachedir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'svnfs'",
")",
"list_cachedir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
... | Completely clear svnfs cache | [
"Completely",
"clear",
"svnfs",
"cache"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L296-L309 | train |
saltstack/salt | salt/fileserver/svnfs.py | clear_lock | def clear_lock(remote=None):
'''
Clear update.lk
``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked.
'''
def _do_clear_lock(repo):
def _add_error(errlist, rep... | python | def clear_lock(remote=None):
'''
Clear update.lk
``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked.
'''
def _do_clear_lock(repo):
def _add_error(errlist, rep... | [
"def",
"clear_lock",
"(",
"remote",
"=",
"None",
")",
":",
"def",
"_do_clear_lock",
"(",
"repo",
")",
":",
"def",
"_add_error",
"(",
"errlist",
",",
"repo",
",",
"exc",
")",
":",
"msg",
"=",
"(",
"'Unable to remove update lock for {0} ({1}): {2} '",
".",
"fo... | Clear update.lk
``remote`` can either be a dictionary containing repo configuration
information, or a pattern. If the latter, then remotes for which the URL
matches the pattern will be locked. | [
"Clear",
"update",
".",
"lk"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L312-L365 | train |
saltstack/salt | salt/fileserver/svnfs.py | update | def update():
'''
Execute an svn update on all of the repos
'''
# data for the fileserver event
data = {'changed': False,
'backend': 'svnfs'}
# _clear_old_remotes runs init(), so use the value from there to avoid a
# second init()
data['changed'], repos = _clear_old_remotes()... | python | def update():
'''
Execute an svn update on all of the repos
'''
# data for the fileserver event
data = {'changed': False,
'backend': 'svnfs'}
# _clear_old_remotes runs init(), so use the value from there to avoid a
# second init()
data['changed'], repos = _clear_old_remotes()... | [
"def",
"update",
"(",
")",
":",
"# data for the fileserver event",
"data",
"=",
"{",
"'changed'",
":",
"False",
",",
"'backend'",
":",
"'svnfs'",
"}",
"# _clear_old_remotes runs init(), so use the value from there to avoid a",
"# second init()",
"data",
"[",
"'changed'",
... | Execute an svn update on all of the repos | [
"Execute",
"an",
"svn",
"update",
"on",
"all",
"of",
"the",
"repos"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L415-L488 | train |
saltstack/salt | salt/fileserver/svnfs.py | _env_is_exposed | def _env_is_exposed(env):
'''
Check if an environment is exposed by comparing it against a whitelist and
blacklist.
'''
if __opts__['svnfs_env_whitelist']:
salt.utils.versions.warn_until(
'Neon',
'The svnfs_env_whitelist config option has been renamed to '
... | python | def _env_is_exposed(env):
'''
Check if an environment is exposed by comparing it against a whitelist and
blacklist.
'''
if __opts__['svnfs_env_whitelist']:
salt.utils.versions.warn_until(
'Neon',
'The svnfs_env_whitelist config option has been renamed to '
... | [
"def",
"_env_is_exposed",
"(",
"env",
")",
":",
"if",
"__opts__",
"[",
"'svnfs_env_whitelist'",
"]",
":",
"salt",
".",
"utils",
".",
"versions",
".",
"warn_until",
"(",
"'Neon'",
",",
"'The svnfs_env_whitelist config option has been renamed to '",
"'svnfs_saltenv_whitel... | Check if an environment is exposed by comparing it against a whitelist and
blacklist. | [
"Check",
"if",
"an",
"environment",
"is",
"exposed",
"by",
"comparing",
"it",
"against",
"a",
"whitelist",
"and",
"blacklist",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L491-L520 | train |
saltstack/salt | salt/fileserver/svnfs.py | envs | def envs(ignore_cache=False):
'''
Return a list of refs that can be used as environments
'''
if not ignore_cache:
env_cache = os.path.join(__opts__['cachedir'], 'svnfs/envs.p')
cache_match = salt.fileserver.check_env_cache(__opts__, env_cache)
if cache_match is not None:
... | python | def envs(ignore_cache=False):
'''
Return a list of refs that can be used as environments
'''
if not ignore_cache:
env_cache = os.path.join(__opts__['cachedir'], 'svnfs/envs.p')
cache_match = salt.fileserver.check_env_cache(__opts__, env_cache)
if cache_match is not None:
... | [
"def",
"envs",
"(",
"ignore_cache",
"=",
"False",
")",
":",
"if",
"not",
"ignore_cache",
":",
"env_cache",
"=",
"os",
".",
"path",
".",
"join",
"(",
"__opts__",
"[",
"'cachedir'",
"]",
",",
"'svnfs/envs.p'",
")",
"cache_match",
"=",
"salt",
".",
"fileser... | Return a list of refs that can be used as environments | [
"Return",
"a",
"list",
"of",
"refs",
"that",
"can",
"be",
"used",
"as",
"environments"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L523-L562 | train |
saltstack/salt | salt/fileserver/svnfs.py | _env_root | def _env_root(repo, saltenv):
'''
Return the root of the directory corresponding to the desired environment,
or None if the environment was not found.
'''
# If 'base' is desired, look for the trunk
if saltenv == 'base':
trunk = os.path.join(repo['repo'], repo['trunk'])
if os.path... | python | def _env_root(repo, saltenv):
'''
Return the root of the directory corresponding to the desired environment,
or None if the environment was not found.
'''
# If 'base' is desired, look for the trunk
if saltenv == 'base':
trunk = os.path.join(repo['repo'], repo['trunk'])
if os.path... | [
"def",
"_env_root",
"(",
"repo",
",",
"saltenv",
")",
":",
"# If 'base' is desired, look for the trunk",
"if",
"saltenv",
"==",
"'base'",
":",
"trunk",
"=",
"os",
".",
"path",
".",
"join",
"(",
"repo",
"[",
"'repo'",
"]",
",",
"repo",
"[",
"'trunk'",
"]",
... | Return the root of the directory corresponding to the desired environment,
or None if the environment was not found. | [
"Return",
"the",
"root",
"of",
"the",
"directory",
"corresponding",
"to",
"the",
"desired",
"environment",
"or",
"None",
"if",
"the",
"environment",
"was",
"not",
"found",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L565-L588 | train |
saltstack/salt | salt/fileserver/svnfs.py | find_file | def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref. This operates similarly to
the roots file sever but with assumptions of the directory structure
based on svn standard practices.
'''
fnd = {'path': '',
'rel': ''}... | python | def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613
'''
Find the first file to match the path and ref. This operates similarly to
the roots file sever but with assumptions of the directory structure
based on svn standard practices.
'''
fnd = {'path': '',
'rel': ''}... | [
"def",
"find_file",
"(",
"path",
",",
"tgt_env",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"fnd",
"=",
"{",
"'path'",
":",
"''",
",",
"'rel'",
":",
"''",
"}",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")... | Find the first file to match the path and ref. This operates similarly to
the roots file sever but with assumptions of the directory structure
based on svn standard practices. | [
"Find",
"the",
"first",
"file",
"to",
"match",
"the",
"path",
"and",
"ref",
".",
"This",
"operates",
"similarly",
"to",
"the",
"roots",
"file",
"sever",
"but",
"with",
"assumptions",
"of",
"the",
"directory",
"structure",
"based",
"on",
"svn",
"standard",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L591-L635 | train |
saltstack/salt | salt/fileserver/svnfs.py | file_hash | def file_hash(load, fnd):
'''
Return a file hash, the hash type is set in the master config file
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not all(x in load for x in ('path', 'saltenv')):
return ''
saltenv = load['saltenv']
if ... | python | def file_hash(load, fnd):
'''
Return a file hash, the hash type is set in the master config file
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if not all(x in load for x in ('path', 'saltenv')):
return ''
saltenv = load['saltenv']
if ... | [
"def",
"file_hash",
"(",
"load",
",",
"fnd",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
"not",
"all",
"(",
"x",
"in",
"load",
"for",
"x",
"in",
"(",
"'path'",
... | Return a file hash, the hash type is set in the master config file | [
"Return",
"a",
"file",
"hash",
"the",
"hash",
"type",
"is",
"set",
"in",
"the",
"master",
"config",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L667-L718 | train |
saltstack/salt | salt/fileserver/svnfs.py | _file_lists | def _file_lists(load, form):
'''
Return a dict containing the file lists for files, dirs, emptydirs and symlinks
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'saltenv' not in load or load['saltenv'] not in envs():
return []
list_cach... | python | def _file_lists(load, form):
'''
Return a dict containing the file lists for files, dirs, emptydirs and symlinks
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
if 'saltenv' not in load or load['saltenv'] not in envs():
return []
list_cach... | [
"def",
"_file_lists",
"(",
"load",
",",
"form",
")",
":",
"if",
"'env'",
"in",
"load",
":",
"# \"env\" is not supported; Use \"saltenv\".",
"load",
".",
"pop",
"(",
"'env'",
")",
"if",
"'saltenv'",
"not",
"in",
"load",
"or",
"load",
"[",
"'saltenv'",
"]",
... | Return a dict containing the file lists for files, dirs, emptydirs and symlinks | [
"Return",
"a",
"dict",
"containing",
"the",
"file",
"lists",
"for",
"files",
"dirs",
"emptydirs",
"and",
"symlinks"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/svnfs.py#L721-L789 | train |
saltstack/salt | salt/auth/pam.py | authenticate | def authenticate(username, password):
'''
Returns True if the given username and password authenticate for the
given service. Returns False otherwise
``username``: the username to authenticate
``password``: the password in plain text
'''
service = __opts__.get('auth.pam.service', 'login')... | python | def authenticate(username, password):
'''
Returns True if the given username and password authenticate for the
given service. Returns False otherwise
``username``: the username to authenticate
``password``: the password in plain text
'''
service = __opts__.get('auth.pam.service', 'login')... | [
"def",
"authenticate",
"(",
"username",
",",
"password",
")",
":",
"service",
"=",
"__opts__",
".",
"get",
"(",
"'auth.pam.service'",
",",
"'login'",
")",
"if",
"isinstance",
"(",
"username",
",",
"six",
".",
"text_type",
")",
":",
"username",
"=",
"userna... | Returns True if the given username and password authenticate for the
given service. Returns False otherwise
``username``: the username to authenticate
``password``: the password in plain text | [
"Returns",
"True",
"if",
"the",
"given",
"username",
"and",
"password",
"authenticate",
"for",
"the",
"given",
"service",
".",
"Returns",
"False",
"otherwise"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/pam.py#L168-L216 | train |
saltstack/salt | salt/grains/napalm.py | _retrieve_grains_cache | def _retrieve_grains_cache(proxy=None):
'''
Retrieves the grains from the network device if not cached already.
'''
global GRAINS_CACHE
if not GRAINS_CACHE:
if proxy and salt.utils.napalm.is_proxy(__opts__):
# if proxy var passed and is NAPALM-type proxy minion
GRAINS... | python | def _retrieve_grains_cache(proxy=None):
'''
Retrieves the grains from the network device if not cached already.
'''
global GRAINS_CACHE
if not GRAINS_CACHE:
if proxy and salt.utils.napalm.is_proxy(__opts__):
# if proxy var passed and is NAPALM-type proxy minion
GRAINS... | [
"def",
"_retrieve_grains_cache",
"(",
"proxy",
"=",
"None",
")",
":",
"global",
"GRAINS_CACHE",
"if",
"not",
"GRAINS_CACHE",
":",
"if",
"proxy",
"and",
"salt",
".",
"utils",
".",
"napalm",
".",
"is_proxy",
"(",
"__opts__",
")",
":",
"# if proxy var passed and ... | Retrieves the grains from the network device if not cached already. | [
"Retrieves",
"the",
"grains",
"from",
"the",
"network",
"device",
"if",
"not",
"cached",
"already",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L63-L79 | train |
saltstack/salt | salt/grains/napalm.py | _retrieve_device_cache | def _retrieve_device_cache(proxy=None):
'''
Loads the network device details if not cached already.
'''
global DEVICE_CACHE
if not DEVICE_CACHE:
if proxy and salt.utils.napalm.is_proxy(__opts__):
# if proxy var passed and is NAPALM-type proxy minion
if 'napalm.get_dev... | python | def _retrieve_device_cache(proxy=None):
'''
Loads the network device details if not cached already.
'''
global DEVICE_CACHE
if not DEVICE_CACHE:
if proxy and salt.utils.napalm.is_proxy(__opts__):
# if proxy var passed and is NAPALM-type proxy minion
if 'napalm.get_dev... | [
"def",
"_retrieve_device_cache",
"(",
"proxy",
"=",
"None",
")",
":",
"global",
"DEVICE_CACHE",
"if",
"not",
"DEVICE_CACHE",
":",
"if",
"proxy",
"and",
"salt",
".",
"utils",
".",
"napalm",
".",
"is_proxy",
"(",
"__opts__",
")",
":",
"# if proxy var passed and ... | Loads the network device details if not cached already. | [
"Loads",
"the",
"network",
"device",
"details",
"if",
"not",
"cached",
"already",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L82-L95 | train |
saltstack/salt | salt/grains/napalm.py | _get_grain | def _get_grain(name, proxy=None):
'''
Retrieves the grain value from the cached dictionary.
'''
grains = _retrieve_grains_cache(proxy=proxy)
if grains.get('result', False) and grains.get('out', {}):
return grains.get('out').get(name) | python | def _get_grain(name, proxy=None):
'''
Retrieves the grain value from the cached dictionary.
'''
grains = _retrieve_grains_cache(proxy=proxy)
if grains.get('result', False) and grains.get('out', {}):
return grains.get('out').get(name) | [
"def",
"_get_grain",
"(",
"name",
",",
"proxy",
"=",
"None",
")",
":",
"grains",
"=",
"_retrieve_grains_cache",
"(",
"proxy",
"=",
"proxy",
")",
"if",
"grains",
".",
"get",
"(",
"'result'",
",",
"False",
")",
"and",
"grains",
".",
"get",
"(",
"'out'",
... | Retrieves the grain value from the cached dictionary. | [
"Retrieves",
"the",
"grain",
"value",
"from",
"the",
"cached",
"dictionary",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L98-L104 | train |
saltstack/salt | salt/grains/napalm.py | _get_device_grain | def _get_device_grain(name, proxy=None):
'''
Retrieves device-specific grains.
'''
device = _retrieve_device_cache(proxy=proxy)
return device.get(name.upper()) | python | def _get_device_grain(name, proxy=None):
'''
Retrieves device-specific grains.
'''
device = _retrieve_device_cache(proxy=proxy)
return device.get(name.upper()) | [
"def",
"_get_device_grain",
"(",
"name",
",",
"proxy",
"=",
"None",
")",
":",
"device",
"=",
"_retrieve_device_cache",
"(",
"proxy",
"=",
"proxy",
")",
"return",
"device",
".",
"get",
"(",
"name",
".",
"upper",
"(",
")",
")"
] | Retrieves device-specific grains. | [
"Retrieves",
"device",
"-",
"specific",
"grains",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L107-L112 | train |
saltstack/salt | salt/grains/napalm.py | username | def username(proxy=None):
'''
Return the username.
.. versionadded:: 2017.7.0
CLI Example - select all devices using `foobar` as username for connection:
.. code-block:: bash
salt -G 'username:foobar' test.ping
Output:
.. code-block::yaml
device1:
True
... | python | def username(proxy=None):
'''
Return the username.
.. versionadded:: 2017.7.0
CLI Example - select all devices using `foobar` as username for connection:
.. code-block:: bash
salt -G 'username:foobar' test.ping
Output:
.. code-block::yaml
device1:
True
... | [
"def",
"username",
"(",
"proxy",
"=",
"None",
")",
":",
"if",
"proxy",
"and",
"salt",
".",
"utils",
".",
"napalm",
".",
"is_proxy",
"(",
"__opts__",
")",
":",
"# only if proxy will override the username",
"# otherwise will use the default Salt grains",
"return",
"{"... | Return the username.
.. versionadded:: 2017.7.0
CLI Example - select all devices using `foobar` as username for connection:
.. code-block:: bash
salt -G 'username:foobar' test.ping
Output:
.. code-block::yaml
device1:
True
device2:
True | [
"Return",
"the",
"username",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L265-L289 | train |
saltstack/salt | salt/grains/napalm.py | host | def host(proxy=None):
'''
This grain is set by the NAPALM grain module
only when running in a proxy minion.
When Salt is installed directly on the network device,
thus running a regular minion, the ``host`` grain
provides the physical hostname of the network device,
as it would be on an ordi... | python | def host(proxy=None):
'''
This grain is set by the NAPALM grain module
only when running in a proxy minion.
When Salt is installed directly on the network device,
thus running a regular minion, the ``host`` grain
provides the physical hostname of the network device,
as it would be on an ordi... | [
"def",
"host",
"(",
"proxy",
"=",
"None",
")",
":",
"if",
"proxy",
"and",
"salt",
".",
"utils",
".",
"napalm",
".",
"is_proxy",
"(",
"__opts__",
")",
":",
"# this grain is set only when running in a proxy minion",
"# otherwise will use the default Salt grains",
"retur... | This grain is set by the NAPALM grain module
only when running in a proxy minion.
When Salt is installed directly on the network device,
thus running a regular minion, the ``host`` grain
provides the physical hostname of the network device,
as it would be on an ordinary minion server.
When runni... | [
"This",
"grain",
"is",
"set",
"by",
"the",
"NAPALM",
"grain",
"module",
"only",
"when",
"running",
"in",
"a",
"proxy",
"minion",
".",
"When",
"Salt",
"is",
"installed",
"directly",
"on",
"the",
"network",
"device",
"thus",
"running",
"a",
"regular",
"minio... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L316-L356 | train |
saltstack/salt | salt/grains/napalm.py | host_dns | def host_dns(proxy=None):
'''
Return the DNS information of the host.
This grain is a dictionary having two keys:
- ``A``
- ``AAAA``
.. note::
This grain is disabled by default, as the proxy startup may be slower
when the lookup fails.
The user can enable it using the `... | python | def host_dns(proxy=None):
'''
Return the DNS information of the host.
This grain is a dictionary having two keys:
- ``A``
- ``AAAA``
.. note::
This grain is disabled by default, as the proxy startup may be slower
when the lookup fails.
The user can enable it using the `... | [
"def",
"host_dns",
"(",
"proxy",
"=",
"None",
")",
":",
"if",
"not",
"__opts__",
".",
"get",
"(",
"'napalm_host_dns_grain'",
",",
"False",
")",
":",
"return",
"device_host",
"=",
"host",
"(",
"proxy",
"=",
"proxy",
")",
"if",
"device_host",
":",
"device_... | Return the DNS information of the host.
This grain is a dictionary having two keys:
- ``A``
- ``AAAA``
.. note::
This grain is disabled by default, as the proxy startup may be slower
when the lookup fails.
The user can enable it using the ``napalm_host_dns_grain`` option (in
... | [
"Return",
"the",
"DNS",
"information",
"of",
"the",
"host",
".",
"This",
"grain",
"is",
"a",
"dictionary",
"having",
"two",
"keys",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L359-L422 | train |
saltstack/salt | salt/grains/napalm.py | optional_args | def optional_args(proxy=None):
'''
Return the connection optional args.
.. note::
Sensible data will not be returned.
.. versionadded:: 2017.7.0
CLI Example - select all devices connecting via port 1234:
.. code-block:: bash
salt -G 'optional_args:port:1234' test.ping
... | python | def optional_args(proxy=None):
'''
Return the connection optional args.
.. note::
Sensible data will not be returned.
.. versionadded:: 2017.7.0
CLI Example - select all devices connecting via port 1234:
.. code-block:: bash
salt -G 'optional_args:port:1234' test.ping
... | [
"def",
"optional_args",
"(",
"proxy",
"=",
"None",
")",
":",
"opt_args",
"=",
"_get_device_grain",
"(",
"'optional_args'",
",",
"proxy",
"=",
"proxy",
")",
"or",
"{",
"}",
"if",
"opt_args",
"and",
"_FORBIDDEN_OPT_ARGS",
":",
"for",
"arg",
"in",
"_FORBIDDEN_O... | Return the connection optional args.
.. note::
Sensible data will not be returned.
.. versionadded:: 2017.7.0
CLI Example - select all devices connecting via port 1234:
.. code-block:: bash
salt -G 'optional_args:port:1234' test.ping
Output:
.. code-block:: yaml
... | [
"Return",
"the",
"connection",
"optional",
"args",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/grains/napalm.py#L425-L454 | train |
saltstack/salt | salt/states/pkgbuild.py | _get_missing_results | def _get_missing_results(results, dest_dir):
'''
Return a list of the filenames specified in the ``results`` argument, which
are not present in the dest_dir.
'''
try:
present = set(os.listdir(dest_dir))
except OSError as exc:
if exc.errno == errno.ENOENT:
log.debug('p... | python | def _get_missing_results(results, dest_dir):
'''
Return a list of the filenames specified in the ``results`` argument, which
are not present in the dest_dir.
'''
try:
present = set(os.listdir(dest_dir))
except OSError as exc:
if exc.errno == errno.ENOENT:
log.debug('p... | [
"def",
"_get_missing_results",
"(",
"results",
",",
"dest_dir",
")",
":",
"try",
":",
"present",
"=",
"set",
"(",
"os",
".",
"listdir",
"(",
"dest_dir",
")",
")",
"except",
"OSError",
"as",
"exc",
":",
"if",
"exc",
".",
"errno",
"==",
"errno",
".",
"... | Return a list of the filenames specified in the ``results`` argument, which
are not present in the dest_dir. | [
"Return",
"a",
"list",
"of",
"the",
"filenames",
"specified",
"in",
"the",
"results",
"argument",
"which",
"are",
"not",
"present",
"in",
"the",
"dest_dir",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkgbuild.py#L57-L70 | train |
saltstack/salt | salt/states/pkgbuild.py | built | def built(name,
runas,
dest_dir,
spec,
sources,
tgt,
template=None,
deps=None,
env=None,
results=None,
force=False,
saltenv='base',
log_dir='/var/log/salt/pkgbuild'):
'''
Ensure that the named... | python | def built(name,
runas,
dest_dir,
spec,
sources,
tgt,
template=None,
deps=None,
env=None,
results=None,
force=False,
saltenv='base',
log_dir='/var/log/salt/pkgbuild'):
'''
Ensure that the named... | [
"def",
"built",
"(",
"name",
",",
"runas",
",",
"dest_dir",
",",
"spec",
",",
"sources",
",",
"tgt",
",",
"template",
"=",
"None",
",",
"deps",
"=",
"None",
",",
"env",
"=",
"None",
",",
"results",
"=",
"None",
",",
"force",
"=",
"False",
",",
"s... | Ensure that the named package is built and exists in the named directory
name
The name to track the build, the name value is otherwise unused
runas
The user to run the build process as
dest_dir
The directory on the minion to place the built package(s)
spec
The locatio... | [
"Ensure",
"that",
"the",
"named",
"package",
"is",
"built",
"and",
"exists",
"in",
"the",
"named",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkgbuild.py#L73-L220 | train |
saltstack/salt | salt/states/pkgbuild.py | repo | def repo(name,
keyid=None,
env=None,
use_passphrase=False,
gnupghome='/etc/salt/gpgkeys',
runas='builder',
timeout=15.0):
'''
Make a package repository and optionally sign it and packages present
The name is directory to turn into a repo. This state is ... | python | def repo(name,
keyid=None,
env=None,
use_passphrase=False,
gnupghome='/etc/salt/gpgkeys',
runas='builder',
timeout=15.0):
'''
Make a package repository and optionally sign it and packages present
The name is directory to turn into a repo. This state is ... | [
"def",
"repo",
"(",
"name",
",",
"keyid",
"=",
"None",
",",
"env",
"=",
"None",
",",
"use_passphrase",
"=",
"False",
",",
"gnupghome",
"=",
"'/etc/salt/gpgkeys'",
",",
"runas",
"=",
"'builder'",
",",
"timeout",
"=",
"15.0",
")",
":",
"ret",
"=",
"{",
... | Make a package repository and optionally sign it and packages present
The name is directory to turn into a repo. This state is best used
with onchanges linked to your package building states.
name
The directory to find packages that will be in the repository
keyid
.. versionchanged:: ... | [
"Make",
"a",
"package",
"repository",
"and",
"optionally",
"sign",
"it",
"and",
"packages",
"present"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkgbuild.py#L223-L380 | train |
saltstack/salt | salt/template.py | compile_template | def compile_template(template,
renderers,
default,
blacklist,
whitelist,
saltenv='base',
sls='',
input_data='',
**kwargs):
'''
Take the path to ... | python | def compile_template(template,
renderers,
default,
blacklist,
whitelist,
saltenv='base',
sls='',
input_data='',
**kwargs):
'''
Take the path to ... | [
"def",
"compile_template",
"(",
"template",
",",
"renderers",
",",
"default",
",",
"blacklist",
",",
"whitelist",
",",
"saltenv",
"=",
"'base'",
",",
"sls",
"=",
"''",
",",
"input_data",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"# if any error occurs,... | Take the path to a template and return the high data structure
derived from the template.
Helpers:
:param mask_value:
Mask value for debugging purposes (prevent sensitive information etc)
example: "mask_value="pass*". All "passwd", "password", "pass" will
be masked (as text). | [
"Take",
"the",
"path",
"to",
"a",
"template",
"and",
"return",
"the",
"high",
"data",
"structure",
"derived",
"from",
"the",
"template",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/template.py#L35-L139 | train |
saltstack/salt | salt/template.py | compile_template_str | def compile_template_str(template, renderers, default, blacklist, whitelist):
'''
Take template as a string and return the high data structure
derived from the template.
'''
fn_ = salt.utils.files.mkstemp()
with salt.utils.files.fopen(fn_, 'wb') as ofile:
ofile.write(SLS_ENCODER(template... | python | def compile_template_str(template, renderers, default, blacklist, whitelist):
'''
Take template as a string and return the high data structure
derived from the template.
'''
fn_ = salt.utils.files.mkstemp()
with salt.utils.files.fopen(fn_, 'wb') as ofile:
ofile.write(SLS_ENCODER(template... | [
"def",
"compile_template_str",
"(",
"template",
",",
"renderers",
",",
"default",
",",
"blacklist",
",",
"whitelist",
")",
":",
"fn_",
"=",
"salt",
".",
"utils",
".",
"files",
".",
"mkstemp",
"(",
")",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"... | Take template as a string and return the high data structure
derived from the template. | [
"Take",
"template",
"as",
"a",
"string",
"and",
"return",
"the",
"high",
"data",
"structure",
"derived",
"from",
"the",
"template",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/template.py#L142-L150 | train |
saltstack/salt | salt/template.py | template_shebang | def template_shebang(template, renderers, default, blacklist, whitelist, input_data):
'''
Check the template shebang line and return the list of renderers specified
in the pipe.
Example shebang lines::
#!yaml_jinja
#!yaml_mako
#!mako|yaml
#!jinja|yaml
#!jinja|mako|yaml
... | python | def template_shebang(template, renderers, default, blacklist, whitelist, input_data):
'''
Check the template shebang line and return the list of renderers specified
in the pipe.
Example shebang lines::
#!yaml_jinja
#!yaml_mako
#!mako|yaml
#!jinja|yaml
#!jinja|mako|yaml
... | [
"def",
"template_shebang",
"(",
"template",
",",
"renderers",
",",
"default",
",",
"blacklist",
",",
"whitelist",
",",
"input_data",
")",
":",
"line",
"=",
"''",
"# Open up the first line of the sls template",
"if",
"template",
"==",
"':string:'",
":",
"line",
"="... | Check the template shebang line and return the list of renderers specified
in the pipe.
Example shebang lines::
#!yaml_jinja
#!yaml_mako
#!mako|yaml
#!jinja|yaml
#!jinja|mako|yaml
#!mako|yaml|stateconf
#!jinja|yaml|stateconf
#!mako|yaml_odict
#!mako|yaml_o... | [
"Check",
"the",
"template",
"shebang",
"line",
"and",
"return",
"the",
"list",
"of",
"renderers",
"specified",
"in",
"the",
"pipe",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/template.py#L153-L186 | train |
saltstack/salt | salt/template.py | check_render_pipe_str | def check_render_pipe_str(pipestr, renderers, blacklist, whitelist):
'''
Check that all renderers specified in the pipe string are available.
If so, return the list of render functions in the pipe as
(render_func, arg_str) tuples; otherwise return [].
'''
if pipestr is None:
return []
... | python | def check_render_pipe_str(pipestr, renderers, blacklist, whitelist):
'''
Check that all renderers specified in the pipe string are available.
If so, return the list of render functions in the pipe as
(render_func, arg_str) tuples; otherwise return [].
'''
if pipestr is None:
return []
... | [
"def",
"check_render_pipe_str",
"(",
"pipestr",
",",
"renderers",
",",
"blacklist",
",",
"whitelist",
")",
":",
"if",
"pipestr",
"is",
"None",
":",
"return",
"[",
"]",
"parts",
"=",
"[",
"r",
".",
"strip",
"(",
")",
"for",
"r",
"in",
"pipestr",
".",
... | Check that all renderers specified in the pipe string are available.
If so, return the list of render functions in the pipe as
(render_func, arg_str) tuples; otherwise return []. | [
"Check",
"that",
"all",
"renderers",
"specified",
"in",
"the",
"pipe",
"string",
"are",
"available",
".",
"If",
"so",
"return",
"the",
"list",
"of",
"render",
"functions",
"in",
"the",
"pipe",
"as",
"(",
"render_func",
"arg_str",
")",
"tuples",
";",
"other... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/template.py#L208-L237 | train |
saltstack/salt | salt/modules/solaris_system.py | init | def init(state):
'''
Change the system runlevel on sysV compatible systems
CLI Example:
state : string
Init state
.. code-block:: bash
salt '*' system.init 3
.. note:
state 0
Stop the operating system.
state 1
State 1 is referred to ... | python | def init(state):
'''
Change the system runlevel on sysV compatible systems
CLI Example:
state : string
Init state
.. code-block:: bash
salt '*' system.init 3
.. note:
state 0
Stop the operating system.
state 1
State 1 is referred to ... | [
"def",
"init",
"(",
"state",
")",
":",
"cmd",
"=",
"[",
"'shutdown'",
",",
"'-i'",
",",
"state",
",",
"'-g'",
",",
"'0'",
",",
"'-y'",
"]",
"ret",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
",",
"python_shell",
"=",
"False",
")",
"return",... | Change the system runlevel on sysV compatible systems
CLI Example:
state : string
Init state
.. code-block:: bash
salt '*' system.init 3
.. note:
state 0
Stop the operating system.
state 1
State 1 is referred to as the administrative state. ... | [
"Change",
"the",
"system",
"runlevel",
"on",
"sysV",
"compatible",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_system.py#L47-L95 | train |
saltstack/salt | salt/modules/solaris_system.py | reboot | def reboot(delay=0, message=None):
'''
Reboot the system
delay : int
Optional wait time in seconds before the system will be rebooted.
message : string
Optional message to broadcast before rebooting.
CLI Example:
.. code-block:: bash
salt '*' system.reboot
sal... | python | def reboot(delay=0, message=None):
'''
Reboot the system
delay : int
Optional wait time in seconds before the system will be rebooted.
message : string
Optional message to broadcast before rebooting.
CLI Example:
.. code-block:: bash
salt '*' system.reboot
sal... | [
"def",
"reboot",
"(",
"delay",
"=",
"0",
",",
"message",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'shutdown'",
",",
"'-i'",
",",
"'6'",
",",
"'-g'",
",",
"delay",
",",
"'-y'",
"]",
"if",
"message",
":",
"cmd",
".",
"append",
"(",
"message",
")",
... | Reboot the system
delay : int
Optional wait time in seconds before the system will be rebooted.
message : string
Optional message to broadcast before rebooting.
CLI Example:
.. code-block:: bash
salt '*' system.reboot
salt '*' system.reboot 60 "=== system upgraded ===... | [
"Reboot",
"the",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solaris_system.py#L111-L131 | train |
saltstack/salt | salt/modules/twilio_notify.py | _get_twilio | def _get_twilio(profile):
'''
Return the twilio connection
'''
creds = __salt__['config.option'](profile)
client = TwilioRestClient(
creds.get('twilio.account_sid'),
creds.get('twilio.auth_token'),
)
return client | python | def _get_twilio(profile):
'''
Return the twilio connection
'''
creds = __salt__['config.option'](profile)
client = TwilioRestClient(
creds.get('twilio.account_sid'),
creds.get('twilio.auth_token'),
)
return client | [
"def",
"_get_twilio",
"(",
"profile",
")",
":",
"creds",
"=",
"__salt__",
"[",
"'config.option'",
"]",
"(",
"profile",
")",
"client",
"=",
"TwilioRestClient",
"(",
"creds",
".",
"get",
"(",
"'twilio.account_sid'",
")",
",",
"creds",
".",
"get",
"(",
"'twil... | Return the twilio connection | [
"Return",
"the",
"twilio",
"connection"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/twilio_notify.py#L57-L67 | train |
saltstack/salt | salt/modules/twilio_notify.py | send_sms | def send_sms(profile, body, to, from_):
'''
Send an sms
CLI Example:
twilio.send_sms twilio-account 'Test sms' '+18019999999' '+18011111111'
'''
ret = {}
ret['message'] = {}
ret['message']['sid'] = None
client = _get_twilio(profile)
try:
if TWILIO_5:
mes... | python | def send_sms(profile, body, to, from_):
'''
Send an sms
CLI Example:
twilio.send_sms twilio-account 'Test sms' '+18019999999' '+18011111111'
'''
ret = {}
ret['message'] = {}
ret['message']['sid'] = None
client = _get_twilio(profile)
try:
if TWILIO_5:
mes... | [
"def",
"send_sms",
"(",
"profile",
",",
"body",
",",
"to",
",",
"from_",
")",
":",
"ret",
"=",
"{",
"}",
"ret",
"[",
"'message'",
"]",
"=",
"{",
"}",
"ret",
"[",
"'message'",
"]",
"[",
"'sid'",
"]",
"=",
"None",
"client",
"=",
"_get_twilio",
"(",... | Send an sms
CLI Example:
twilio.send_sms twilio-account 'Test sms' '+18019999999' '+18011111111' | [
"Send",
"an",
"sms"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/twilio_notify.py#L70-L104 | train |
saltstack/salt | salt/client/ssh/state.py | lowstate_file_refs | def lowstate_file_refs(chunks, extras=''):
'''
Create a list of file ref objects to reconcile
'''
refs = {}
for chunk in chunks:
if not isinstance(chunk, dict):
continue
saltenv = 'base'
crefs = []
for state in chunk:
if state == '__env__':
... | python | def lowstate_file_refs(chunks, extras=''):
'''
Create a list of file ref objects to reconcile
'''
refs = {}
for chunk in chunks:
if not isinstance(chunk, dict):
continue
saltenv = 'base'
crefs = []
for state in chunk:
if state == '__env__':
... | [
"def",
"lowstate_file_refs",
"(",
"chunks",
",",
"extras",
"=",
"''",
")",
":",
"refs",
"=",
"{",
"}",
"for",
"chunk",
"in",
"chunks",
":",
"if",
"not",
"isinstance",
"(",
"chunk",
",",
"dict",
")",
":",
"continue",
"saltenv",
"=",
"'base'",
"crefs",
... | Create a list of file ref objects to reconcile | [
"Create",
"a",
"list",
"of",
"file",
"ref",
"objects",
"to",
"reconcile"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/state.py#L122-L148 | train |
saltstack/salt | salt/client/ssh/state.py | salt_refs | def salt_refs(data, ret=None):
'''
Pull salt file references out of the states
'''
proto = 'salt://'
if ret is None:
ret = []
if isinstance(data, six.string_types):
if data.startswith(proto) and data not in ret:
ret.append(data)
if isinstance(data, list):
... | python | def salt_refs(data, ret=None):
'''
Pull salt file references out of the states
'''
proto = 'salt://'
if ret is None:
ret = []
if isinstance(data, six.string_types):
if data.startswith(proto) and data not in ret:
ret.append(data)
if isinstance(data, list):
... | [
"def",
"salt_refs",
"(",
"data",
",",
"ret",
"=",
"None",
")",
":",
"proto",
"=",
"'salt://'",
"if",
"ret",
"is",
"None",
":",
"ret",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"data",
",",
"six",
".",
"string_types",
")",
":",
"if",
"data",
".",
"s... | Pull salt file references out of the states | [
"Pull",
"salt",
"file",
"references",
"out",
"of",
"the",
"states"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/state.py#L151-L167 | train |
saltstack/salt | salt/client/ssh/state.py | prep_trans_tar | def prep_trans_tar(file_client, chunks, file_refs, pillar=None, id_=None, roster_grains=None):
'''
Generate the execution package from the saltenv file refs and a low state
data structure
'''
gendir = tempfile.mkdtemp()
trans_tar = salt.utils.files.mkstemp()
lowfn = os.path.join(gendir, 'low... | python | def prep_trans_tar(file_client, chunks, file_refs, pillar=None, id_=None, roster_grains=None):
'''
Generate the execution package from the saltenv file refs and a low state
data structure
'''
gendir = tempfile.mkdtemp()
trans_tar = salt.utils.files.mkstemp()
lowfn = os.path.join(gendir, 'low... | [
"def",
"prep_trans_tar",
"(",
"file_client",
",",
"chunks",
",",
"file_refs",
",",
"pillar",
"=",
"None",
",",
"id_",
"=",
"None",
",",
"roster_grains",
"=",
"None",
")",
":",
"gendir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"trans_tar",
"=",
"salt",... | Generate the execution package from the saltenv file refs and a low state
data structure | [
"Generate",
"the",
"execution",
"package",
"from",
"the",
"saltenv",
"file",
"refs",
"and",
"a",
"low",
"state",
"data",
"structure"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/state.py#L170-L259 | train |
saltstack/salt | salt/client/ssh/state.py | SSHState.load_modules | def load_modules(self, data=None, proxy=None):
'''
Load up the modules for remote compilation via ssh
'''
self.functions = self.wrapper
self.utils = salt.loader.utils(self.opts)
self.serializers = salt.loader.serializers(self.opts)
locals_ = salt.loader.minion_mod... | python | def load_modules(self, data=None, proxy=None):
'''
Load up the modules for remote compilation via ssh
'''
self.functions = self.wrapper
self.utils = salt.loader.utils(self.opts)
self.serializers = salt.loader.serializers(self.opts)
locals_ = salt.loader.minion_mod... | [
"def",
"load_modules",
"(",
"self",
",",
"data",
"=",
"None",
",",
"proxy",
"=",
"None",
")",
":",
"self",
".",
"functions",
"=",
"self",
".",
"wrapper",
"self",
".",
"utils",
"=",
"salt",
".",
"loader",
".",
"utils",
"(",
"self",
".",
"opts",
")",... | Load up the modules for remote compilation via ssh | [
"Load",
"up",
"the",
"modules",
"for",
"remote",
"compilation",
"via",
"ssh"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/state.py#L43-L52 | train |
saltstack/salt | salt/client/ssh/state.py | SSHHighState._master_tops | def _master_tops(self):
'''
Evaluate master_tops locally
'''
if 'id' not in self.opts:
log.error('Received call for external nodes without an id')
return {}
if not salt.utils.verify.valid_id(self.opts, self.opts['id']):
return {}
# Eval... | python | def _master_tops(self):
'''
Evaluate master_tops locally
'''
if 'id' not in self.opts:
log.error('Received call for external nodes without an id')
return {}
if not salt.utils.verify.valid_id(self.opts, self.opts['id']):
return {}
# Eval... | [
"def",
"_master_tops",
"(",
"self",
")",
":",
"if",
"'id'",
"not",
"in",
"self",
".",
"opts",
":",
"log",
".",
"error",
"(",
"'Received call for external nodes without an id'",
")",
"return",
"{",
"}",
"if",
"not",
"salt",
".",
"utils",
".",
"verify",
".",... | Evaluate master_tops locally | [
"Evaluate",
"master_tops",
"locally"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/state.py#L92-L119 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | get_api_versions | def get_api_versions(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Get a resource type api versions
'''
if kwargs is None:
kwargs = {}
if 'resource_provider' not in kwargs:
raise SaltCloudSystemExit(
'A resource_provider must be specified'
)
... | python | def get_api_versions(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Get a resource type api versions
'''
if kwargs is None:
kwargs = {}
if 'resource_provider' not in kwargs:
raise SaltCloudSystemExit(
'A resource_provider must be specified'
)
... | [
"def",
"get_api_versions",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"'resource_provider'",
"not",
"in",
"kwargs",
":",
"raise",
"Sal... | Get a resource type api versions | [
"Get",
"a",
"resource",
"type",
"api",
"versions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L157-L189 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | get_resource_by_id | def get_resource_by_id(resource_id, api_version, extract_value=None):
'''
Get an AzureARM resource by id
'''
ret = {}
try:
resconn = get_conn(client_type='resource')
resource_query = resconn.resources.get_by_id(
resource_id=resource_id,
api_version=api_versio... | python | def get_resource_by_id(resource_id, api_version, extract_value=None):
'''
Get an AzureARM resource by id
'''
ret = {}
try:
resconn = get_conn(client_type='resource')
resource_query = resconn.resources.get_by_id(
resource_id=resource_id,
api_version=api_versio... | [
"def",
"get_resource_by_id",
"(",
"resource_id",
",",
"api_version",
",",
"extract_value",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"try",
":",
"resconn",
"=",
"get_conn",
"(",
"client_type",
"=",
"'resource'",
")",
"resource_query",
"=",
"resconn",
".",... | Get an AzureARM resource by id | [
"Get",
"an",
"AzureARM",
"resource",
"by",
"id"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L192-L213 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | get_configured_provider | def get_configured_provider():
'''
Return the first configured provider instance.
'''
def __is_provider_configured(opts, provider, required_keys=()):
'''
Check if the provider is configured.
'''
if ':' in provider:
alias, driver = provider.split(':')
... | python | def get_configured_provider():
'''
Return the first configured provider instance.
'''
def __is_provider_configured(opts, provider, required_keys=()):
'''
Check if the provider is configured.
'''
if ':' in provider:
alias, driver = provider.split(':')
... | [
"def",
"get_configured_provider",
"(",
")",
":",
"def",
"__is_provider_configured",
"(",
"opts",
",",
"provider",
",",
"required_keys",
"=",
"(",
")",
")",
":",
"'''\n Check if the provider is configured.\n '''",
"if",
"':'",
"in",
"provider",
":",
"alia... | Return the first configured provider instance. | [
"Return",
"the",
"first",
"configured",
"provider",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L216-L275 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | get_conn | def get_conn(client_type):
'''
Return a connection object for a client type.
'''
conn_kwargs = {}
conn_kwargs['subscription_id'] = salt.utils.stringutils.to_str(
config.get_cloud_config_value(
'subscription_id',
get_configured_provider(), __opts__, search_global=Fals... | python | def get_conn(client_type):
'''
Return a connection object for a client type.
'''
conn_kwargs = {}
conn_kwargs['subscription_id'] = salt.utils.stringutils.to_str(
config.get_cloud_config_value(
'subscription_id',
get_configured_provider(), __opts__, search_global=Fals... | [
"def",
"get_conn",
"(",
"client_type",
")",
":",
"conn_kwargs",
"=",
"{",
"}",
"conn_kwargs",
"[",
"'subscription_id'",
"]",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_str",
"(",
"config",
".",
"get_cloud_config_value",
"(",
"'subscription_id'",
"... | Return a connection object for a client type. | [
"Return",
"a",
"connection",
"object",
"for",
"a",
"client",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L288-L342 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | get_location | def get_location(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Return the location that is configured for this provider
'''
if not kwargs:
kwargs = {}
vm_dict = get_configured_provider()
vm_dict.update(kwargs)
return config.get_cloud_config_value(
'location'... | python | def get_location(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Return the location that is configured for this provider
'''
if not kwargs:
kwargs = {}
vm_dict = get_configured_provider()
vm_dict.update(kwargs)
return config.get_cloud_config_value(
'location'... | [
"def",
"get_location",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"kwargs",
":",
"kwargs",
"=",
"{",
"}",
"vm_dict",
"=",
"get_configured_provider",
"(",
")",
"vm_dict",
".",
"update",
"(... | Return the location that is configured for this provider | [
"Return",
"the",
"location",
"that",
"is",
"configured",
"for",
"this",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L345-L356 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | avail_locations | def avail_locations(call=None):
'''
Return a dict of all available regions.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
ret = {}
ret['loc... | python | def avail_locations(call=None):
'''
Return a dict of all available regions.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
ret = {}
ret['loc... | [
"def",
"avail_locations",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_locations function must be called with '",
"'-f or --function, or with the --list-locations option'",
")",
"ret",
"=",
"{",
... | Return a dict of all available regions. | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"regions",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L359-L389 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | avail_images | def avail_images(call=None):
'''
Return a dict of all available images on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
compconn = get_co... | python | def avail_images(call=None):
'''
Return a dict of all available images on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
compconn = get_co... | [
"def",
"avail_images",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_images function must be called with '",
"'-f or --function, or with the --list-images option'",
")",
"compconn",
"=",
"get_conn",... | Return a dict of all available images on the provider | [
"Return",
"a",
"dict",
"of",
"all",
"available",
"images",
"on",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L392-L467 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | avail_sizes | def avail_sizes(call=None):
'''
Return a list of sizes available from the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function, or with the --list-sizes option'
)
compconn = get_conn(cl... | python | def avail_sizes(call=None):
'''
Return a list of sizes available from the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function, or with the --list-sizes option'
)
compconn = get_conn(cl... | [
"def",
"avail_sizes",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_sizes function must be called with '",
"'-f or --function, or with the --list-sizes option'",
")",
"compconn",
"=",
"get_conn",
... | Return a list of sizes available from the provider | [
"Return",
"a",
"list",
"of",
"sizes",
"available",
"from",
"the",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L470-L496 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | list_nodes | def list_nodes(call=None):
'''
List VMs on this Azure account
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
nodes = list_nodes_full()
for node in nodes:
ret[node] = {'name':... | python | def list_nodes(call=None):
'''
List VMs on this Azure account
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
nodes = list_nodes_full()
for node in nodes:
ret[node] = {'name':... | [
"def",
"list_nodes",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes function must be called with -f or --function.'",
")",
"ret",
"=",
"{",
"}",
"nodes",
"=",
"list_nodes_full",
"(",
"... | List VMs on this Azure account | [
"List",
"VMs",
"on",
"this",
"Azure",
"account"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L499-L515 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | list_nodes_full | def list_nodes_full(call=None):
'''
List all VMs on the subscription with full information
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or --function.'
)
netapi_versions = get_api_versions(kwargs={
'reso... | python | def list_nodes_full(call=None):
'''
List all VMs on the subscription with full information
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes_full function must be called with -f or --function.'
)
netapi_versions = get_api_versions(kwargs={
'reso... | [
"def",
"list_nodes_full",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes_full function must be called with -f or --function.'",
")",
"netapi_versions",
"=",
"get_api_versions",
"(",
"kwargs",
... | List all VMs on the subscription with full information | [
"List",
"all",
"VMs",
"on",
"the",
"subscription",
"with",
"full",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L518-L600 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | list_resource_groups | def list_resource_groups(call=None):
'''
List resource groups associated with the subscription
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_hosted_services function must be called with '
'-f or --function'
)
resconn = get_conn(client_type='re... | python | def list_resource_groups(call=None):
'''
List resource groups associated with the subscription
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_hosted_services function must be called with '
'-f or --function'
)
resconn = get_conn(client_type='re... | [
"def",
"list_resource_groups",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_hosted_services function must be called with '",
"'-f or --function'",
")",
"resconn",
"=",
"get_conn",
"(",
"client_t... | List resource groups associated with the subscription | [
"List",
"resource",
"groups",
"associated",
"with",
"the",
"subscription"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L603-L625 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | show_instance | def show_instance(name, call=None):
'''
Show the details from AzureARM concerning an instance
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance action must be called with -a or --action.'
)
try:
node = list_nodes_full('function')[name]
exc... | python | def show_instance(name, call=None):
'''
Show the details from AzureARM concerning an instance
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance action must be called with -a or --action.'
)
try:
node = list_nodes_full('function')[name]
exc... | [
"def",
"show_instance",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The show_instance action must be called with -a or --action.'",
")",
"try",
":",
"node",
"=",
"list_nodes_full",
"(",... | Show the details from AzureARM concerning an instance | [
"Show",
"the",
"details",
"from",
"AzureARM",
"concerning",
"an",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L628-L644 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | delete_interface | def delete_interface(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Delete a network interface.
'''
if kwargs is None:
kwargs = {}
netconn = get_conn(client_type='network')
if kwargs.get('resource_group') is None:
kwargs['resource_group'] = config.get_cloud_con... | python | def delete_interface(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Delete a network interface.
'''
if kwargs is None:
kwargs = {}
netconn = get_conn(client_type='network')
if kwargs.get('resource_group') is None:
kwargs['resource_group'] = config.get_cloud_con... | [
"def",
"delete_interface",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"netconn",
"=",
"get_conn",
"(",
"client_type",
"=",
"'network'",
")",... | Delete a network interface. | [
"Delete",
"a",
"network",
"interface",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L647-L680 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | _get_public_ip | def _get_public_ip(name, resource_group):
'''
Get the public ip address details by name.
'''
netconn = get_conn(client_type='network')
try:
pubip_query = netconn.public_ip_addresses.get(
resource_group_name=resource_group,
public_ip_address_name=name
)
... | python | def _get_public_ip(name, resource_group):
'''
Get the public ip address details by name.
'''
netconn = get_conn(client_type='network')
try:
pubip_query = netconn.public_ip_addresses.get(
resource_group_name=resource_group,
public_ip_address_name=name
)
... | [
"def",
"_get_public_ip",
"(",
"name",
",",
"resource_group",
")",
":",
"netconn",
"=",
"get_conn",
"(",
"client_type",
"=",
"'network'",
")",
"try",
":",
"pubip_query",
"=",
"netconn",
".",
"public_ip_addresses",
".",
"get",
"(",
"resource_group_name",
"=",
"r... | Get the public ip address details by name. | [
"Get",
"the",
"public",
"ip",
"address",
"details",
"by",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L683-L698 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | _get_network_interface | def _get_network_interface(name, resource_group):
'''
Get a network interface.
'''
public_ips = []
private_ips = []
netapi_versions = get_api_versions(kwargs={
'resource_provider': 'Microsoft.Network',
'resource_type': 'publicIPAddresses'
}
)
netapi_version = neta... | python | def _get_network_interface(name, resource_group):
'''
Get a network interface.
'''
public_ips = []
private_ips = []
netapi_versions = get_api_versions(kwargs={
'resource_provider': 'Microsoft.Network',
'resource_type': 'publicIPAddresses'
}
)
netapi_version = neta... | [
"def",
"_get_network_interface",
"(",
"name",
",",
"resource_group",
")",
":",
"public_ips",
"=",
"[",
"]",
"private_ips",
"=",
"[",
"]",
"netapi_versions",
"=",
"get_api_versions",
"(",
"kwargs",
"=",
"{",
"'resource_provider'",
":",
"'Microsoft.Network'",
",",
... | Get a network interface. | [
"Get",
"a",
"network",
"interface",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L701-L733 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | create_network_interface | def create_network_interface(call=None, kwargs=None):
'''
Create a network interface.
'''
if call != 'action':
raise SaltCloudSystemExit(
'The create_network_interface action must be called with -a or --action.'
)
# pylint: disable=invalid-name
IPAllocationMethod = g... | python | def create_network_interface(call=None, kwargs=None):
'''
Create a network interface.
'''
if call != 'action':
raise SaltCloudSystemExit(
'The create_network_interface action must be called with -a or --action.'
)
# pylint: disable=invalid-name
IPAllocationMethod = g... | [
"def",
"create_network_interface",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The create_network_interface action must be called with -a or --action.'",
")",
"# pylint: disabl... | Create a network interface. | [
"Create",
"a",
"network",
"interface",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L736-L913 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | request_instance | def request_instance(vm_):
'''
Request a VM from Azure.
'''
compconn = get_conn(client_type='compute')
# pylint: disable=invalid-name
CachingTypes = getattr(
compute_models, 'CachingTypes'
)
# pylint: disable=invalid-name
DataDisk = getattr(
compute_models, 'DataDisk... | python | def request_instance(vm_):
'''
Request a VM from Azure.
'''
compconn = get_conn(client_type='compute')
# pylint: disable=invalid-name
CachingTypes = getattr(
compute_models, 'CachingTypes'
)
# pylint: disable=invalid-name
DataDisk = getattr(
compute_models, 'DataDisk... | [
"def",
"request_instance",
"(",
"vm_",
")",
":",
"compconn",
"=",
"get_conn",
"(",
"client_type",
"=",
"'compute'",
")",
"# pylint: disable=invalid-name",
"CachingTypes",
"=",
"getattr",
"(",
"compute_models",
",",
"'CachingTypes'",
")",
"# pylint: disable=invalid-name"... | Request a VM from Azure. | [
"Request",
"a",
"VM",
"from",
"Azure",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L916-L1377 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | create | def create(vm_):
'''
Create a single VM from a data dict.
'''
try:
if vm_['profile'] and config.is_profile_configured(
__opts__,
__active_provider_name__ or 'azurearm',
vm_['profile'],
vm_=vm_
) is False:
return False
except... | python | def create(vm_):
'''
Create a single VM from a data dict.
'''
try:
if vm_['profile'] and config.is_profile_configured(
__opts__,
__active_provider_name__ or 'azurearm',
vm_['profile'],
vm_=vm_
) is False:
return False
except... | [
"def",
"create",
"(",
"vm_",
")",
":",
"try",
":",
"if",
"vm_",
"[",
"'profile'",
"]",
"and",
"config",
".",
"is_profile_configured",
"(",
"__opts__",
",",
"__active_provider_name__",
"or",
"'azurearm'",
",",
"vm_",
"[",
"'profile'",
"]",
",",
"vm_",
"=",
... | Create a single VM from a data dict. | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1380-L1492 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | destroy | def destroy(name, call=None, kwargs=None): # pylint: disable=unused-argument
'''
Destroy a VM.
CLI Examples:
.. code-block:: bash
salt-cloud -d myminion
salt-cloud -a destroy myminion service_name=myservice
'''
if kwargs is None:
kwargs = {}
if call == 'function'... | python | def destroy(name, call=None, kwargs=None): # pylint: disable=unused-argument
'''
Destroy a VM.
CLI Examples:
.. code-block:: bash
salt-cloud -d myminion
salt-cloud -a destroy myminion service_name=myservice
'''
if kwargs is None:
kwargs = {}
if call == 'function'... | [
"def",
"destroy",
"(",
"name",
",",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystem... | Destroy a VM.
CLI Examples:
.. code-block:: bash
salt-cloud -d myminion
salt-cloud -a destroy myminion service_name=myservice | [
"Destroy",
"a",
"VM",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1495-L1651 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | list_storage_accounts | def list_storage_accounts(call=None):
'''
List storage accounts within the subscription.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_storage_accounts function must be called with '
'-f or --function'
)
storconn = get_conn(client_type='storag... | python | def list_storage_accounts(call=None):
'''
List storage accounts within the subscription.
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_storage_accounts function must be called with '
'-f or --function'
)
storconn = get_conn(client_type='storag... | [
"def",
"list_storage_accounts",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_storage_accounts function must be called with '",
"'-f or --function'",
")",
"storconn",
"=",
"get_conn",
"(",
"clien... | List storage accounts within the subscription. | [
"List",
"storage",
"accounts",
"within",
"the",
"subscription",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1654-L1676 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | _get_cloud_environment | def _get_cloud_environment():
'''
Get the cloud environment object.
'''
cloud_environment = config.get_cloud_config_value(
'cloud_environment',
get_configured_provider(), __opts__, search_global=False
)
try:
clou... | python | def _get_cloud_environment():
'''
Get the cloud environment object.
'''
cloud_environment = config.get_cloud_config_value(
'cloud_environment',
get_configured_provider(), __opts__, search_global=False
)
try:
clou... | [
"def",
"_get_cloud_environment",
"(",
")",
":",
"cloud_environment",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'cloud_environment'",
",",
"get_configured_provider",
"(",
")",
",",
"__opts__",
",",
"search_global",
"=",
"False",
")",
"try",
":",
"cloud_env_... | Get the cloud environment object. | [
"Get",
"the",
"cloud",
"environment",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1679-L1695 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | _get_block_blob_service | def _get_block_blob_service(kwargs=None):
'''
Get the block blob storage service.
'''
resource_group = kwargs.get('resource_group') or config.get_cloud_config_value(
'resource_group',
get_configured_provider(), __opts__, search_global=False
... | python | def _get_block_blob_service(kwargs=None):
'''
Get the block blob storage service.
'''
resource_group = kwargs.get('resource_group') or config.get_cloud_config_value(
'resource_group',
get_configured_provider(), __opts__, search_global=False
... | [
"def",
"_get_block_blob_service",
"(",
"kwargs",
"=",
"None",
")",
":",
"resource_group",
"=",
"kwargs",
".",
"get",
"(",
"'resource_group'",
")",
"or",
"config",
".",
"get_cloud_config_value",
"(",
"'resource_group'",
",",
"get_configured_provider",
"(",
")",
","... | Get the block blob storage service. | [
"Get",
"the",
"block",
"blob",
"storage",
"service",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1698-L1741 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | list_blobs | def list_blobs(call=None, kwargs=None): # pylint: disable=unused-argument
'''
List blobs.
'''
if kwargs is None:
kwargs = {}
if 'container' not in kwargs:
raise SaltCloudSystemExit(
'A container must be specified'
)
storageservice = _get_block_blob_service(... | python | def list_blobs(call=None, kwargs=None): # pylint: disable=unused-argument
'''
List blobs.
'''
if kwargs is None:
kwargs = {}
if 'container' not in kwargs:
raise SaltCloudSystemExit(
'A container must be specified'
)
storageservice = _get_block_blob_service(... | [
"def",
"list_blobs",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"'container'",
"not",
"in",
"kwargs",
":",
"raise",
"SaltCloudSystemEx... | List blobs. | [
"List",
"blobs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1744-L1769 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | delete_blob | def delete_blob(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Delete a blob from a container.
'''
if kwargs is None:
kwargs = {}
if 'container' not in kwargs:
raise SaltCloudSystemExit(
'A container must be specified'
)
if 'blob' not in kwa... | python | def delete_blob(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Delete a blob from a container.
'''
if kwargs is None:
kwargs = {}
if 'container' not in kwargs:
raise SaltCloudSystemExit(
'A container must be specified'
)
if 'blob' not in kwa... | [
"def",
"delete_blob",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"'container'",
"not",
"in",
"kwargs",
":",
"raise",
"SaltCloudSystemE... | Delete a blob from a container. | [
"Delete",
"a",
"blob",
"from",
"a",
"container",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1772-L1792 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | delete_managed_disk | def delete_managed_disk(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Delete a managed disk from a resource group.
'''
compconn = get_conn(client_type='compute')
try:
compconn.disks.delete(kwargs['resource_group'], kwargs['blob'])
except Exception as exc:
log.... | python | def delete_managed_disk(call=None, kwargs=None): # pylint: disable=unused-argument
'''
Delete a managed disk from a resource group.
'''
compconn = get_conn(client_type='compute')
try:
compconn.disks.delete(kwargs['resource_group'], kwargs['blob'])
except Exception as exc:
log.... | [
"def",
"delete_managed_disk",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"compconn",
"=",
"get_conn",
"(",
"client_type",
"=",
"'compute'",
")",
"try",
":",
"compconn",
".",
"disks",
".",
"delete",
"(",... | Delete a managed disk from a resource group. | [
"Delete",
"a",
"managed",
"disk",
"from",
"a",
"resource",
"group",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1795-L1808 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | list_virtual_networks | def list_virtual_networks(call=None, kwargs=None):
'''
List virtual networks.
'''
if kwargs is None:
kwargs = {}
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function'
)
netconn = get_co... | python | def list_virtual_networks(call=None, kwargs=None):
'''
List virtual networks.
'''
if kwargs is None:
kwargs = {}
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function'
)
netconn = get_co... | [
"def",
"list_virtual_networks",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_sizes function m... | List virtual networks. | [
"List",
"virtual",
"networks",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1811-L1842 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | list_subnets | def list_subnets(call=None, kwargs=None):
'''
List subnets in a virtual network.
'''
if kwargs is None:
kwargs = {}
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function'
)
netconn = get... | python | def list_subnets(call=None, kwargs=None):
'''
List subnets in a virtual network.
'''
if kwargs is None:
kwargs = {}
if call == 'action':
raise SaltCloudSystemExit(
'The avail_sizes function must be called with '
'-f or --function'
)
netconn = get... | [
"def",
"list_subnets",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_sizes function must be ca... | List subnets in a virtual network. | [
"List",
"subnets",
"in",
"a",
"virtual",
"network",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1845-L1894 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | create_or_update_vmextension | def create_or_update_vmextension(call=None, kwargs=None): # pylint: disable=unused-argument
'''
.. versionadded:: 2019.2.0
Create or update a VM extension object "inside" of a VM object.
required kwargs:
.. code-block:: yaml
extension_name: myvmextension
virtual_machine_name: m... | python | def create_or_update_vmextension(call=None, kwargs=None): # pylint: disable=unused-argument
'''
.. versionadded:: 2019.2.0
Create or update a VM extension object "inside" of a VM object.
required kwargs:
.. code-block:: yaml
extension_name: myvmextension
virtual_machine_name: m... | [
"def",
"create_or_update_vmextension",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"if",
"'extension_name'",
"not",
"in",
"kwargs",
":",
"raise... | .. versionadded:: 2019.2.0
Create or update a VM extension object "inside" of a VM object.
required kwargs:
.. code-block:: yaml
extension_name: myvmextension
virtual_machine_name: myvm
settings: {"commandToExecute": "hostname"}
optional kwargs:
.. code-block:: yaml
... | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L1897-L2000 | train |
saltstack/salt | salt/cloud/clouds/azurearm.py | stop | def stop(name, call=None):
'''
.. versionadded:: 2019.2.0
Stop (deallocate) a VM
CLI Examples:
.. code-block:: bash
salt-cloud -a stop myminion
'''
if call == 'function':
raise SaltCloudSystemExit(
'The stop action must be called with -a or --action.'
... | python | def stop(name, call=None):
'''
.. versionadded:: 2019.2.0
Stop (deallocate) a VM
CLI Examples:
.. code-block:: bash
salt-cloud -a stop myminion
'''
if call == 'function':
raise SaltCloudSystemExit(
'The stop action must be called with -a or --action.'
... | [
"def",
"stop",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The stop action must be called with -a or --action.'",
")",
"compconn",
"=",
"get_conn",
"(",
"client_type",
"=",
"'comput... | .. versionadded:: 2019.2.0
Stop (deallocate) a VM
CLI Examples:
.. code-block:: bash
salt-cloud -a stop myminion | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/azurearm.py#L2003-L2061 | train |
saltstack/salt | salt/states/powerpath.py | license_present | def license_present(name):
'''
Ensures that the specified PowerPath license key is present
on the host.
name
The license key to ensure is present
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
if not __salt__['powerpath.has_... | python | def license_present(name):
'''
Ensures that the specified PowerPath license key is present
on the host.
name
The license key to ensure is present
'''
ret = {'name': name,
'changes': {},
'result': False,
'comment': ''}
if not __salt__['powerpath.has_... | [
"def",
"license_present",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"if",
"not",
"__salt__",
"[",
"'powerpath.has_powerpath'",
"]",
"... | Ensures that the specified PowerPath license key is present
on the host.
name
The license key to ensure is present | [
"Ensures",
"that",
"the",
"specified",
"PowerPath",
"license",
"key",
"is",
"present",
"on",
"the",
"host",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/powerpath.py#L19-L58 | train |
saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | _create_rpmmacros | def _create_rpmmacros(runas='root'):
'''
Create the .rpmmacros file in user's home directory
'''
home = os.path.expanduser('~')
rpmbuilddir = os.path.join(home, 'rpmbuild')
if not os.path.isdir(rpmbuilddir):
__salt__['file.makedirs_perms'](name=rpmbuilddir, user=runas, group='mock')
... | python | def _create_rpmmacros(runas='root'):
'''
Create the .rpmmacros file in user's home directory
'''
home = os.path.expanduser('~')
rpmbuilddir = os.path.join(home, 'rpmbuild')
if not os.path.isdir(rpmbuilddir):
__salt__['file.makedirs_perms'](name=rpmbuilddir, user=runas, group='mock')
... | [
"def",
"_create_rpmmacros",
"(",
"runas",
"=",
"'root'",
")",
":",
"home",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",
")",
"rpmbuilddir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"home",
",",
"'rpmbuild'",
")",
"if",
"not",
"os",
".",
... | Create the .rpmmacros file in user's home directory | [
"Create",
"the",
".",
"rpmmacros",
"file",
"in",
"user",
"s",
"home",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L72-L93 | train |
saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | _mk_tree | def _mk_tree(runas='root'):
'''
Create the rpm build tree
'''
basedir = tempfile.mkdtemp()
paths = ['BUILD', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS']
for path in paths:
full = os.path.join(basedir, path)
__salt__['file.makedirs_perms'](name=full, user=runas, group='mock')
return ... | python | def _mk_tree(runas='root'):
'''
Create the rpm build tree
'''
basedir = tempfile.mkdtemp()
paths = ['BUILD', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS']
for path in paths:
full = os.path.join(basedir, path)
__salt__['file.makedirs_perms'](name=full, user=runas, group='mock')
return ... | [
"def",
"_mk_tree",
"(",
"runas",
"=",
"'root'",
")",
":",
"basedir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"paths",
"=",
"[",
"'BUILD'",
",",
"'RPMS'",
",",
"'SOURCES'",
",",
"'SPECS'",
",",
"'SRPMS'",
"]",
"for",
"path",
"in",
"paths",
":",
"fu... | Create the rpm build tree | [
"Create",
"the",
"rpm",
"build",
"tree"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L96-L105 | train |
saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | _get_spec | def _get_spec(tree_base, spec, template, saltenv='base'):
'''
Get the spec file and place it in the SPECS dir
'''
spec_tgt = os.path.basename(spec)
dest = os.path.join(tree_base, 'SPECS', spec_tgt)
return __salt__['cp.get_url'](
spec,
dest,
saltenv=saltenv) | python | def _get_spec(tree_base, spec, template, saltenv='base'):
'''
Get the spec file and place it in the SPECS dir
'''
spec_tgt = os.path.basename(spec)
dest = os.path.join(tree_base, 'SPECS', spec_tgt)
return __salt__['cp.get_url'](
spec,
dest,
saltenv=saltenv) | [
"def",
"_get_spec",
"(",
"tree_base",
",",
"spec",
",",
"template",
",",
"saltenv",
"=",
"'base'",
")",
":",
"spec_tgt",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"spec",
")",
"dest",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tree_base",
",",
... | Get the spec file and place it in the SPECS dir | [
"Get",
"the",
"spec",
"file",
"and",
"place",
"it",
"in",
"the",
"SPECS",
"dir"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L108-L117 | train |
saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | _get_distset | def _get_distset(tgt):
'''
Get the distribution string for use with rpmbuild and mock
'''
# Centos adds 'centos' string to rpm names, removing that to have
# consistent naming on Centos and Redhat, and allow for Amazon naming
tgtattrs = tgt.split('-')
if tgtattrs[0] == 'amzn':
distse... | python | def _get_distset(tgt):
'''
Get the distribution string for use with rpmbuild and mock
'''
# Centos adds 'centos' string to rpm names, removing that to have
# consistent naming on Centos and Redhat, and allow for Amazon naming
tgtattrs = tgt.split('-')
if tgtattrs[0] == 'amzn':
distse... | [
"def",
"_get_distset",
"(",
"tgt",
")",
":",
"# Centos adds 'centos' string to rpm names, removing that to have",
"# consistent naming on Centos and Redhat, and allow for Amazon naming",
"tgtattrs",
"=",
"tgt",
".",
"split",
"(",
"'-'",
")",
"if",
"tgtattrs",
"[",
"0",
"]",
... | Get the distribution string for use with rpmbuild and mock | [
"Get",
"the",
"distribution",
"string",
"for",
"use",
"with",
"rpmbuild",
"and",
"mock"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L134-L148 | train |
saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | _get_deps | def _get_deps(deps, tree_base, saltenv='base'):
'''
Get include string for list of dependent rpms to build package
'''
deps_list = ''
if deps is None:
return deps_list
if not isinstance(deps, list):
raise SaltInvocationError(
'\'deps\' must be a Python list or comma-s... | python | def _get_deps(deps, tree_base, saltenv='base'):
'''
Get include string for list of dependent rpms to build package
'''
deps_list = ''
if deps is None:
return deps_list
if not isinstance(deps, list):
raise SaltInvocationError(
'\'deps\' must be a Python list or comma-s... | [
"def",
"_get_deps",
"(",
"deps",
",",
"tree_base",
",",
"saltenv",
"=",
"'base'",
")",
":",
"deps_list",
"=",
"''",
"if",
"deps",
"is",
"None",
":",
"return",
"deps_list",
"if",
"not",
"isinstance",
"(",
"deps",
",",
"list",
")",
":",
"raise",
"SaltInv... | Get include string for list of dependent rpms to build package | [
"Get",
"include",
"string",
"for",
"list",
"of",
"dependent",
"rpms",
"to",
"build",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L151-L173 | train |
saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | make_src_pkg | def make_src_pkg(dest_dir, spec, sources, env=None, template=None, saltenv='base', runas='root'):
'''
Create a source rpm from the given spec file and sources
CLI Example:
.. code-block:: bash
salt '*' pkgbuild.make_src_pkg /var/www/html/
https://raw.githubusercontent.com/salt... | python | def make_src_pkg(dest_dir, spec, sources, env=None, template=None, saltenv='base', runas='root'):
'''
Create a source rpm from the given spec file and sources
CLI Example:
.. code-block:: bash
salt '*' pkgbuild.make_src_pkg /var/www/html/
https://raw.githubusercontent.com/salt... | [
"def",
"make_src_pkg",
"(",
"dest_dir",
",",
"spec",
",",
"sources",
",",
"env",
"=",
"None",
",",
"template",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
",",
"runas",
"=",
"'root'",
")",
":",
"_create_rpmmacros",
"(",
"runas",
")",
"tree_base",
"=",
... | Create a source rpm from the given spec file and sources
CLI Example:
.. code-block:: bash
salt '*' pkgbuild.make_src_pkg /var/www/html/
https://raw.githubusercontent.com/saltstack/libnacl/master/pkg/rpm/python-libnacl.spec
https://pypi.python.org/packages/source/l/lib... | [
"Create",
"a",
"source",
"rpm",
"from",
"the",
"given",
"spec",
"file",
"and",
"sources"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L176-L257 | train |
saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | build | def build(runas,
tgt,
dest_dir,
spec,
sources,
deps,
env,
template,
saltenv='base',
log_dir='/var/log/salt/pkgbuild'):
'''
Given the package destination directory, the spec file source and package
sources, use mock to ... | python | def build(runas,
tgt,
dest_dir,
spec,
sources,
deps,
env,
template,
saltenv='base',
log_dir='/var/log/salt/pkgbuild'):
'''
Given the package destination directory, the spec file source and package
sources, use mock to ... | [
"def",
"build",
"(",
"runas",
",",
"tgt",
",",
"dest_dir",
",",
"spec",
",",
"sources",
",",
"deps",
",",
"env",
",",
"template",
",",
"saltenv",
"=",
"'base'",
",",
"log_dir",
"=",
"'/var/log/salt/pkgbuild'",
")",
":",
"ret",
"=",
"{",
"}",
"try",
"... | Given the package destination directory, the spec file source and package
sources, use mock to safely build the rpm defined in the spec file
CLI Example:
.. code-block:: bash
salt '*' pkgbuild.build mock epel-7-x86_64 /var/www/html
https://raw.githubusercontent.com/saltstack/l... | [
"Given",
"the",
"package",
"destination",
"directory",
"the",
"spec",
"file",
"source",
"and",
"package",
"sources",
"use",
"mock",
"to",
"safely",
"build",
"the",
"rpm",
"defined",
"in",
"the",
"spec",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L260-L374 | train |
saltstack/salt | salt/modules/rpmbuild_pkgbuild.py | make_repo | def make_repo(repodir,
keyid=None,
env=None,
use_passphrase=False,
gnupghome='/etc/salt/gpgkeys',
runas='root',
timeout=15.0):
'''
Make a package repository and optionally sign packages present
Given the repodir, create a `... | python | def make_repo(repodir,
keyid=None,
env=None,
use_passphrase=False,
gnupghome='/etc/salt/gpgkeys',
runas='root',
timeout=15.0):
'''
Make a package repository and optionally sign packages present
Given the repodir, create a `... | [
"def",
"make_repo",
"(",
"repodir",
",",
"keyid",
"=",
"None",
",",
"env",
"=",
"None",
",",
"use_passphrase",
"=",
"False",
",",
"gnupghome",
"=",
"'/etc/salt/gpgkeys'",
",",
"runas",
"=",
"'root'",
",",
"timeout",
"=",
"15.0",
")",
":",
"SIGN_PROMPT_RE",... | Make a package repository and optionally sign packages present
Given the repodir, create a ``yum`` repository out of the rpms therein
and optionally sign it and packages present, the name is directory to
turn into a repo. This state is best used with onchanges linked to
your package building states.
... | [
"Make",
"a",
"package",
"repository",
"and",
"optionally",
"sign",
"packages",
"present"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rpmbuild_pkgbuild.py#L377-L595 | train |
saltstack/salt | salt/output/no_return.py | NestDisplay.display | def display(self, ret, indent, prefix, out):
'''
Recursively iterate down through data structures to determine output
'''
if isinstance(ret, six.string_types):
lines = ret.split('\n')
for line in lines:
out += '{0}{1}{2}{3}{4}\n'.format(
... | python | def display(self, ret, indent, prefix, out):
'''
Recursively iterate down through data structures to determine output
'''
if isinstance(ret, six.string_types):
lines = ret.split('\n')
for line in lines:
out += '{0}{1}{2}{3}{4}\n'.format(
... | [
"def",
"display",
"(",
"self",
",",
"ret",
",",
"indent",
",",
"prefix",
",",
"out",
")",
":",
"if",
"isinstance",
"(",
"ret",
",",
"six",
".",
"string_types",
")",
":",
"lines",
"=",
"ret",
".",
"split",
"(",
"'\\n'",
")",
"for",
"line",
"in",
"... | Recursively iterate down through data structures to determine output | [
"Recursively",
"iterate",
"down",
"through",
"data",
"structures",
"to",
"determine",
"output"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/no_return.py#L33-L56 | train |
saltstack/salt | salt/engines/thorium.py | start | def start(grains=False, grain_keys=None, pillar=False, pillar_keys=None):
'''
Execute the Thorium runtime
'''
state = salt.thorium.ThorState(
__opts__,
grains,
grain_keys,
pillar,
pillar_keys)
state.start_runtime() | python | def start(grains=False, grain_keys=None, pillar=False, pillar_keys=None):
'''
Execute the Thorium runtime
'''
state = salt.thorium.ThorState(
__opts__,
grains,
grain_keys,
pillar,
pillar_keys)
state.start_runtime() | [
"def",
"start",
"(",
"grains",
"=",
"False",
",",
"grain_keys",
"=",
"None",
",",
"pillar",
"=",
"False",
",",
"pillar_keys",
"=",
"None",
")",
":",
"state",
"=",
"salt",
".",
"thorium",
".",
"ThorState",
"(",
"__opts__",
",",
"grains",
",",
"grain_key... | Execute the Thorium runtime | [
"Execute",
"the",
"Thorium",
"runtime"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/thorium.py#L11-L21 | train |
saltstack/salt | salt/proxy/junos.py | init | def init(opts):
'''
Open the connection to the Junos device, login, and bind to the
Resource class
'''
opts['multiprocessing'] = False
log.debug('Opening connection to junos')
args = {"host": opts['proxy']['host']}
optional_args = ['user',
'username',
... | python | def init(opts):
'''
Open the connection to the Junos device, login, and bind to the
Resource class
'''
opts['multiprocessing'] = False
log.debug('Opening connection to junos')
args = {"host": opts['proxy']['host']}
optional_args = ['user',
'username',
... | [
"def",
"init",
"(",
"opts",
")",
":",
"opts",
"[",
"'multiprocessing'",
"]",
"=",
"False",
"log",
".",
"debug",
"(",
"'Opening connection to junos'",
")",
"args",
"=",
"{",
"\"host\"",
":",
"opts",
"[",
"'proxy'",
"]",
"[",
"'host'",
"]",
"}",
"optional_... | Open the connection to the Junos device, login, and bind to the
Resource class | [
"Open",
"the",
"connection",
"to",
"the",
"Junos",
"device",
"login",
"and",
"bind",
"to",
"the",
"Resource",
"class"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/junos.py#L76-L134 | train |
saltstack/salt | salt/proxy/junos.py | alive | def alive(opts):
'''
Validate and return the connection status with the remote device.
.. versionadded:: 2018.3.0
'''
dev = conn()
thisproxy['conn'].connected = ping()
if not dev.connected:
__salt__['event.fire_master']({}, 'junos/proxy/{}/stop'.format(
opts['proxy'][... | python | def alive(opts):
'''
Validate and return the connection status with the remote device.
.. versionadded:: 2018.3.0
'''
dev = conn()
thisproxy['conn'].connected = ping()
if not dev.connected:
__salt__['event.fire_master']({}, 'junos/proxy/{}/stop'.format(
opts['proxy'][... | [
"def",
"alive",
"(",
"opts",
")",
":",
"dev",
"=",
"conn",
"(",
")",
"thisproxy",
"[",
"'conn'",
"]",
".",
"connected",
"=",
"ping",
"(",
")",
"if",
"not",
"dev",
".",
"connected",
":",
"__salt__",
"[",
"'event.fire_master'",
"]",
"(",
"{",
"}",
",... | Validate and return the connection status with the remote device.
.. versionadded:: 2018.3.0 | [
"Validate",
"and",
"return",
"the",
"connection",
"status",
"with",
"the",
"remote",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/junos.py#L145-L159 | train |
saltstack/salt | salt/proxy/junos.py | ping | def ping():
'''
Ping? Pong!
'''
dev = conn()
# Check that the underlying netconf connection still exists.
if dev._conn is None:
return False
# call rpc only if ncclient queue is empty. If not empty that means other
# rpc call is going on.
if hasattr(dev._conn, '_session'):... | python | def ping():
'''
Ping? Pong!
'''
dev = conn()
# Check that the underlying netconf connection still exists.
if dev._conn is None:
return False
# call rpc only if ncclient queue is empty. If not empty that means other
# rpc call is going on.
if hasattr(dev._conn, '_session'):... | [
"def",
"ping",
"(",
")",
":",
"dev",
"=",
"conn",
"(",
")",
"# Check that the underlying netconf connection still exists.",
"if",
"dev",
".",
"_conn",
"is",
"None",
":",
"return",
"False",
"# call rpc only if ncclient queue is empty. If not empty that means other",
"# rpc c... | Ping? Pong! | [
"Ping?",
"Pong!"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/junos.py#L162-L189 | train |
saltstack/salt | salt/utils/iam.py | _retry_get_url | def _retry_get_url(url, num_retries=10, timeout=5):
'''
Retry grabbing a URL.
Based heavily on boto.utils.retry_url
'''
for i in range(0, num_retries):
try:
result = requests.get(url, timeout=timeout, proxies={'http': ''})
if hasattr(result, 'text'):
r... | python | def _retry_get_url(url, num_retries=10, timeout=5):
'''
Retry grabbing a URL.
Based heavily on boto.utils.retry_url
'''
for i in range(0, num_retries):
try:
result = requests.get(url, timeout=timeout, proxies={'http': ''})
if hasattr(result, 'text'):
r... | [
"def",
"_retry_get_url",
"(",
"url",
",",
"num_retries",
"=",
"10",
",",
"timeout",
"=",
"5",
")",
":",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"num_retries",
")",
":",
"try",
":",
"result",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"timeout"... | Retry grabbing a URL.
Based heavily on boto.utils.retry_url | [
"Retry",
"grabbing",
"a",
"URL",
".",
"Based",
"heavily",
"on",
"boto",
".",
"utils",
".",
"retry_url"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/iam.py#L26-L53 | train |
saltstack/salt | salt/utils/iam.py | _convert_key_to_str | def _convert_key_to_str(key):
'''
Stolen completely from boto.providers
'''
# IMPORTANT: on PY2, the secret key must be str and not unicode to work
# properly with hmac.new (see http://bugs.python.org/issue5285)
#
# pylint: disable=incompatible-py3-code,undefined-variable
return salt.uti... | python | def _convert_key_to_str(key):
'''
Stolen completely from boto.providers
'''
# IMPORTANT: on PY2, the secret key must be str and not unicode to work
# properly with hmac.new (see http://bugs.python.org/issue5285)
#
# pylint: disable=incompatible-py3-code,undefined-variable
return salt.uti... | [
"def",
"_convert_key_to_str",
"(",
"key",
")",
":",
"# IMPORTANT: on PY2, the secret key must be str and not unicode to work",
"# properly with hmac.new (see http://bugs.python.org/issue5285)",
"#",
"# pylint: disable=incompatible-py3-code,undefined-variable",
"return",
"salt",
".",
"utils... | Stolen completely from boto.providers | [
"Stolen",
"completely",
"from",
"boto",
".",
"providers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/iam.py#L56-L66 | train |
saltstack/salt | salt/cli/caller.py | BaseCaller.print_docs | def print_docs(self):
'''
Pick up the documentation for all of the modules and print it out.
'''
docs = {}
for name, func in six.iteritems(self.minion.functions):
if name not in docs:
if func.__doc__:
docs[name] = func.__doc__
... | python | def print_docs(self):
'''
Pick up the documentation for all of the modules and print it out.
'''
docs = {}
for name, func in six.iteritems(self.minion.functions):
if name not in docs:
if func.__doc__:
docs[name] = func.__doc__
... | [
"def",
"print_docs",
"(",
"self",
")",
":",
"docs",
"=",
"{",
"}",
"for",
"name",
",",
"func",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"minion",
".",
"functions",
")",
":",
"if",
"name",
"not",
"in",
"docs",
":",
"if",
"func",
".",
"__do... | Pick up the documentation for all of the modules and print it out. | [
"Pick",
"up",
"the",
"documentation",
"for",
"all",
"of",
"the",
"modules",
"and",
"print",
"it",
"out",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/caller.py#L91-L102 | train |
saltstack/salt | salt/cli/caller.py | BaseCaller.print_grains | def print_grains(self):
'''
Print out the grains
'''
grains = self.minion.opts.get('grains') or salt.loader.grains(self.opts)
salt.output.display_output({'local': grains}, 'grains', self.opts) | python | def print_grains(self):
'''
Print out the grains
'''
grains = self.minion.opts.get('grains') or salt.loader.grains(self.opts)
salt.output.display_output({'local': grains}, 'grains', self.opts) | [
"def",
"print_grains",
"(",
"self",
")",
":",
"grains",
"=",
"self",
".",
"minion",
".",
"opts",
".",
"get",
"(",
"'grains'",
")",
"or",
"salt",
".",
"loader",
".",
"grains",
"(",
"self",
".",
"opts",
")",
"salt",
".",
"output",
".",
"display_output"... | Print out the grains | [
"Print",
"out",
"the",
"grains"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/caller.py#L104-L109 | train |
saltstack/salt | salt/cli/caller.py | BaseCaller.run | def run(self):
'''
Execute the salt call logic
'''
profiling_enabled = self.opts.get('profiling_enabled', False)
try:
pr = salt.utils.profile.activate_profile(profiling_enabled)
try:
ret = self.call()
finally:
sa... | python | def run(self):
'''
Execute the salt call logic
'''
profiling_enabled = self.opts.get('profiling_enabled', False)
try:
pr = salt.utils.profile.activate_profile(profiling_enabled)
try:
ret = self.call()
finally:
sa... | [
"def",
"run",
"(",
"self",
")",
":",
"profiling_enabled",
"=",
"self",
".",
"opts",
".",
"get",
"(",
"'profiling_enabled'",
",",
"False",
")",
"try",
":",
"pr",
"=",
"salt",
".",
"utils",
".",
"profile",
".",
"activate_profile",
"(",
"profiling_enabled",
... | Execute the salt call logic | [
"Execute",
"the",
"salt",
"call",
"logic"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/caller.py#L111-L142 | train |
saltstack/salt | salt/cli/caller.py | BaseCaller.call | def call(self):
'''
Call the module
'''
ret = {}
fun = self.opts['fun']
ret['jid'] = salt.utils.jid.gen_jid(self.opts)
proc_fn = os.path.join(
salt.minion.get_proc_dir(self.opts['cachedir']),
ret['jid']
)
if fun not in self.... | python | def call(self):
'''
Call the module
'''
ret = {}
fun = self.opts['fun']
ret['jid'] = salt.utils.jid.gen_jid(self.opts)
proc_fn = os.path.join(
salt.minion.get_proc_dir(self.opts['cachedir']),
ret['jid']
)
if fun not in self.... | [
"def",
"call",
"(",
"self",
")",
":",
"ret",
"=",
"{",
"}",
"fun",
"=",
"self",
".",
"opts",
"[",
"'fun'",
"]",
"ret",
"[",
"'jid'",
"]",
"=",
"salt",
".",
"utils",
".",
"jid",
".",
"gen_jid",
"(",
"self",
".",
"opts",
")",
"proc_fn",
"=",
"o... | Call the module | [
"Call",
"the",
"module"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/caller.py#L144-L301 | train |
saltstack/salt | salt/cli/caller.py | ZeroMQCaller.return_pub | def return_pub(self, ret):
'''
Return the data up to the master
'''
channel = salt.transport.client.ReqChannel.factory(self.opts, usage='salt_call')
load = {'cmd': '_return', 'id': self.opts['id']}
for key, value in six.iteritems(ret):
load[key] = value
... | python | def return_pub(self, ret):
'''
Return the data up to the master
'''
channel = salt.transport.client.ReqChannel.factory(self.opts, usage='salt_call')
load = {'cmd': '_return', 'id': self.opts['id']}
for key, value in six.iteritems(ret):
load[key] = value
... | [
"def",
"return_pub",
"(",
"self",
",",
"ret",
")",
":",
"channel",
"=",
"salt",
".",
"transport",
".",
"client",
".",
"ReqChannel",
".",
"factory",
"(",
"self",
".",
"opts",
",",
"usage",
"=",
"'salt_call'",
")",
"load",
"=",
"{",
"'cmd'",
":",
"'_re... | Return the data up to the master | [
"Return",
"the",
"data",
"up",
"to",
"the",
"master"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/caller.py#L308-L319 | train |
saltstack/salt | salt/thorium/local.py | cmd | def cmd(name,
tgt,
func,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
**kwargs):
'''
Execute a remote execution command
USAGE:
.. code-block:: yaml
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.ping
... | python | def cmd(name,
tgt,
func,
arg=(),
tgt_type='glob',
ret='',
kwarg=None,
**kwargs):
'''
Execute a remote execution command
USAGE:
.. code-block:: yaml
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.ping
... | [
"def",
"cmd",
"(",
"name",
",",
"tgt",
",",
"func",
",",
"arg",
"=",
"(",
")",
",",
"tgt_type",
"=",
"'glob'",
",",
"ret",
"=",
"''",
",",
"kwarg",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
... | Execute a remote execution command
USAGE:
.. code-block:: yaml
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.ping
run_remote_ex:
local.cmd:
- tgt: '*'
- func: test.sleep
- arg:
- 30
run... | [
"Execute",
"a",
"remote",
"execution",
"command"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/thorium/local.py#L12-L59 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.