id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
36,100 | saltstack/salt | salt/modules/inspectlib/query.py | Query._get_local_users | def _get_local_users(self, disabled=None):
'''
Return all known local accounts to the system.
'''
users = dict()
path = '/etc/passwd'
with salt.utils.files.fopen(path, 'r') as fp_:
for line in fp_:
line = line.strip()
if ':' not... | python | def _get_local_users(self, disabled=None):
'''
Return all known local accounts to the system.
'''
users = dict()
path = '/etc/passwd'
with salt.utils.files.fopen(path, 'r') as fp_:
for line in fp_:
line = line.strip()
if ':' not... | [
"def",
"_get_local_users",
"(",
"self",
",",
"disabled",
"=",
"None",
")",
":",
"users",
"=",
"dict",
"(",
")",
"path",
"=",
"'/etc/passwd'",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fp_",
":",
... | Return all known local accounts to the system. | [
"Return",
"all",
"known",
"local",
"accounts",
"to",
"the",
"system",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L213-L236 |
36,101 | saltstack/salt | salt/modules/inspectlib/query.py | Query._get_local_groups | def _get_local_groups(self):
'''
Return all known local groups to the system.
'''
groups = dict()
path = '/etc/group'
with salt.utils.files.fopen(path, 'r') as fp_:
for line in fp_:
line = line.strip()
if ':' not in line:
... | python | def _get_local_groups(self):
'''
Return all known local groups to the system.
'''
groups = dict()
path = '/etc/group'
with salt.utils.files.fopen(path, 'r') as fp_:
for line in fp_:
line = line.strip()
if ':' not in line:
... | [
"def",
"_get_local_groups",
"(",
"self",
")",
":",
"groups",
"=",
"dict",
"(",
")",
"path",
"=",
"'/etc/group'",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fp_",
":",
"for",
"line",
"in",
"fp_",
"... | Return all known local groups to the system. | [
"Return",
"all",
"known",
"local",
"groups",
"to",
"the",
"system",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L238-L257 |
36,102 | saltstack/salt | salt/modules/inspectlib/query.py | Query._get_external_accounts | def _get_external_accounts(self, locals):
'''
Return all known accounts, excluding local accounts.
'''
users = dict()
out = __salt__['cmd.run_all']("passwd -S -a")
if out['retcode']:
# System does not supports all accounts descriptions, just skipping.
... | python | def _get_external_accounts(self, locals):
'''
Return all known accounts, excluding local accounts.
'''
users = dict()
out = __salt__['cmd.run_all']("passwd -S -a")
if out['retcode']:
# System does not supports all accounts descriptions, just skipping.
... | [
"def",
"_get_external_accounts",
"(",
"self",
",",
"locals",
")",
":",
"users",
"=",
"dict",
"(",
")",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"\"passwd -S -a\"",
")",
"if",
"out",
"[",
"'retcode'",
"]",
":",
"# System does not supports all acc... | Return all known accounts, excluding local accounts. | [
"Return",
"all",
"known",
"accounts",
"excluding",
"local",
"accounts",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L259-L279 |
36,103 | saltstack/salt | salt/modules/inspectlib/query.py | Query._identity | def _identity(self, *args, **kwargs):
'''
Local users and groups.
accounts
Can be either 'local', 'remote' or 'all' (equal to "local,remote").
Remote accounts cannot be resolved on all systems, but only
those, which supports 'passwd -S -a'.
disabled
... | python | def _identity(self, *args, **kwargs):
'''
Local users and groups.
accounts
Can be either 'local', 'remote' or 'all' (equal to "local,remote").
Remote accounts cannot be resolved on all systems, but only
those, which supports 'passwd -S -a'.
disabled
... | [
"def",
"_identity",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"LOCAL",
"=",
"'local accounts'",
"EXT",
"=",
"'external accounts'",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"LOCAL",
"]",
"=",
"self",
".",
"_get_local_users",
"... | Local users and groups.
accounts
Can be either 'local', 'remote' or 'all' (equal to "local,remote").
Remote accounts cannot be resolved on all systems, but only
those, which supports 'passwd -S -a'.
disabled
True (or False, default) to return only disabl... | [
"Local",
"users",
"and",
"groups",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L281-L301 |
36,104 | saltstack/salt | salt/modules/inspectlib/query.py | Query._system | def _system(self, *args, **kwargs):
'''
This basically calls grains items and picks out only
necessary information in a certain structure.
:param args:
:param kwargs:
:return:
'''
sysinfo = SysInfo(__grains__.get("kernel"))
data = dict()
... | python | def _system(self, *args, **kwargs):
'''
This basically calls grains items and picks out only
necessary information in a certain structure.
:param args:
:param kwargs:
:return:
'''
sysinfo = SysInfo(__grains__.get("kernel"))
data = dict()
... | [
"def",
"_system",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"sysinfo",
"=",
"SysInfo",
"(",
"__grains__",
".",
"get",
"(",
"\"kernel\"",
")",
")",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"'cpu'",
"]",
"=",
"sysinfo",
"... | This basically calls grains items and picks out only
necessary information in a certain structure.
:param args:
:param kwargs:
:return: | [
"This",
"basically",
"calls",
"grains",
"items",
"and",
"picks",
"out",
"only",
"necessary",
"information",
"in",
"a",
"certain",
"structure",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L303-L322 |
36,105 | saltstack/salt | salt/modules/inspectlib/query.py | Query._software | def _software(self, *args, **kwargs):
'''
Return installed software.
'''
data = dict()
if 'exclude' in kwargs:
excludes = kwargs['exclude'].split(",")
else:
excludes = list()
os_family = __grains__.get("os_family").lower()
# Get l... | python | def _software(self, *args, **kwargs):
'''
Return installed software.
'''
data = dict()
if 'exclude' in kwargs:
excludes = kwargs['exclude'].split(",")
else:
excludes = list()
os_family = __grains__.get("os_family").lower()
# Get l... | [
"def",
"_software",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"dict",
"(",
")",
"if",
"'exclude'",
"in",
"kwargs",
":",
"excludes",
"=",
"kwargs",
"[",
"'exclude'",
"]",
".",
"split",
"(",
"\",\"",
")",
"else",
... | Return installed software. | [
"Return",
"installed",
"software",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L324-L376 |
36,106 | saltstack/salt | salt/modules/inspectlib/query.py | Query._id_resolv | def _id_resolv(self, iid, named=True, uid=True):
'''
Resolve local users and groups.
:param iid:
:param named:
:param uid:
:return:
'''
if not self.local_identity:
self.local_identity['users'] = self._get_local_users()
self.local_... | python | def _id_resolv(self, iid, named=True, uid=True):
'''
Resolve local users and groups.
:param iid:
:param named:
:param uid:
:return:
'''
if not self.local_identity:
self.local_identity['users'] = self._get_local_users()
self.local_... | [
"def",
"_id_resolv",
"(",
"self",
",",
"iid",
",",
"named",
"=",
"True",
",",
"uid",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"local_identity",
":",
"self",
".",
"local_identity",
"[",
"'users'",
"]",
"=",
"self",
".",
"_get_local_users",
"(",
... | Resolve local users and groups.
:param iid:
:param named:
:param uid:
:return: | [
"Resolve",
"local",
"users",
"and",
"groups",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L387-L408 |
36,107 | saltstack/salt | salt/modules/inspectlib/query.py | Query._all | def _all(self, *args, **kwargs):
'''
Return all the summary of the particular system.
'''
data = dict()
data['software'] = self._software(**kwargs)
data['system'] = self._system(**kwargs)
data['services'] = self._services(**kwargs)
try:
data['c... | python | def _all(self, *args, **kwargs):
'''
Return all the summary of the particular system.
'''
data = dict()
data['software'] = self._software(**kwargs)
data['system'] = self._system(**kwargs)
data['services'] = self._services(**kwargs)
try:
data['c... | [
"def",
"_all",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"dict",
"(",
")",
"data",
"[",
"'software'",
"]",
"=",
"self",
".",
"_software",
"(",
"*",
"*",
"kwargs",
")",
"data",
"[",
"'system'",
"]",
"=",
"sel... | Return all the summary of the particular system. | [
"Return",
"all",
"the",
"summary",
"of",
"the",
"particular",
"system",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/query.py#L495-L510 |
36,108 | saltstack/salt | salt/modules/smartos_vmadm.py | _create_update_from_file | def _create_update_from_file(mode='create', uuid=None, path=None):
'''
Create vm from file
'''
ret = {}
if not os.path.isfile(path) or path is None:
ret['Error'] = 'File ({0}) does not exists!'.format(path)
return ret
# vmadm validate create|update [-f <filename>]
cmd = 'vmad... | python | def _create_update_from_file(mode='create', uuid=None, path=None):
'''
Create vm from file
'''
ret = {}
if not os.path.isfile(path) or path is None:
ret['Error'] = 'File ({0}) does not exists!'.format(path)
return ret
# vmadm validate create|update [-f <filename>]
cmd = 'vmad... | [
"def",
"_create_update_from_file",
"(",
"mode",
"=",
"'create'",
",",
"uuid",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
"or",
"path",
"is",
"None",
":",
... | Create vm from file | [
"Create",
"vm",
"from",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L64-L107 |
36,109 | saltstack/salt | salt/modules/smartos_vmadm.py | _create_update_from_cfg | def _create_update_from_cfg(mode='create', uuid=None, vmcfg=None):
'''
Create vm from configuration
'''
ret = {}
# write json file
vmadm_json_file = __salt__['temp.file'](prefix='vmadm-')
with salt.utils.files.fopen(vmadm_json_file, 'w') as vmadm_json:
salt.utils.json.dump(vmcfg, vm... | python | def _create_update_from_cfg(mode='create', uuid=None, vmcfg=None):
'''
Create vm from configuration
'''
ret = {}
# write json file
vmadm_json_file = __salt__['temp.file'](prefix='vmadm-')
with salt.utils.files.fopen(vmadm_json_file, 'w') as vmadm_json:
salt.utils.json.dump(vmcfg, vm... | [
"def",
"_create_update_from_cfg",
"(",
"mode",
"=",
"'create'",
",",
"uuid",
"=",
"None",
",",
"vmcfg",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"# write json file",
"vmadm_json_file",
"=",
"__salt__",
"[",
"'temp.file'",
"]",
"(",
"prefix",
"=",
"'vma... | Create vm from configuration | [
"Create",
"vm",
"from",
"configuration"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L110-L161 |
36,110 | saltstack/salt | salt/modules/smartos_vmadm.py | start | def start(vm, options=None, key='uuid'):
'''
Start a vm
vm : string
vm to be started
options : string
optional additional options
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.start 186da9a... | python | def start(vm, options=None, key='uuid'):
'''
Start a vm
vm : string
vm to be started
options : string
optional additional options
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.start 186da9a... | [
"def",
"start",
"(",
"vm",
",",
"options",
"=",
"None",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must b... | Start a vm
vm : string
vm to be started
options : string
optional additional options
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.start 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.... | [
"Start",
"a",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L164-L201 |
36,111 | saltstack/salt | salt/modules/smartos_vmadm.py | lookup | def lookup(search=None, order=None, one=False):
'''
Return a list of VMs using lookup
search : string
vmadm filter property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
one : boolean
return only one result (vmadm's -1)
CLI Example:
... | python | def lookup(search=None, order=None, one=False):
'''
Return a list of VMs using lookup
search : string
vmadm filter property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
one : boolean
return only one result (vmadm's -1)
CLI Example:
... | [
"def",
"lookup",
"(",
"search",
"=",
"None",
",",
"order",
"=",
"None",
",",
"one",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"# vmadm lookup [-j|-1] [-o field,...] [field=value ...]",
"cmd",
"=",
"'vmadm lookup {one} {order} {search}'",
".",
"format",
"(",
... | Return a list of VMs using lookup
search : string
vmadm filter property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
one : boolean
return only one result (vmadm's -1)
CLI Example:
.. code-block:: bash
salt '*' vmadm.lookup search=... | [
"Return",
"a",
"list",
"of",
"VMs",
"using",
"lookup"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L342-L381 |
36,112 | saltstack/salt | salt/modules/smartos_vmadm.py | sysrq | def sysrq(vm, action='nmi', key='uuid'):
'''
Send non-maskable interrupt to vm or capture a screenshot
vm : string
vm to be targeted
action : string
nmi or screenshot -- Default: nmi
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. co... | python | def sysrq(vm, action='nmi', key='uuid'):
'''
Send non-maskable interrupt to vm or capture a screenshot
vm : string
vm to be targeted
action : string
nmi or screenshot -- Default: nmi
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. co... | [
"def",
"sysrq",
"(",
"vm",
",",
"action",
"=",
"'nmi'",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must b... | Send non-maskable interrupt to vm or capture a screenshot
vm : string
vm to be targeted
action : string
nmi or screenshot -- Default: nmi
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.sysrq 186da9a... | [
"Send",
"non",
"-",
"maskable",
"interrupt",
"to",
"vm",
"or",
"capture",
"a",
"screenshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L384-L423 |
36,113 | saltstack/salt | salt/modules/smartos_vmadm.py | delete | def delete(vm, key='uuid'):
'''
Delete a vm
vm : string
vm to be deleted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.delete 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.delete nacl key... | python | def delete(vm, key='uuid'):
'''
Delete a vm
vm : string
vm to be deleted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.delete 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.delete nacl key... | [
"def",
"delete",
"(",
"vm",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be either uuid, alias or hostname'",
... | Delete a vm
vm : string
vm to be deleted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.delete 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.delete nacl key=alias | [
"Delete",
"a",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L426-L456 |
36,114 | saltstack/salt | salt/modules/smartos_vmadm.py | get | def get(vm, key='uuid'):
'''
Output the JSON object describing a VM
vm : string
vm to be targeted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.get 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*'... | python | def get(vm, key='uuid'):
'''
Output the JSON object describing a VM
vm : string
vm to be targeted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.get 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*'... | [
"def",
"get",
"(",
"vm",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be either uuid, alias or hostname'",
"... | Output the JSON object describing a VM
vm : string
vm to be targeted
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.get 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.get nacl key=alias | [
"Output",
"the",
"JSON",
"object",
"describing",
"a",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L459-L489 |
36,115 | saltstack/salt | salt/modules/smartos_vmadm.py | info | def info(vm, info_type='all', key='uuid'):
'''
Lookup info on running kvm
vm : string
vm to be targeted
info_type : string [all|block|blockstats|chardev|cpus|kvm|pci|spice|version|vnc]
info type to return
key : string [uuid|alias|hostname]
value type of 'vm' parameter
C... | python | def info(vm, info_type='all', key='uuid'):
'''
Lookup info on running kvm
vm : string
vm to be targeted
info_type : string [all|block|blockstats|chardev|cpus|kvm|pci|spice|version|vnc]
info type to return
key : string [uuid|alias|hostname]
value type of 'vm' parameter
C... | [
"def",
"info",
"(",
"vm",
",",
"info_type",
"=",
"'all'",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"info_type",
"not",
"in",
"[",
"'all'",
",",
"'block'",
",",
"'blockstats'",
",",
"'chardev'",
",",
"'cpus'",
",",
"'kvm'",
"... | Lookup info on running kvm
vm : string
vm to be targeted
info_type : string [all|block|blockstats|chardev|cpus|kvm|pci|spice|version|vnc]
info type to return
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*'... | [
"Lookup",
"info",
"on",
"running",
"kvm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L492-L532 |
36,116 | saltstack/salt | salt/modules/smartos_vmadm.py | create_snapshot | def create_snapshot(vm, name, key='uuid'):
'''
Create snapshot of a vm
vm : string
vm to be targeted
name : string
snapshot name
The snapname must be 64 characters or less
and must only contain alphanumeric characters and
characters in the set [-_.:%]... | python | def create_snapshot(vm, name, key='uuid'):
'''
Create snapshot of a vm
vm : string
vm to be targeted
name : string
snapshot name
The snapname must be 64 characters or less
and must only contain alphanumeric characters and
characters in the set [-_.:%]... | [
"def",
"create_snapshot",
"(",
"vm",
",",
"name",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be either u... | Create snapshot of a vm
vm : string
vm to be targeted
name : string
snapshot name
The snapname must be 64 characters or less
and must only contain alphanumeric characters and
characters in the set [-_.:%] to comply with ZFS restrictions.
key : string [uui... | [
"Create",
"snapshot",
"of",
"a",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L535-L583 |
36,117 | saltstack/salt | salt/modules/smartos_vmadm.py | reprovision | def reprovision(vm, image, key='uuid'):
'''
Reprovision a vm
vm : string
vm to be reprovisioned
image : string
uuid of new image
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.reprovision 18... | python | def reprovision(vm, image, key='uuid'):
'''
Reprovision a vm
vm : string
vm to be reprovisioned
image : string
uuid of new image
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.reprovision 18... | [
"def",
"reprovision",
"(",
"vm",
",",
"image",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be either uuid... | Reprovision a vm
vm : string
vm to be reprovisioned
image : string
uuid of new image
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.reprovision 186da9ab-7392-4f55-91a5-b8f1fe770543 c02a2044-c1bd-11e... | [
"Reprovision",
"a",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L682-L720 |
36,118 | saltstack/salt | salt/modules/smartos_vmadm.py | create | def create(from_file=None, **kwargs):
'''
Create a new vm
from_file : string
json file to create the vm from -- if present, all other options will be ignored
kwargs : string|int|...
options to set for the vm
CLI Example:
.. code-block:: bash
salt '*' vmadm.create from... | python | def create(from_file=None, **kwargs):
'''
Create a new vm
from_file : string
json file to create the vm from -- if present, all other options will be ignored
kwargs : string|int|...
options to set for the vm
CLI Example:
.. code-block:: bash
salt '*' vmadm.create from... | [
"def",
"create",
"(",
"from_file",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"# prepare vmcfg",
"vmcfg",
"=",
"{",
"}",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",... | Create a new vm
from_file : string
json file to create the vm from -- if present, all other options will be ignored
kwargs : string|int|...
options to set for the vm
CLI Example:
.. code-block:: bash
salt '*' vmadm.create from_file=/tmp/new_vm.json
salt '*' vmadm.crea... | [
"Create",
"a",
"new",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L723-L749 |
36,119 | saltstack/salt | salt/modules/smartos_vmadm.py | update | def update(vm, from_file=None, key='uuid', **kwargs):
'''
Update a new vm
vm : string
vm to be updated
from_file : string
json file to update the vm with -- if present, all other options will be ignored
key : string [uuid|alias|hostname]
value type of 'vm' parameter
kwar... | python | def update(vm, from_file=None, key='uuid', **kwargs):
'''
Update a new vm
vm : string
vm to be updated
from_file : string
json file to update the vm with -- if present, all other options will be ignored
key : string [uuid|alias|hostname]
value type of 'vm' parameter
kwar... | [
"def",
"update",
"(",
"vm",
",",
"from_file",
"=",
"None",
",",
"key",
"=",
"'uuid'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"# prepare vmcfg",
"vmcfg",
"=",
"{",
"}",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clea... | Update a new vm
vm : string
vm to be updated
from_file : string
json file to update the vm with -- if present, all other options will be ignored
key : string [uuid|alias|hostname]
value type of 'vm' parameter
kwargs : string|int|...
options to update for the vm
CLI ... | [
"Update",
"a",
"new",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L752-L790 |
36,120 | saltstack/salt | salt/modules/smartos_vmadm.py | send | def send(vm, target, key='uuid'):
'''
Send a vm to a directory
vm : string
vm to be sent
target : string
target directory
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.send 186da9ab-7392-4f... | python | def send(vm, target, key='uuid'):
'''
Send a vm to a directory
vm : string
vm to be sent
target : string
target directory
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.send 186da9ab-7392-4f... | [
"def",
"send",
"(",
"vm",
",",
"target",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be either uuid, alia... | Send a vm to a directory
vm : string
vm to be sent
target : string
target directory
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.send 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups
salt... | [
"Send",
"a",
"vm",
"to",
"a",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L793-L848 |
36,121 | saltstack/salt | salt/modules/smartos_vmadm.py | receive | def receive(uuid, source):
'''
Receive a vm from a directory
uuid : string
uuid of vm to be received
source : string
source directory
CLI Example:
.. code-block:: bash
salt '*' vmadm.receive 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups
'''
ret = {}
if... | python | def receive(uuid, source):
'''
Receive a vm from a directory
uuid : string
uuid of vm to be received
source : string
source directory
CLI Example:
.. code-block:: bash
salt '*' vmadm.receive 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups
'''
ret = {}
if... | [
"def",
"receive",
"(",
"uuid",
",",
"source",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"source",
")",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Source must be a directory or host'",
"return",
"ret",
"if",
"not",
... | Receive a vm from a directory
uuid : string
uuid of vm to be received
source : string
source directory
CLI Example:
.. code-block:: bash
salt '*' vmadm.receive 186da9ab-7392-4f55-91a5-b8f1fe770543 /opt/backups | [
"Receive",
"a",
"vm",
"from",
"a",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L851-L905 |
36,122 | saltstack/salt | salt/modules/win_dism.py | add_capability | def add_capability(capability,
source=None,
limit_access=False,
image=None,
restart=False):
'''
Install a capability
Args:
capability (str): The capability to install
source (Optional[str]): The optional source of t... | python | def add_capability(capability,
source=None,
limit_access=False,
image=None,
restart=False):
'''
Install a capability
Args:
capability (str): The capability to install
source (Optional[str]): The optional source of t... | [
"def",
"add_capability",
"(",
"capability",
",",
"source",
"=",
"None",
",",
"limit_access",
"=",
"False",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"if",
"salt",
".",
"utils",
".",
"versions",
".",
"version_cmp",
"(",
"__grains_... | Install a capability
Args:
capability (str): The capability to install
source (Optional[str]): The optional source of the capability. Default
is set by group policy and can be Windows Update.
limit_access (Optional[bool]): Prevent DISM from contacting Windows
Update ... | [
"Install",
"a",
"capability"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L48-L98 |
36,123 | saltstack/salt | salt/modules/win_dism.py | remove_capability | def remove_capability(capability, image=None, restart=False):
'''
Uninstall a capability
Args:
capability(str): The capability to be removed
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
... | python | def remove_capability(capability, image=None, restart=False):
'''
Uninstall a capability
Args:
capability(str): The capability to be removed
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
... | [
"def",
"remove_capability",
"(",
"capability",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"if",
"salt",
".",
"utils",
".",
"versions",
".",
"version_cmp",
"(",
"__grains__",
"[",
"'osversion'",
"]",
",",
"'10'",
")",
"==",
"-",
... | Uninstall a capability
Args:
capability(str): The capability to be removed
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
restart (Optional[bool]): Reb... | [
"Uninstall",
"a",
"capability"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L101-L139 |
36,124 | saltstack/salt | salt/modules/win_dism.py | get_capabilities | def get_capabilities(image=None):
'''
List all capabilities on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
NotImplemen... | python | def get_capabilities(image=None):
'''
List all capabilities on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
NotImplemen... | [
"def",
"get_capabilities",
"(",
"image",
"=",
"None",
")",
":",
"if",
"salt",
".",
"utils",
".",
"versions",
".",
"version_cmp",
"(",
"__grains__",
"[",
"'osversion'",
"]",
",",
"'10'",
")",
"==",
"-",
"1",
":",
"raise",
"NotImplementedError",
"(",
"'`in... | List all capabilities on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
NotImplementedError: For all versions of Windows that are... | [
"List",
"all",
"capabilities",
"on",
"the",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L142-L179 |
36,125 | saltstack/salt | salt/modules/win_dism.py | installed_capabilities | def installed_capabilities(image=None):
'''
List the capabilities installed on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
... | python | def installed_capabilities(image=None):
'''
List the capabilities installed on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
... | [
"def",
"installed_capabilities",
"(",
"image",
"=",
"None",
")",
":",
"if",
"salt",
".",
"utils",
".",
"versions",
".",
"version_cmp",
"(",
"__grains__",
"[",
"'osversion'",
"]",
",",
"'10'",
")",
"==",
"-",
"1",
":",
"raise",
"NotImplementedError",
"(",
... | List the capabilities installed on the system
Args:
image (Optional[str]): The path to the root directory of an offline
Windows image. If `None` is passed, the running operating system is
targeted. Default is None.
Raises:
NotImplementedError: For all versions of Window... | [
"List",
"the",
"capabilities",
"installed",
"on",
"the",
"system"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L182-L208 |
36,126 | saltstack/salt | salt/modules/win_dism.py | add_feature | def add_feature(feature,
package=None,
source=None,
limit_access=False,
enable_parent=False,
image=None,
restart=False):
'''
Install a feature using DISM
Args:
feature (str): The feature to install
... | python | def add_feature(feature,
package=None,
source=None,
limit_access=False,
enable_parent=False,
image=None,
restart=False):
'''
Install a feature using DISM
Args:
feature (str): The feature to install
... | [
"def",
"add_feature",
"(",
"feature",
",",
"package",
"=",
"None",
",",
"source",
"=",
"None",
",",
"limit_access",
"=",
"False",
",",
"enable_parent",
"=",
"False",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
... | Install a feature using DISM
Args:
feature (str): The feature to install
package (Optional[str]): The parent package for the feature. You do not
have to specify the package if it is the Windows Foundation Package.
Otherwise, use package to specify the parent package of the f... | [
"Install",
"a",
"feature",
"using",
"DISM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L240-L291 |
36,127 | saltstack/salt | salt/modules/win_dism.py | remove_feature | def remove_feature(feature, remove_payload=False, image=None, restart=False):
'''
Disables the feature.
Args:
feature (str): The feature to uninstall
remove_payload (Optional[bool]): Remove the feature's payload. Must
supply source when enabling in the future.
image (Opt... | python | def remove_feature(feature, remove_payload=False, image=None, restart=False):
'''
Disables the feature.
Args:
feature (str): The feature to uninstall
remove_payload (Optional[bool]): Remove the feature's payload. Must
supply source when enabling in the future.
image (Opt... | [
"def",
"remove_feature",
"(",
"feature",
",",
"remove_payload",
"=",
"False",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"'DISM'",
",",
"'/Quiet'",
",",
"'/Image:{0}'",
".",
"format",
"(",
"image",
")",
"if",
"i... | Disables the feature.
Args:
feature (str): The feature to uninstall
remove_payload (Optional[bool]): Remove the feature's payload. Must
supply source when enabling in the future.
image (Optional[str]): The path to the root directory of an offline
Windows image. If `N... | [
"Disables",
"the",
"feature",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L294-L327 |
36,128 | saltstack/salt | salt/modules/win_dism.py | get_features | def get_features(package=None, image=None):
'''
List features on the system or in a package
Args:
package (Optional[str]): The full path to the package. Can be either a
.cab file or a folder. Should point to the original source of the
package, not to where the file is instal... | python | def get_features(package=None, image=None):
'''
List features on the system or in a package
Args:
package (Optional[str]): The full path to the package. Can be either a
.cab file or a folder. Should point to the original source of the
package, not to where the file is instal... | [
"def",
"get_features",
"(",
"package",
"=",
"None",
",",
"image",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'DISM'",
",",
"'/English'",
",",
"'/Image:{0}'",
".",
"format",
"(",
"image",
")",
"if",
"image",
"else",
"'/Online'",
",",
"'/Get-Features'",
"]",... | List features on the system or in a package
Args:
package (Optional[str]): The full path to the package. Can be either a
.cab file or a folder. Should point to the original source of the
package, not to where the file is installed. You cannot use this
command to get pack... | [
"List",
"features",
"on",
"the",
"system",
"or",
"in",
"a",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L330-L379 |
36,129 | saltstack/salt | salt/modules/win_dism.py | add_package | def add_package(package,
ignore_check=False,
prevent_pending=False,
image=None,
restart=False):
'''
Install a package using DISM
Args:
package (str):
The package to install. Can be a .cab file, a .msu file, or a folder
... | python | def add_package(package,
ignore_check=False,
prevent_pending=False,
image=None,
restart=False):
'''
Install a package using DISM
Args:
package (str):
The package to install. Can be a .cab file, a .msu file, or a folder
... | [
"def",
"add_package",
"(",
"package",
",",
"ignore_check",
"=",
"False",
",",
"prevent_pending",
"=",
"False",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"'DISM'",
",",
"'/Quiet'",
",",
"'/Image:{0}'",
".",
"forma... | Install a package using DISM
Args:
package (str):
The package to install. Can be a .cab file, a .msu file, or a folder
.. note::
An `.msu` package is supported only when the target image is
offline, either mounted or applied.
ignore_check (O... | [
"Install",
"a",
"package",
"using",
"DISM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L424-L477 |
36,130 | saltstack/salt | salt/modules/win_dism.py | package_info | def package_info(package, image=None):
'''
Display information about a package
Args:
package (str): The full path to the package. Can be either a .cab file
or a folder. Should point to the original source of the package, not
to where the file is installed. You cannot use thi... | python | def package_info(package, image=None):
'''
Display information about a package
Args:
package (str): The full path to the package. Can be either a .cab file
or a folder. Should point to the original source of the package, not
to where the file is installed. You cannot use thi... | [
"def",
"package_info",
"(",
"package",
",",
"image",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'DISM'",
",",
"'/English'",
",",
"'/Image:{0}'",
".",
"format",
"(",
"image",
")",
"if",
"image",
"else",
"'/Online'",
",",
"'/Get-PackageInfo'",
"]",
"if",
"'~... | Display information about a package
Args:
package (str): The full path to the package. Can be either a .cab file
or a folder. Should point to the original source of the package, not
to where the file is installed. You cannot use this command to get
package information fo... | [
"Display",
"information",
"about",
"a",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L544-L589 |
36,131 | saltstack/salt | salt/executors/sudo.py | execute | def execute(opts, data, func, args, kwargs):
'''
Allow for the calling of execution modules via sudo.
This module is invoked by the minion if the ``sudo_user`` minion config is
present.
Example minion config:
.. code-block:: yaml
sudo_user: saltdev
Once this setting is made, any... | python | def execute(opts, data, func, args, kwargs):
'''
Allow for the calling of execution modules via sudo.
This module is invoked by the minion if the ``sudo_user`` minion config is
present.
Example minion config:
.. code-block:: yaml
sudo_user: saltdev
Once this setting is made, any... | [
"def",
"execute",
"(",
"opts",
",",
"data",
",",
"func",
",",
"args",
",",
"kwargs",
")",
":",
"cmd",
"=",
"[",
"'sudo'",
",",
"'-u'",
",",
"opts",
".",
"get",
"(",
"'sudo_user'",
")",
",",
"'salt-call'",
",",
"'--out'",
",",
"'json'",
",",
"'--met... | Allow for the calling of execution modules via sudo.
This module is invoked by the minion if the ``sudo_user`` minion config is
present.
Example minion config:
.. code-block:: yaml
sudo_user: saltdev
Once this setting is made, any execution module call done by the minion will be
run... | [
"Allow",
"for",
"the",
"calling",
"of",
"execution",
"modules",
"via",
"sudo",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/executors/sudo.py#L25-L79 |
36,132 | saltstack/salt | salt/states/hg.py | _update_repo | def _update_repo(ret, name, target, clean, user, identity, rev, opts, update_head):
'''
Update the repo to a given revision. Using clean passes -C to the hg up
'''
log.debug('target %s is found, "hg pull && hg up is probably required"', target)
current_rev = __salt__['hg.revision'](target, user=use... | python | def _update_repo(ret, name, target, clean, user, identity, rev, opts, update_head):
'''
Update the repo to a given revision. Using clean passes -C to the hg up
'''
log.debug('target %s is found, "hg pull && hg up is probably required"', target)
current_rev = __salt__['hg.revision'](target, user=use... | [
"def",
"_update_repo",
"(",
"ret",
",",
"name",
",",
"target",
",",
"clean",
",",
"user",
",",
"identity",
",",
"rev",
",",
"opts",
",",
"update_head",
")",
":",
"log",
".",
"debug",
"(",
"'target %s is found, \"hg pull && hg up is probably required\"'",
",",
... | Update the repo to a given revision. Using clean passes -C to the hg up | [
"Update",
"the",
"repo",
"to",
"a",
"given",
"revision",
".",
"Using",
"clean",
"passes",
"-",
"C",
"to",
"the",
"hg",
"up"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/hg.py#L113-L175 |
36,133 | saltstack/salt | salt/modules/zfs.py | exists | def exists(name, **kwargs):
'''
Check if a ZFS filesystem or volume or snapshot exists.
name : string
name of dataset
type : string
also check if dataset is of a certain type, valid choices are:
filesystem, snapshot, volume, bookmark, or all.
.. versionadded:: 2015.5.0
... | python | def exists(name, **kwargs):
'''
Check if a ZFS filesystem or volume or snapshot exists.
name : string
name of dataset
type : string
also check if dataset is of a certain type, valid choices are:
filesystem, snapshot, volume, bookmark, or all.
.. versionadded:: 2015.5.0
... | [
"def",
"exists",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"opts",
"=",
"{",
"}",
"# NOTE: set extra config from kwargs",
"if",
"kwargs",
".",
"get",
"(",
"'type'",
",",
"False",
")",
":",
"opts",
... | Check if a ZFS filesystem or volume or snapshot exists.
name : string
name of dataset
type : string
also check if dataset is of a certain type, valid choices are:
filesystem, snapshot, volume, bookmark, or all.
.. versionadded:: 2015.5.0
CLI Example:
.. code-block:: bash
... | [
"Check",
"if",
"a",
"ZFS",
"filesystem",
"or",
"volume",
"or",
"snapshot",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L48-L87 |
36,134 | saltstack/salt | salt/modules/zfs.py | create | def create(name, **kwargs):
'''
Create a ZFS File System.
name : string
name of dataset or volume
volume_size : string
if specified, a zvol will be created instead of a dataset
sparse : boolean
create sparse volume
create_parent : boolean
creates all the non-exis... | python | def create(name, **kwargs):
'''
Create a ZFS File System.
name : string
name of dataset or volume
volume_size : string
if specified, a zvol will be created instead of a dataset
sparse : boolean
create sparse volume
create_parent : boolean
creates all the non-exis... | [
"def",
"create",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"]",
"opts",
"=",
"{",
"}",
"# NOTE: push filesystem properties",
"filesystem_properties",
"=",
"kwargs",
".",
"get",
"("... | Create a ZFS File System.
name : string
name of dataset or volume
volume_size : string
if specified, a zvol will be created instead of a dataset
sparse : boolean
create sparse volume
create_parent : boolean
creates all the non-existing parent datasets. any property speci... | [
"Create",
"a",
"ZFS",
"File",
"System",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L90-L154 |
36,135 | saltstack/salt | salt/modules/zfs.py | destroy | def destroy(name, **kwargs):
'''
Destroy a ZFS File System.
name : string
name of dataset, volume, or snapshot
force : boolean
force an unmount of any file systems using the unmount -f command.
recursive : boolean
recursively destroy all children. (-r)
recursive_all : bo... | python | def destroy(name, **kwargs):
'''
Destroy a ZFS File System.
name : string
name of dataset, volume, or snapshot
force : boolean
force an unmount of any file systems using the unmount -f command.
recursive : boolean
recursively destroy all children. (-r)
recursive_all : bo... | [
"def",
"destroy",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"]",
"# NOTE: set extra config from kwargs",
"if",
"kwargs",
".",
"get",
"(",
"'force'",
",",
"False",
")",
":",
"flag... | Destroy a ZFS File System.
name : string
name of dataset, volume, or snapshot
force : boolean
force an unmount of any file systems using the unmount -f command.
recursive : boolean
recursively destroy all children. (-r)
recursive_all : boolean
recursively destroy all dep... | [
"Destroy",
"a",
"ZFS",
"File",
"System",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L157-L205 |
36,136 | saltstack/salt | salt/modules/zfs.py | rename | def rename(name, new_name, **kwargs):
'''
Rename or Relocate a ZFS File System.
name : string
name of dataset, volume, or snapshot
new_name : string
new name of dataset, volume, or snapshot
force : boolean
force unmount any filesystems that need to be unmounted in the proces... | python | def rename(name, new_name, **kwargs):
'''
Rename or Relocate a ZFS File System.
name : string
name of dataset, volume, or snapshot
new_name : string
new name of dataset, volume, or snapshot
force : boolean
force unmount any filesystems that need to be unmounted in the proces... | [
"def",
"rename",
"(",
"name",
",",
"new_name",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"]",
"target",
"=",
"[",
"]",
"# NOTE: set extra config from kwargs",
"if",
"__utils__",
"[",
"'zfs.is_s... | Rename or Relocate a ZFS File System.
name : string
name of dataset, volume, or snapshot
new_name : string
new name of dataset, volume, or snapshot
force : boolean
force unmount any filesystems that need to be unmounted in the process.
create_parent : boolean
creates all... | [
"Rename",
"or",
"Relocate",
"a",
"ZFS",
"File",
"System",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L208-L270 |
36,137 | saltstack/salt | salt/modules/zfs.py | list_ | def list_(name=None, **kwargs):
'''
Return a list of all datasets or a specified dataset on the system and the
values of their used, available, referenced, and mountpoint properties.
name : string
name of dataset, volume, or snapshot
recursive : boolean
recursively list children
... | python | def list_(name=None, **kwargs):
'''
Return a list of all datasets or a specified dataset on the system and the
values of their used, available, referenced, and mountpoint properties.
name : string
name of dataset, volume, or snapshot
recursive : boolean
recursively list children
... | [
"def",
"list_",
"(",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"OrderedDict",
"(",
")",
"## update properties",
"# NOTE: properties should be a list",
"properties",
"=",
"kwargs",
".",
"get",
"(",
"'properties'",
",",
"'used,avail,refer... | Return a list of all datasets or a specified dataset on the system and the
values of their used, available, referenced, and mountpoint properties.
name : string
name of dataset, volume, or snapshot
recursive : boolean
recursively list children
depth : int
limit recursion to dept... | [
"Return",
"a",
"list",
"of",
"all",
"datasets",
"or",
"a",
"specified",
"dataset",
"on",
"the",
"system",
"and",
"the",
"values",
"of",
"their",
"used",
"available",
"referenced",
"and",
"mountpoint",
"properties",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L273-L374 |
36,138 | saltstack/salt | salt/modules/zfs.py | list_mount | def list_mount():
'''
List mounted zfs filesystems
.. versionadded:: 2018.3.1
CLI Example:
.. code-block:: bash
salt '*' zfs.list_mount
'''
## List mounted filesystem
res = __salt__['cmd.run_all'](
__utils__['zfs.zfs_command'](
command='mount',
),... | python | def list_mount():
'''
List mounted zfs filesystems
.. versionadded:: 2018.3.1
CLI Example:
.. code-block:: bash
salt '*' zfs.list_mount
'''
## List mounted filesystem
res = __salt__['cmd.run_all'](
__utils__['zfs.zfs_command'](
command='mount',
),... | [
"def",
"list_mount",
"(",
")",
":",
"## List mounted filesystem",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"__utils__",
"[",
"'zfs.zfs_command'",
"]",
"(",
"command",
"=",
"'mount'",
",",
")",
",",
"python_shell",
"=",
"False",
",",
")",
"if",... | List mounted zfs filesystems
.. versionadded:: 2018.3.1
CLI Example:
.. code-block:: bash
salt '*' zfs.list_mount | [
"List",
"mounted",
"zfs",
"filesystems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L377-L405 |
36,139 | saltstack/salt | salt/modules/zfs.py | mount | def mount(name=None, **kwargs):
'''
Mounts ZFS file systems
name : string
name of the filesystem, having this set to None will mount all filesystems. (this is the default)
overlay : boolean
perform an overlay mount.
options : string
optional comma-separated list of mount opt... | python | def mount(name=None, **kwargs):
'''
Mounts ZFS file systems
name : string
name of the filesystem, having this set to None will mount all filesystems. (this is the default)
overlay : boolean
perform an overlay mount.
options : string
optional comma-separated list of mount opt... | [
"def",
"mount",
"(",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"]",
"opts",
"=",
"{",
"}",
"# NOTE: set extra config from kwargs",
"if",
"kwargs",
".",
"get",
"(",
"'ov... | Mounts ZFS file systems
name : string
name of the filesystem, having this set to None will mount all filesystems. (this is the default)
overlay : boolean
perform an overlay mount.
options : string
optional comma-separated list of mount options to use temporarily for
the dura... | [
"Mounts",
"ZFS",
"file",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L408-L471 |
36,140 | saltstack/salt | salt/modules/zfs.py | unmount | def unmount(name, **kwargs):
'''
Unmounts ZFS file systems
name : string
name of the filesystem, you can use None to unmount all mounted filesystems.
force : boolean
forcefully unmount the file system, even if it is currently in use.
.. warning::
Using ``-a`` for the name ... | python | def unmount(name, **kwargs):
'''
Unmounts ZFS file systems
name : string
name of the filesystem, you can use None to unmount all mounted filesystems.
force : boolean
forcefully unmount the file system, even if it is currently in use.
.. warning::
Using ``-a`` for the name ... | [
"def",
"unmount",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"]",
"# NOTE: set extra config from kwargs",
"if",
"kwargs",
".",
"get",
"(",
"'force'",
",",
"False",
")",
":",
"flag... | Unmounts ZFS file systems
name : string
name of the filesystem, you can use None to unmount all mounted filesystems.
force : boolean
forcefully unmount the file system, even if it is currently in use.
.. warning::
Using ``-a`` for the name parameter will probably break your system... | [
"Unmounts",
"ZFS",
"file",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L474-L525 |
36,141 | saltstack/salt | salt/modules/zfs.py | inherit | def inherit(prop, name, **kwargs):
'''
Clears the specified property
prop : string
name of property
name : string
name of the filesystem, volume, or snapshot
recursive : boolean
recursively inherit the given property for all children.
revert : boolean
revert the ... | python | def inherit(prop, name, **kwargs):
'''
Clears the specified property
prop : string
name of property
name : string
name of the filesystem, volume, or snapshot
recursive : boolean
recursively inherit the given property for all children.
revert : boolean
revert the ... | [
"def",
"inherit",
"(",
"prop",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"]",
"# NOTE: set extra config from kwargs",
"if",
"kwargs",
".",
"get",
"(",
"'recursive'",
",",
"False",
... | Clears the specified property
prop : string
name of property
name : string
name of the filesystem, volume, or snapshot
recursive : boolean
recursively inherit the given property for all children.
revert : boolean
revert the property to the received value if one exists; o... | [
"Clears",
"the",
"specified",
"property"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L528-L572 |
36,142 | saltstack/salt | salt/modules/zfs.py | diff | def diff(name_a, name_b=None, **kwargs):
'''
Display the difference between a snapshot of a given filesystem and
another snapshot of that filesystem from a later time or the current
contents of the filesystem.
name_a : string
name of snapshot
name_b : string
(optional) name of s... | python | def diff(name_a, name_b=None, **kwargs):
'''
Display the difference between a snapshot of a given filesystem and
another snapshot of that filesystem from a later time or the current
contents of the filesystem.
name_a : string
name of snapshot
name_b : string
(optional) name of s... | [
"def",
"diff",
"(",
"name_a",
",",
"name_b",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"'-H'",
"]",
"target",
"=",
"[",
"]",
"# NOTE: set extra config from kwargs",
"if",
"kwargs... | Display the difference between a snapshot of a given filesystem and
another snapshot of that filesystem from a later time or the current
contents of the filesystem.
name_a : string
name of snapshot
name_b : string
(optional) name of snapshot or filesystem
show_changetime : boolean
... | [
"Display",
"the",
"difference",
"between",
"a",
"snapshot",
"of",
"a",
"given",
"filesystem",
"and",
"another",
"snapshot",
"of",
"that",
"filesystem",
"from",
"a",
"later",
"time",
"or",
"the",
"current",
"contents",
"of",
"the",
"filesystem",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L575-L639 |
36,143 | saltstack/salt | salt/modules/zfs.py | rollback | def rollback(name, **kwargs):
'''
Roll back the given dataset to a previous snapshot.
name : string
name of snapshot
recursive : boolean
destroy any snapshots and bookmarks more recent than the one
specified.
recursive_all : boolean
destroy any more recent snapshots ... | python | def rollback(name, **kwargs):
'''
Roll back the given dataset to a previous snapshot.
name : string
name of snapshot
recursive : boolean
destroy any snapshots and bookmarks more recent than the one
specified.
recursive_all : boolean
destroy any more recent snapshots ... | [
"def",
"rollback",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"]",
"# NOTE: set extra config from kwargs",
"if",
"kwargs",
".",
"get",
"(",
"'recursive_all'",
",",
"False",
")",
":"... | Roll back the given dataset to a previous snapshot.
name : string
name of snapshot
recursive : boolean
destroy any snapshots and bookmarks more recent than the one
specified.
recursive_all : boolean
destroy any more recent snapshots and bookmarks, as well as any
clon... | [
"Roll",
"back",
"the",
"given",
"dataset",
"to",
"a",
"previous",
"snapshot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L642-L702 |
36,144 | saltstack/salt | salt/modules/zfs.py | clone | def clone(name_a, name_b, **kwargs):
'''
Creates a clone of the given snapshot.
name_a : string
name of snapshot
name_b : string
name of filesystem or volume
create_parent : boolean
creates all the non-existing parent datasets. any property specified on the
command l... | python | def clone(name_a, name_b, **kwargs):
'''
Creates a clone of the given snapshot.
name_a : string
name of snapshot
name_b : string
name of filesystem or volume
create_parent : boolean
creates all the non-existing parent datasets. any property specified on the
command l... | [
"def",
"clone",
"(",
"name_a",
",",
"name_b",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"]",
"target",
"=",
"[",
"]",
"# NOTE: push filesystem properties",
"filesystem_properties",
"=",
"kwargs",... | Creates a clone of the given snapshot.
name_a : string
name of snapshot
name_b : string
name of filesystem or volume
create_parent : boolean
creates all the non-existing parent datasets. any property specified on the
command line using the -o option is ignored.
propertie... | [
"Creates",
"a",
"clone",
"of",
"the",
"given",
"snapshot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L705-L763 |
36,145 | saltstack/salt | salt/modules/zfs.py | promote | def promote(name):
'''
Promotes a clone file system to no longer be dependent on its "origin"
snapshot.
.. note::
This makes it possible to destroy the file system that the
clone was created from. The clone parent-child dependency relationship
is reversed, so that the origin fi... | python | def promote(name):
'''
Promotes a clone file system to no longer be dependent on its "origin"
snapshot.
.. note::
This makes it possible to destroy the file system that the
clone was created from. The clone parent-child dependency relationship
is reversed, so that the origin fi... | [
"def",
"promote",
"(",
"name",
")",
":",
"## Promote clone",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"__utils__",
"[",
"'zfs.zfs_command'",
"]",
"(",
"command",
"=",
"'promote'",
",",
"target",
"=",
"name",
",",
")",
",",
"python_shell",
"=... | Promotes a clone file system to no longer be dependent on its "origin"
snapshot.
.. note::
This makes it possible to destroy the file system that the
clone was created from. The clone parent-child dependency relationship
is reversed, so that the origin file system becomes a clone of th... | [
"Promotes",
"a",
"clone",
"file",
"system",
"to",
"no",
"longer",
"be",
"dependent",
"on",
"its",
"origin",
"snapshot",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L766-L807 |
36,146 | saltstack/salt | salt/modules/zfs.py | bookmark | def bookmark(snapshot, bookmark):
'''
Creates a bookmark of the given snapshot
.. note::
Bookmarks mark the point in time when the snapshot was created,
and can be used as the incremental source for a zfs send command.
This feature must be enabled to be used. See zpool-features(5)... | python | def bookmark(snapshot, bookmark):
'''
Creates a bookmark of the given snapshot
.. note::
Bookmarks mark the point in time when the snapshot was created,
and can be used as the incremental source for a zfs send command.
This feature must be enabled to be used. See zpool-features(5)... | [
"def",
"bookmark",
"(",
"snapshot",
",",
"bookmark",
")",
":",
"# abort if we do not have feature flags",
"if",
"not",
"__utils__",
"[",
"'zfs.has_feature_flags'",
"]",
"(",
")",
":",
"return",
"OrderedDict",
"(",
"[",
"(",
"'error'",
",",
"'bookmarks are not suppor... | Creates a bookmark of the given snapshot
.. note::
Bookmarks mark the point in time when the snapshot was created,
and can be used as the incremental source for a zfs send command.
This feature must be enabled to be used. See zpool-features(5) for
details on ZFS feature flags and ... | [
"Creates",
"a",
"bookmark",
"of",
"the",
"given",
"snapshot"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L810-L857 |
36,147 | saltstack/salt | salt/modules/zfs.py | holds | def holds(snapshot, **kwargs):
'''
Lists all existing user references for the given snapshot or snapshots.
snapshot : string
name of snapshot
recursive : boolean
lists the holds that are set on the named descendent snapshots also.
.. versionadded:: 2016.3.0
CLI Example:
.... | python | def holds(snapshot, **kwargs):
'''
Lists all existing user references for the given snapshot or snapshots.
snapshot : string
name of snapshot
recursive : boolean
lists the holds that are set on the named descendent snapshots also.
.. versionadded:: 2016.3.0
CLI Example:
.... | [
"def",
"holds",
"(",
"snapshot",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"'-H'",
"]",
"target",
"=",
"[",
"]",
"# NOTE: set extra config from kwargs",
"if",
"kwargs",
".",
"get",
"(",
"'rec... | Lists all existing user references for the given snapshot or snapshots.
snapshot : string
name of snapshot
recursive : boolean
lists the holds that are set on the named descendent snapshots also.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' zfs.h... | [
"Lists",
"all",
"existing",
"user",
"references",
"for",
"the",
"given",
"snapshot",
"or",
"snapshots",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L860-L909 |
36,148 | saltstack/salt | salt/modules/zfs.py | hold | def hold(tag, *snapshot, **kwargs):
'''
Adds a single reference, named with the tag argument, to the specified
snapshot or snapshots.
.. note::
Each snapshot has its own tag namespace, and tags must be unique within that space.
If a hold exists on a snapshot, attempts to destroy that ... | python | def hold(tag, *snapshot, **kwargs):
'''
Adds a single reference, named with the tag argument, to the specified
snapshot or snapshots.
.. note::
Each snapshot has its own tag namespace, and tags must be unique within that space.
If a hold exists on a snapshot, attempts to destroy that ... | [
"def",
"hold",
"(",
"tag",
",",
"*",
"snapshot",
",",
"*",
"*",
"kwargs",
")",
":",
"## warn about tag change",
"if",
"','",
"in",
"tag",
":",
"salt",
".",
"utils",
".",
"versions",
".",
"warn_until",
"(",
"'Sodium'",
",",
"'A comma-separated tag is no suppo... | Adds a single reference, named with the tag argument, to the specified
snapshot or snapshots.
.. note::
Each snapshot has its own tag namespace, and tags must be unique within that space.
If a hold exists on a snapshot, attempts to destroy that snapshot by
using the zfs destroy comman... | [
"Adds",
"a",
"single",
"reference",
"named",
"with",
"the",
"tag",
"argument",
"to",
"the",
"specified",
"snapshot",
"or",
"snapshots",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L912-L978 |
36,149 | saltstack/salt | salt/modules/zfs.py | snapshot | def snapshot(*snapshot, **kwargs):
'''
Creates snapshots with the given names.
snapshot : string
name of snapshot(s)
recursive : boolean
recursively create snapshots of all descendent datasets.
properties : dict
additional zfs properties (-o)
.. note::
ZFS prop... | python | def snapshot(*snapshot, **kwargs):
'''
Creates snapshots with the given names.
snapshot : string
name of snapshot(s)
recursive : boolean
recursively create snapshots of all descendent datasets.
properties : dict
additional zfs properties (-o)
.. note::
ZFS prop... | [
"def",
"snapshot",
"(",
"*",
"snapshot",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"]",
"# NOTE: push filesystem properties",
"filesystem_properties",
"=",
"kwargs",
".",
"get",
"(",
"'properties'"... | Creates snapshots with the given names.
snapshot : string
name of snapshot(s)
recursive : boolean
recursively create snapshots of all descendent datasets.
properties : dict
additional zfs properties (-o)
.. note::
ZFS properties can be specified at the time of creation... | [
"Creates",
"snapshots",
"with",
"the",
"given",
"names",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L1049-L1100 |
36,150 | saltstack/salt | salt/modules/zfs.py | get | def get(*dataset, **kwargs):
'''
Displays properties for the given datasets.
dataset : string
name of snapshot(s), filesystem(s), or volume(s)
properties : string
comma-separated list of properties to list, defaults to all
recursive : boolean
recursively list children
de... | python | def get(*dataset, **kwargs):
'''
Displays properties for the given datasets.
dataset : string
name of snapshot(s), filesystem(s), or volume(s)
properties : string
comma-separated list of properties to list, defaults to all
recursive : boolean
recursively list children
de... | [
"def",
"get",
"(",
"*",
"dataset",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: initialize the defaults",
"flags",
"=",
"[",
"'-H'",
"]",
"opts",
"=",
"{",
"}",
"# NOTE: set extra config from kwargs",
"if",
"kwargs",
".",
"get",
"(",
"'d... | Displays properties for the given datasets.
dataset : string
name of snapshot(s), filesystem(s), or volume(s)
properties : string
comma-separated list of properties to list, defaults to all
recursive : boolean
recursively list children
depth : int
recursively list childr... | [
"Displays",
"properties",
"for",
"the",
"given",
"datasets",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L1158-L1264 |
36,151 | saltstack/salt | salt/utils/versions.py | warn_until | def warn_until(version,
message,
category=DeprecationWarning,
stacklevel=None,
_version_info_=None,
_dont_call_warnings=False):
'''
Helper function to raise a warning, by default, a ``DeprecationWarning``,
until the provided ``versio... | python | def warn_until(version,
message,
category=DeprecationWarning,
stacklevel=None,
_version_info_=None,
_dont_call_warnings=False):
'''
Helper function to raise a warning, by default, a ``DeprecationWarning``,
until the provided ``versio... | [
"def",
"warn_until",
"(",
"version",
",",
"message",
",",
"category",
"=",
"DeprecationWarning",
",",
"stacklevel",
"=",
"None",
",",
"_version_info_",
"=",
"None",
",",
"_dont_call_warnings",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"version",
... | Helper function to raise a warning, by default, a ``DeprecationWarning``,
until the provided ``version``, after which, a ``RuntimeError`` will
be raised to remind the developers to remove the warning because the
target version has been reached.
:param version: The version info or name after which the w... | [
"Helper",
"function",
"to",
"raise",
"a",
"warning",
"by",
"default",
"a",
"DeprecationWarning",
"until",
"the",
"provided",
"version",
"after",
"which",
"a",
"RuntimeError",
"will",
"be",
"raised",
"to",
"remind",
"the",
"developers",
"to",
"remove",
"the",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/versions.py#L78-L162 |
36,152 | saltstack/salt | salt/utils/versions.py | check_boto_reqs | def check_boto_reqs(boto_ver=None,
boto3_ver=None,
botocore_ver=None,
check_boto=True,
check_boto3=True):
'''
Checks for the version of various required boto libs in one central location. Most
boto states and modules rely on a s... | python | def check_boto_reqs(boto_ver=None,
boto3_ver=None,
botocore_ver=None,
check_boto=True,
check_boto3=True):
'''
Checks for the version of various required boto libs in one central location. Most
boto states and modules rely on a s... | [
"def",
"check_boto_reqs",
"(",
"boto_ver",
"=",
"None",
",",
"boto3_ver",
"=",
"None",
",",
"botocore_ver",
"=",
"None",
",",
"check_boto",
"=",
"True",
",",
"check_boto3",
"=",
"True",
")",
":",
"if",
"check_boto",
"is",
"True",
":",
"try",
":",
"# Late... | Checks for the version of various required boto libs in one central location. Most
boto states and modules rely on a single version of the boto, boto3, or botocore libs.
However, some require newer versions of any of these dependencies. This function allows
the module to pass in a version to override the de... | [
"Checks",
"for",
"the",
"version",
"of",
"various",
"required",
"boto",
"libs",
"in",
"one",
"central",
"location",
".",
"Most",
"boto",
"states",
"and",
"modules",
"rely",
"on",
"a",
"single",
"version",
"of",
"the",
"boto",
"boto3",
"or",
"botocore",
"li... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/versions.py#L297-L364 |
36,153 | saltstack/salt | salt/modules/bamboohr.py | update_employee | def update_employee(emp_id, key=None, value=None, items=None):
'''
Update one or more items for this employee. Specifying an empty value will
clear it for that employee.
CLI Examples:
salt myminion bamboohr.update_employee 1138 nickname Curly
salt myminion bamboohr.update_employee 1138... | python | def update_employee(emp_id, key=None, value=None, items=None):
'''
Update one or more items for this employee. Specifying an empty value will
clear it for that employee.
CLI Examples:
salt myminion bamboohr.update_employee 1138 nickname Curly
salt myminion bamboohr.update_employee 1138... | [
"def",
"update_employee",
"(",
"emp_id",
",",
"key",
"=",
"None",
",",
"value",
"=",
"None",
",",
"items",
"=",
"None",
")",
":",
"if",
"items",
"is",
"None",
":",
"if",
"key",
"is",
"None",
"or",
"value",
"is",
"None",
":",
"return",
"{",
"'Error'... | Update one or more items for this employee. Specifying an empty value will
clear it for that employee.
CLI Examples:
salt myminion bamboohr.update_employee 1138 nickname Curly
salt myminion bamboohr.update_employee 1138 nickname ''
salt myminion bamboohr.update_employee 1138 items='{"n... | [
"Update",
"one",
"or",
"more",
"items",
"for",
"this",
"employee",
".",
"Specifying",
"an",
"empty",
"value",
"will",
"clear",
"it",
"for",
"that",
"employee",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bamboohr.py#L153-L184 |
36,154 | saltstack/salt | salt/modules/bamboohr.py | list_users | def list_users(order_by='id'):
'''
Show all users for this company.
CLI Example:
salt myminion bamboohr.list_users
By default, the return data will be keyed by ID. However, it can be ordered
by any other field. Keep in mind that if the field that is chosen contains
duplicate values (i... | python | def list_users(order_by='id'):
'''
Show all users for this company.
CLI Example:
salt myminion bamboohr.list_users
By default, the return data will be keyed by ID. However, it can be ordered
by any other field. Keep in mind that if the field that is chosen contains
duplicate values (i... | [
"def",
"list_users",
"(",
"order_by",
"=",
"'id'",
")",
":",
"ret",
"=",
"{",
"}",
"status",
",",
"result",
"=",
"_query",
"(",
"action",
"=",
"'meta'",
",",
"command",
"=",
"'users'",
")",
"root",
"=",
"ET",
".",
"fromstring",
"(",
"result",
")",
... | Show all users for this company.
CLI Example:
salt myminion bamboohr.list_users
By default, the return data will be keyed by ID. However, it can be ordered
by any other field. Keep in mind that if the field that is chosen contains
duplicate values (i.e., location is used, for a company which ... | [
"Show",
"all",
"users",
"for",
"this",
"company",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bamboohr.py#L187-L221 |
36,155 | saltstack/salt | salt/modules/bamboohr.py | list_meta_fields | def list_meta_fields():
'''
Show all meta data fields for this company.
CLI Example:
salt myminion bamboohr.list_meta_fields
'''
ret = {}
status, result = _query(action='meta', command='fields')
root = ET.fromstring(result)
fields = root.getchildren()
for field in fields:
... | python | def list_meta_fields():
'''
Show all meta data fields for this company.
CLI Example:
salt myminion bamboohr.list_meta_fields
'''
ret = {}
status, result = _query(action='meta', command='fields')
root = ET.fromstring(result)
fields = root.getchildren()
for field in fields:
... | [
"def",
"list_meta_fields",
"(",
")",
":",
"ret",
"=",
"{",
"}",
"status",
",",
"result",
"=",
"_query",
"(",
"action",
"=",
"'meta'",
",",
"command",
"=",
"'fields'",
")",
"root",
"=",
"ET",
".",
"fromstring",
"(",
"result",
")",
"fields",
"=",
"root... | Show all meta data fields for this company.
CLI Example:
salt myminion bamboohr.list_meta_fields | [
"Show",
"all",
"meta",
"data",
"fields",
"for",
"this",
"company",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bamboohr.py#L224-L244 |
36,156 | saltstack/salt | salt/modules/bamboohr.py | _query | def _query(action=None,
command=None,
args=None,
method='GET',
data=None):
'''
Make a web call to BambooHR
The password can be any random text, so we chose Salty text.
'''
subdomain = __opts__.get('bamboohr', {}).get('subdomain', None)
path = 'https:/... | python | def _query(action=None,
command=None,
args=None,
method='GET',
data=None):
'''
Make a web call to BambooHR
The password can be any random text, so we chose Salty text.
'''
subdomain = __opts__.get('bamboohr', {}).get('subdomain', None)
path = 'https:/... | [
"def",
"_query",
"(",
"action",
"=",
"None",
",",
"command",
"=",
"None",
",",
"args",
"=",
"None",
",",
"method",
"=",
"'GET'",
",",
"data",
"=",
"None",
")",
":",
"subdomain",
"=",
"__opts__",
".",
"get",
"(",
"'bamboohr'",
",",
"{",
"}",
")",
... | Make a web call to BambooHR
The password can be any random text, so we chose Salty text. | [
"Make",
"a",
"web",
"call",
"to",
"BambooHR"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bamboohr.py#L247-L288 |
36,157 | saltstack/salt | salt/spm/pkgdb/sqlite3.py | init | def init():
'''
Get an sqlite3 connection, and initialize the package database if necessary
'''
if not os.path.exists(__opts__['spm_cache_dir']):
log.debug('Creating SPM cache directory at %s', __opts__['spm_db'])
os.makedirs(__opts__['spm_cache_dir'])
if not os.path.exists(__opts__... | python | def init():
'''
Get an sqlite3 connection, and initialize the package database if necessary
'''
if not os.path.exists(__opts__['spm_cache_dir']):
log.debug('Creating SPM cache directory at %s', __opts__['spm_db'])
os.makedirs(__opts__['spm_cache_dir'])
if not os.path.exists(__opts__... | [
"def",
"init",
"(",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"__opts__",
"[",
"'spm_cache_dir'",
"]",
")",
":",
"log",
".",
"debug",
"(",
"'Creating SPM cache directory at %s'",
",",
"__opts__",
"[",
"'spm_db'",
"]",
")",
"os",
".",
... | Get an sqlite3 connection, and initialize the package database if necessary | [
"Get",
"an",
"sqlite3",
"connection",
"and",
"initialize",
"the",
"package",
"database",
"if",
"necessary"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/pkgdb/sqlite3.py#L20-L69 |
36,158 | saltstack/salt | salt/spm/pkgdb/sqlite3.py | register_pkg | def register_pkg(name, formula_def, conn=None):
'''
Register a package in the package database
'''
close = False
if conn is None:
close = True
conn = init()
conn.execute('INSERT INTO packages VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', (
name,
formula_def['version... | python | def register_pkg(name, formula_def, conn=None):
'''
Register a package in the package database
'''
close = False
if conn is None:
close = True
conn = init()
conn.execute('INSERT INTO packages VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', (
name,
formula_def['version... | [
"def",
"register_pkg",
"(",
"name",
",",
"formula_def",
",",
"conn",
"=",
"None",
")",
":",
"close",
"=",
"False",
"if",
"conn",
"is",
"None",
":",
"close",
"=",
"True",
"conn",
"=",
"init",
"(",
")",
"conn",
".",
"execute",
"(",
"'INSERT INTO packages... | Register a package in the package database | [
"Register",
"a",
"package",
"in",
"the",
"package",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/pkgdb/sqlite3.py#L154-L177 |
36,159 | saltstack/salt | salt/spm/pkgdb/sqlite3.py | register_file | def register_file(name, member, path, digest='', conn=None):
'''
Register a file in the package database
'''
close = False
if conn is None:
close = True
conn = init()
conn.execute('INSERT INTO files VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', (
name,
'{0}/{1}'.... | python | def register_file(name, member, path, digest='', conn=None):
'''
Register a file in the package database
'''
close = False
if conn is None:
close = True
conn = init()
conn.execute('INSERT INTO files VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', (
name,
'{0}/{1}'.... | [
"def",
"register_file",
"(",
"name",
",",
"member",
",",
"path",
",",
"digest",
"=",
"''",
",",
"conn",
"=",
"None",
")",
":",
"close",
"=",
"False",
"if",
"conn",
"is",
"None",
":",
"close",
"=",
"True",
"conn",
"=",
"init",
"(",
")",
"conn",
".... | Register a file in the package database | [
"Register",
"a",
"file",
"in",
"the",
"package",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/pkgdb/sqlite3.py#L180-L204 |
36,160 | saltstack/salt | salt/spm/pkgdb/sqlite3.py | unregister_file | def unregister_file(path, pkg=None, conn=None): # pylint: disable=W0612
'''
Unregister a file from the package database
'''
close = False
if conn is None:
close = True
conn = init()
conn.execute('DELETE FROM files WHERE path=?', (path, ))
if close:
conn.close() | python | def unregister_file(path, pkg=None, conn=None): # pylint: disable=W0612
'''
Unregister a file from the package database
'''
close = False
if conn is None:
close = True
conn = init()
conn.execute('DELETE FROM files WHERE path=?', (path, ))
if close:
conn.close() | [
"def",
"unregister_file",
"(",
"path",
",",
"pkg",
"=",
"None",
",",
"conn",
"=",
"None",
")",
":",
"# pylint: disable=W0612",
"close",
"=",
"False",
"if",
"conn",
"is",
"None",
":",
"close",
"=",
"True",
"conn",
"=",
"init",
"(",
")",
"conn",
".",
"... | Unregister a file from the package database | [
"Unregister",
"a",
"file",
"from",
"the",
"package",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/pkgdb/sqlite3.py#L217-L228 |
36,161 | saltstack/salt | salt/proxy/bluecoat_sslv.py | call | def call(payload, apply_changes=False):
'''
Sends a post command to the device and returns the decoded data.
'''
session, cookies, csrf_token = logon()
response = _post_request(session, payload, cookies, csrf_token)
if apply_changes:
apply_payload = {"jsonrpc": "2.0",
... | python | def call(payload, apply_changes=False):
'''
Sends a post command to the device and returns the decoded data.
'''
session, cookies, csrf_token = logon()
response = _post_request(session, payload, cookies, csrf_token)
if apply_changes:
apply_payload = {"jsonrpc": "2.0",
... | [
"def",
"call",
"(",
"payload",
",",
"apply_changes",
"=",
"False",
")",
":",
"session",
",",
"cookies",
",",
"csrf_token",
"=",
"logon",
"(",
")",
"response",
"=",
"_post_request",
"(",
"session",
",",
"payload",
",",
"cookies",
",",
"csrf_token",
")",
"... | Sends a post command to the device and returns the decoded data. | [
"Sends",
"a",
"post",
"command",
"to",
"the",
"device",
"and",
"returns",
"the",
"decoded",
"data",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/bluecoat_sslv.py#L145-L158 |
36,162 | saltstack/salt | salt/proxy/bluecoat_sslv.py | logon | def logon():
'''
Logs into the bluecoat_sslv device and returns the session cookies.
'''
session = requests.session()
payload = {"jsonrpc": "2.0",
"id": "ID0",
"method": "login",
"params": [DETAILS['username'], DETAILS['password'], DETAILS['auth'], True]
... | python | def logon():
'''
Logs into the bluecoat_sslv device and returns the session cookies.
'''
session = requests.session()
payload = {"jsonrpc": "2.0",
"id": "ID0",
"method": "login",
"params": [DETAILS['username'], DETAILS['password'], DETAILS['auth'], True]
... | [
"def",
"logon",
"(",
")",
":",
"session",
"=",
"requests",
".",
"session",
"(",
")",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"login\"",
",",
"\"params\"",
":",
"[",
"DETAILS",
"[",
"'... | Logs into the bluecoat_sslv device and returns the session cookies. | [
"Logs",
"into",
"the",
"bluecoat_sslv",
"device",
"and",
"returns",
"the",
"session",
"cookies",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/bluecoat_sslv.py#L170-L198 |
36,163 | saltstack/salt | salt/utils/path.py | _is_reparse_point | def _is_reparse_point(path):
'''
Returns True if path is a reparse point; False otherwise.
'''
result = win32file.GetFileAttributesW(path)
if result == -1:
return False
return True if result & 0x400 else False | python | def _is_reparse_point(path):
'''
Returns True if path is a reparse point; False otherwise.
'''
result = win32file.GetFileAttributesW(path)
if result == -1:
return False
return True if result & 0x400 else False | [
"def",
"_is_reparse_point",
"(",
"path",
")",
":",
"result",
"=",
"win32file",
".",
"GetFileAttributesW",
"(",
"path",
")",
"if",
"result",
"==",
"-",
"1",
":",
"return",
"False",
"return",
"True",
"if",
"result",
"&",
"0x400",
"else",
"False"
] | Returns True if path is a reparse point; False otherwise. | [
"Returns",
"True",
"if",
"path",
"is",
"a",
"reparse",
"point",
";",
"False",
"otherwise",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/path.py#L139-L148 |
36,164 | saltstack/salt | salt/utils/path.py | _get_reparse_data | def _get_reparse_data(path):
'''
Retrieves the reparse point data structure for the given path.
If the path is not a reparse point, None is returned.
See http://msdn.microsoft.com/en-us/library/ff552012.aspx for details on the
REPARSE_DATA_BUFFER structure returned.
'''
# ensure paths are ... | python | def _get_reparse_data(path):
'''
Retrieves the reparse point data structure for the given path.
If the path is not a reparse point, None is returned.
See http://msdn.microsoft.com/en-us/library/ff552012.aspx for details on the
REPARSE_DATA_BUFFER structure returned.
'''
# ensure paths are ... | [
"def",
"_get_reparse_data",
"(",
"path",
")",
":",
"# ensure paths are using the right slashes",
"path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"path",
")",
"if",
"not",
"_is_reparse_point",
"(",
"path",
")",
":",
"return",
"None",
"fileHandle",
"=",
"N... | Retrieves the reparse point data structure for the given path.
If the path is not a reparse point, None is returned.
See http://msdn.microsoft.com/en-us/library/ff552012.aspx for details on the
REPARSE_DATA_BUFFER structure returned. | [
"Retrieves",
"the",
"reparse",
"point",
"data",
"structure",
"for",
"the",
"given",
"path",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/path.py#L151-L188 |
36,165 | saltstack/salt | salt/utils/path.py | which_bin | def which_bin(exes):
'''
Scan over some possible executables and return the first one that is found
'''
if not isinstance(exes, Iterable):
return None
for exe in exes:
path = which(exe)
if not path:
continue
return path
return None | python | def which_bin(exes):
'''
Scan over some possible executables and return the first one that is found
'''
if not isinstance(exes, Iterable):
return None
for exe in exes:
path = which(exe)
if not path:
continue
return path
return None | [
"def",
"which_bin",
"(",
"exes",
")",
":",
"if",
"not",
"isinstance",
"(",
"exes",
",",
"Iterable",
")",
":",
"return",
"None",
"for",
"exe",
"in",
"exes",
":",
"path",
"=",
"which",
"(",
"exe",
")",
"if",
"not",
"path",
":",
"continue",
"return",
... | Scan over some possible executables and return the first one that is found | [
"Scan",
"over",
"some",
"possible",
"executables",
"and",
"return",
"the",
"first",
"one",
"that",
"is",
"found"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/path.py#L303-L314 |
36,166 | saltstack/salt | salt/utils/path.py | sanitize_win_path | def sanitize_win_path(winpath):
'''
Remove illegal path characters for windows
'''
intab = '<>:|?*'
if isinstance(winpath, six.text_type):
winpath = winpath.translate(dict((ord(c), '_') for c in intab))
elif isinstance(winpath, six.string_types):
outtab = '_' * len(intab)
... | python | def sanitize_win_path(winpath):
'''
Remove illegal path characters for windows
'''
intab = '<>:|?*'
if isinstance(winpath, six.text_type):
winpath = winpath.translate(dict((ord(c), '_') for c in intab))
elif isinstance(winpath, six.string_types):
outtab = '_' * len(intab)
... | [
"def",
"sanitize_win_path",
"(",
"winpath",
")",
":",
"intab",
"=",
"'<>:|?*'",
"if",
"isinstance",
"(",
"winpath",
",",
"six",
".",
"text_type",
")",
":",
"winpath",
"=",
"winpath",
".",
"translate",
"(",
"dict",
"(",
"(",
"ord",
"(",
"c",
")",
",",
... | Remove illegal path characters for windows | [
"Remove",
"illegal",
"path",
"characters",
"for",
"windows"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/path.py#L375-L386 |
36,167 | saltstack/salt | salt/utils/path.py | os_walk | def os_walk(top, *args, **kwargs):
'''
This is a helper than ensures that all paths returned from os.walk are
unicode.
'''
if six.PY2 and salt.utils.platform.is_windows():
top_query = top
else:
top_query = salt.utils.stringutils.to_str(top)
for item in os.walk(top_query, *arg... | python | def os_walk(top, *args, **kwargs):
'''
This is a helper than ensures that all paths returned from os.walk are
unicode.
'''
if six.PY2 and salt.utils.platform.is_windows():
top_query = top
else:
top_query = salt.utils.stringutils.to_str(top)
for item in os.walk(top_query, *arg... | [
"def",
"os_walk",
"(",
"top",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"six",
".",
"PY2",
"and",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"top_query",
"=",
"top",
"else",
":",
"top_query",
"=",
"s... | This is a helper than ensures that all paths returned from os.walk are
unicode. | [
"This",
"is",
"a",
"helper",
"than",
"ensures",
"that",
"all",
"paths",
"returned",
"from",
"os",
".",
"walk",
"are",
"unicode",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/path.py#L446-L456 |
36,168 | saltstack/salt | salt/modules/ebuildpkg.py | _process_emerge_err | def _process_emerge_err(stdout, stderr):
'''
Used to parse emerge output to provide meaningful output when emerge fails
'''
ret = {}
rexp = re.compile(r'^[<>=][^ ]+/[^ ]+ [^\n]+', re.M)
slot_conflicts = re.compile(r'^[^ \n]+/[^ ]+:[^ ]', re.M).findall(stderr)
if slot_conflicts:
ret[... | python | def _process_emerge_err(stdout, stderr):
'''
Used to parse emerge output to provide meaningful output when emerge fails
'''
ret = {}
rexp = re.compile(r'^[<>=][^ ]+/[^ ]+ [^\n]+', re.M)
slot_conflicts = re.compile(r'^[^ \n]+/[^ ]+:[^ ]', re.M).findall(stderr)
if slot_conflicts:
ret[... | [
"def",
"_process_emerge_err",
"(",
"stdout",
",",
"stderr",
")",
":",
"ret",
"=",
"{",
"}",
"rexp",
"=",
"re",
".",
"compile",
"(",
"r'^[<>=][^ ]+/[^ ]+ [^\\n]+'",
",",
"re",
".",
"M",
")",
"slot_conflicts",
"=",
"re",
".",
"compile",
"(",
"r'^[^ \\n]+/[^ ... | Used to parse emerge output to provide meaningful output when emerge fails | [
"Used",
"to",
"parse",
"emerge",
"output",
"to",
"provide",
"meaningful",
"output",
"when",
"emerge",
"fails"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L138-L170 |
36,169 | saltstack/salt | salt/modules/ebuildpkg.py | depclean | def depclean(name=None, slot=None, fromrepo=None, pkgs=None):
'''
Portage has a function to remove unused dependencies. If a package
is provided, it will only removed the package if no other package
depends on it.
name
The name of the package to be cleaned.
slot
Restrict the re... | python | def depclean(name=None, slot=None, fromrepo=None, pkgs=None):
'''
Portage has a function to remove unused dependencies. If a package
is provided, it will only removed the package if no other package
depends on it.
name
The name of the package to be cleaned.
slot
Restrict the re... | [
"def",
"depclean",
"(",
"name",
"=",
"None",
",",
"slot",
"=",
"None",
",",
"fromrepo",
"=",
"None",
",",
"pkgs",
"=",
"None",
")",
":",
"try",
":",
"pkg_params",
"=",
"__salt__",
"[",
"'pkg_resource.parse_targets'",
"]",
"(",
"name",
",",
"pkgs",
")",... | Portage has a function to remove unused dependencies. If a package
is provided, it will only removed the package if no other package
depends on it.
name
The name of the package to be cleaned.
slot
Restrict the remove to a specific slot. Ignored if ``name`` is None.
fromrepo
... | [
"Portage",
"has",
"a",
"function",
"to",
"remove",
"unused",
"dependencies",
".",
"If",
"a",
"package",
"is",
"provided",
"it",
"will",
"only",
"removed",
"the",
"package",
"if",
"no",
"other",
"package",
"depends",
"on",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L1105-L1154 |
36,170 | saltstack/salt | salt/modules/ebuildpkg.py | check_extra_requirements | def check_extra_requirements(pkgname, pkgver):
'''
Check if the installed package already has the given requirements.
CLI Example:
.. code-block:: bash
salt '*' pkg.check_extra_requirements 'sys-devel/gcc' '~>4.1.2:4.1::gentoo[nls,fortran]'
'''
keyword = None
match = re.match('^(... | python | def check_extra_requirements(pkgname, pkgver):
'''
Check if the installed package already has the given requirements.
CLI Example:
.. code-block:: bash
salt '*' pkg.check_extra_requirements 'sys-devel/gcc' '~>4.1.2:4.1::gentoo[nls,fortran]'
'''
keyword = None
match = re.match('^(... | [
"def",
"check_extra_requirements",
"(",
"pkgname",
",",
"pkgver",
")",
":",
"keyword",
"=",
"None",
"match",
"=",
"re",
".",
"match",
"(",
"'^(~)?([<>])?(=)?([^<>=]*)$'",
",",
"pkgver",
")",
"if",
"match",
":",
"keyword",
",",
"gt_lt",
",",
"eq",
",",
"ver... | Check if the installed package already has the given requirements.
CLI Example:
.. code-block:: bash
salt '*' pkg.check_extra_requirements 'sys-devel/gcc' '~>4.1.2:4.1::gentoo[nls,fortran]' | [
"Check",
"if",
"the",
"installed",
"package",
"already",
"has",
"the",
"given",
"requirements",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L1201-L1256 |
36,171 | saltstack/salt | salt/states/mac_keychain.py | installed | def installed(name, password, keychain="/Library/Keychains/System.keychain", **kwargs):
'''
Install a p12 certificate file into the macOS keychain
name
The certificate to install
password
The password for the certificate being installed formatted in the way
described for openss... | python | def installed(name, password, keychain="/Library/Keychains/System.keychain", **kwargs):
'''
Install a p12 certificate file into the macOS keychain
name
The certificate to install
password
The password for the certificate being installed formatted in the way
described for openss... | [
"def",
"installed",
"(",
"name",
",",
"password",
",",
"keychain",
"=",
"\"/Library/Keychains/System.keychain\"",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"... | Install a p12 certificate file into the macOS keychain
name
The certificate to install
password
The password for the certificate being installed formatted in the way
described for openssl command in the PASS PHRASE ARGUMENTS section
keychain
The keychain to install the cer... | [
"Install",
"a",
"p12",
"certificate",
"file",
"into",
"the",
"macOS",
"keychain"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_keychain.py#L36-L98 |
36,172 | saltstack/salt | salt/states/mac_keychain.py | uninstalled | def uninstalled(name, password, keychain="/Library/Keychains/System.keychain", keychain_password=None):
'''
Uninstall a p12 certificate file from the macOS keychain
name
The certificate to uninstall, this can be a path for a .p12 or the friendly
name
password
The password for t... | python | def uninstalled(name, password, keychain="/Library/Keychains/System.keychain", keychain_password=None):
'''
Uninstall a p12 certificate file from the macOS keychain
name
The certificate to uninstall, this can be a path for a .p12 or the friendly
name
password
The password for t... | [
"def",
"uninstalled",
"(",
"name",
",",
"password",
",",
"keychain",
"=",
"\"/Library/Keychains/System.keychain\"",
",",
"keychain_password",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
... | Uninstall a p12 certificate file from the macOS keychain
name
The certificate to uninstall, this can be a path for a .p12 or the friendly
name
password
The password for the certificate being installed formatted in the way
described for openssl command in the PASS PHRASE ARGUMEN... | [
"Uninstall",
"a",
"p12",
"certificate",
"file",
"from",
"the",
"macOS",
"keychain"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_keychain.py#L101-L151 |
36,173 | saltstack/salt | salt/states/mac_keychain.py | default_keychain | def default_keychain(name, domain="user", user=None):
'''
Set the default keychain to use
name
The chain in which to use as the default
domain
The domain to use valid values are user|system|common|dynamic, the default is user
user
The user to run as
'''
ret = {'na... | python | def default_keychain(name, domain="user", user=None):
'''
Set the default keychain to use
name
The chain in which to use as the default
domain
The domain to use valid values are user|system|common|dynamic, the default is user
user
The user to run as
'''
ret = {'na... | [
"def",
"default_keychain",
"(",
"name",
",",
"domain",
"=",
"\"user\"",
",",
"user",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"if... | Set the default keychain to use
name
The chain in which to use as the default
domain
The domain to use valid values are user|system|common|dynamic, the default is user
user
The user to run as | [
"Set",
"the",
"default",
"keychain",
"to",
"use"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mac_keychain.py#L154-L189 |
36,174 | saltstack/salt | salt/netapi/rest_cherrypy/wsgi.py | bootstrap_app | def bootstrap_app():
'''
Grab the opts dict of the master config by trying to import Salt
'''
from salt.netapi.rest_cherrypy import app
import salt.config
__opts__ = salt.config.client_config(
os.environ.get('SALT_MASTER_CONFIG', '/etc/salt/master'))
return app.get_app(__opts__) | python | def bootstrap_app():
'''
Grab the opts dict of the master config by trying to import Salt
'''
from salt.netapi.rest_cherrypy import app
import salt.config
__opts__ = salt.config.client_config(
os.environ.get('SALT_MASTER_CONFIG', '/etc/salt/master'))
return app.get_app(__opts__) | [
"def",
"bootstrap_app",
"(",
")",
":",
"from",
"salt",
".",
"netapi",
".",
"rest_cherrypy",
"import",
"app",
"import",
"salt",
".",
"config",
"__opts__",
"=",
"salt",
".",
"config",
".",
"client_config",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'SALT... | Grab the opts dict of the master config by trying to import Salt | [
"Grab",
"the",
"opts",
"dict",
"of",
"the",
"master",
"config",
"by",
"trying",
"to",
"import",
"Salt"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/wsgi.py#L55-L64 |
36,175 | saltstack/salt | salt/netapi/rest_cherrypy/wsgi.py | get_application | def get_application(*args):
'''
Returns a WSGI application function. If you supply the WSGI app and config
it will use that, otherwise it will try to obtain them from a local Salt
installation
'''
opts_tuple = args
def wsgi_app(environ, start_response):
root, _, conf = opts_tuple or... | python | def get_application(*args):
'''
Returns a WSGI application function. If you supply the WSGI app and config
it will use that, otherwise it will try to obtain them from a local Salt
installation
'''
opts_tuple = args
def wsgi_app(environ, start_response):
root, _, conf = opts_tuple or... | [
"def",
"get_application",
"(",
"*",
"args",
")",
":",
"opts_tuple",
"=",
"args",
"def",
"wsgi_app",
"(",
"environ",
",",
"start_response",
")",
":",
"root",
",",
"_",
",",
"conf",
"=",
"opts_tuple",
"or",
"bootstrap_app",
"(",
")",
"cherrypy",
".",
"conf... | Returns a WSGI application function. If you supply the WSGI app and config
it will use that, otherwise it will try to obtain them from a local Salt
installation | [
"Returns",
"a",
"WSGI",
"application",
"function",
".",
"If",
"you",
"supply",
"the",
"WSGI",
"app",
"and",
"config",
"it",
"will",
"use",
"that",
"otherwise",
"it",
"will",
"try",
"to",
"obtain",
"them",
"from",
"a",
"local",
"Salt",
"installation"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/wsgi.py#L67-L82 |
36,176 | saltstack/salt | salt/returners/sqlite3_return.py | _get_conn | def _get_conn(ret=None):
'''
Return a sqlite3 database connection
'''
# Possible todo: support detect_types, isolation_level, check_same_thread,
# factory, cached_statements. Do we really need to though?
_options = _get_options(ret)
database = _options.get('database')
timeout = _options.... | python | def _get_conn(ret=None):
'''
Return a sqlite3 database connection
'''
# Possible todo: support detect_types, isolation_level, check_same_thread,
# factory, cached_statements. Do we really need to though?
_options = _get_options(ret)
database = _options.get('database')
timeout = _options.... | [
"def",
"_get_conn",
"(",
"ret",
"=",
"None",
")",
":",
"# Possible todo: support detect_types, isolation_level, check_same_thread,",
"# factory, cached_statements. Do we really need to though?",
"_options",
"=",
"_get_options",
"(",
"ret",
")",
"database",
"=",
"_options",
".",... | Return a sqlite3 database connection | [
"Return",
"a",
"sqlite3",
"database",
"connection"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/sqlite3_return.py#L131-L149 |
36,177 | saltstack/salt | salt/returners/sqlite3_return.py | returner | def returner(ret):
'''
Insert minion return data into the sqlite3 database
'''
log.debug('sqlite3 returner <returner> called with data: %s', ret)
conn = _get_conn(ret)
cur = conn.cursor()
sql = '''INSERT INTO salt_returns
(fun, jid, id, fun_args, date, full_ret, success)
... | python | def returner(ret):
'''
Insert minion return data into the sqlite3 database
'''
log.debug('sqlite3 returner <returner> called with data: %s', ret)
conn = _get_conn(ret)
cur = conn.cursor()
sql = '''INSERT INTO salt_returns
(fun, jid, id, fun_args, date, full_ret, success)
... | [
"def",
"returner",
"(",
"ret",
")",
":",
"log",
".",
"debug",
"(",
"'sqlite3 returner <returner> called with data: %s'",
",",
"ret",
")",
"conn",
"=",
"_get_conn",
"(",
"ret",
")",
"cur",
"=",
"conn",
".",
"cursor",
"(",
")",
"sql",
"=",
"'''INSERT INTO salt... | Insert minion return data into the sqlite3 database | [
"Insert",
"minion",
"return",
"data",
"into",
"the",
"sqlite3",
"database"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/sqlite3_return.py#L161-L179 |
36,178 | saltstack/salt | salt/returners/sqlite3_return.py | get_load | def get_load(jid):
'''
Return the load from a specified jid
'''
log.debug('sqlite3 returner <get_load> called jid: %s', jid)
conn = _get_conn(ret=None)
cur = conn.cursor()
sql = '''SELECT load FROM jids WHERE jid = :jid'''
cur.execute(sql,
{'jid': jid})
data = cur.fet... | python | def get_load(jid):
'''
Return the load from a specified jid
'''
log.debug('sqlite3 returner <get_load> called jid: %s', jid)
conn = _get_conn(ret=None)
cur = conn.cursor()
sql = '''SELECT load FROM jids WHERE jid = :jid'''
cur.execute(sql,
{'jid': jid})
data = cur.fet... | [
"def",
"get_load",
"(",
"jid",
")",
":",
"log",
".",
"debug",
"(",
"'sqlite3 returner <get_load> called jid: %s'",
",",
"jid",
")",
"conn",
"=",
"_get_conn",
"(",
"ret",
"=",
"None",
")",
"cur",
"=",
"conn",
".",
"cursor",
"(",
")",
"sql",
"=",
"'''SELEC... | Return the load from a specified jid | [
"Return",
"the",
"load",
"from",
"a",
"specified",
"jid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/sqlite3_return.py#L203-L217 |
36,179 | saltstack/salt | salt/returners/sqlite3_return.py | get_jid | def get_jid(jid):
'''
Return the information returned from a specified jid
'''
log.debug('sqlite3 returner <get_jid> called jid: %s', jid)
conn = _get_conn(ret=None)
cur = conn.cursor()
sql = '''SELECT id, full_ret FROM salt_returns WHERE jid = :jid'''
cur.execute(sql,
{'... | python | def get_jid(jid):
'''
Return the information returned from a specified jid
'''
log.debug('sqlite3 returner <get_jid> called jid: %s', jid)
conn = _get_conn(ret=None)
cur = conn.cursor()
sql = '''SELECT id, full_ret FROM salt_returns WHERE jid = :jid'''
cur.execute(sql,
{'... | [
"def",
"get_jid",
"(",
"jid",
")",
":",
"log",
".",
"debug",
"(",
"'sqlite3 returner <get_jid> called jid: %s'",
",",
"jid",
")",
"conn",
"=",
"_get_conn",
"(",
"ret",
"=",
"None",
")",
"cur",
"=",
"conn",
".",
"cursor",
"(",
")",
"sql",
"=",
"'''SELECT ... | Return the information returned from a specified jid | [
"Return",
"the",
"information",
"returned",
"from",
"a",
"specified",
"jid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/sqlite3_return.py#L220-L237 |
36,180 | saltstack/salt | salt/modules/git.py | _check_worktree_support | def _check_worktree_support(failhard=True):
'''
Ensure that we don't try to operate on worktrees in git < 2.5.0.
'''
git_version = version(versioninfo=False)
if _LooseVersion(git_version) < _LooseVersion('2.5.0'):
if failhard:
raise CommandExecutionError(
'Worktre... | python | def _check_worktree_support(failhard=True):
'''
Ensure that we don't try to operate on worktrees in git < 2.5.0.
'''
git_version = version(versioninfo=False)
if _LooseVersion(git_version) < _LooseVersion('2.5.0'):
if failhard:
raise CommandExecutionError(
'Worktre... | [
"def",
"_check_worktree_support",
"(",
"failhard",
"=",
"True",
")",
":",
"git_version",
"=",
"version",
"(",
"versioninfo",
"=",
"False",
")",
"if",
"_LooseVersion",
"(",
"git_version",
")",
"<",
"_LooseVersion",
"(",
"'2.5.0'",
")",
":",
"if",
"failhard",
... | Ensure that we don't try to operate on worktrees in git < 2.5.0. | [
"Ensure",
"that",
"we",
"don",
"t",
"try",
"to",
"operate",
"on",
"worktrees",
"in",
"git",
"<",
"2",
".",
"5",
".",
"0",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L48-L60 |
36,181 | saltstack/salt | salt/modules/git.py | _expand_path | def _expand_path(cwd, user):
'''
Expand home directory
'''
try:
to_expand = '~' + user if user else '~'
except TypeError:
# Users should never be numeric but if we don't account for this then
# we're going to get a traceback if someone passes this invalid input.
to_ex... | python | def _expand_path(cwd, user):
'''
Expand home directory
'''
try:
to_expand = '~' + user if user else '~'
except TypeError:
# Users should never be numeric but if we don't account for this then
# we're going to get a traceback if someone passes this invalid input.
to_ex... | [
"def",
"_expand_path",
"(",
"cwd",
",",
"user",
")",
":",
"try",
":",
"to_expand",
"=",
"'~'",
"+",
"user",
"if",
"user",
"else",
"'~'",
"except",
"TypeError",
":",
"# Users should never be numeric but if we don't account for this then",
"# we're going to get a tracebac... | Expand home directory | [
"Expand",
"home",
"directory"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L113-L126 |
36,182 | saltstack/salt | salt/modules/git.py | _path_is_executable_others | def _path_is_executable_others(path):
'''
Check every part of path for executable permission
'''
prevpath = None
while path and path != prevpath:
try:
if not os.stat(path).st_mode & stat.S_IXOTH:
return False
except OSError:
return False
... | python | def _path_is_executable_others(path):
'''
Check every part of path for executable permission
'''
prevpath = None
while path and path != prevpath:
try:
if not os.stat(path).st_mode & stat.S_IXOTH:
return False
except OSError:
return False
... | [
"def",
"_path_is_executable_others",
"(",
"path",
")",
":",
"prevpath",
"=",
"None",
"while",
"path",
"and",
"path",
"!=",
"prevpath",
":",
"try",
":",
"if",
"not",
"os",
".",
"stat",
"(",
"path",
")",
".",
"st_mode",
"&",
"stat",
".",
"S_IXOTH",
":",
... | Check every part of path for executable permission | [
"Check",
"every",
"part",
"of",
"path",
"for",
"executable",
"permission"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L129-L142 |
36,183 | saltstack/salt | salt/modules/git.py | _format_opts | def _format_opts(opts):
'''
Common code to inspect opts and split them if necessary
'''
if opts is None:
return []
elif isinstance(opts, list):
new_opts = []
for item in opts:
if isinstance(item, six.string_types):
new_opts.append(item)
... | python | def _format_opts(opts):
'''
Common code to inspect opts and split them if necessary
'''
if opts is None:
return []
elif isinstance(opts, list):
new_opts = []
for item in opts:
if isinstance(item, six.string_types):
new_opts.append(item)
... | [
"def",
"_format_opts",
"(",
"opts",
")",
":",
"if",
"opts",
"is",
"None",
":",
"return",
"[",
"]",
"elif",
"isinstance",
"(",
"opts",
",",
"list",
")",
":",
"new_opts",
"=",
"[",
"]",
"for",
"item",
"in",
"opts",
":",
"if",
"isinstance",
"(",
"item... | Common code to inspect opts and split them if necessary | [
"Common",
"code",
"to",
"inspect",
"opts",
"and",
"split",
"them",
"if",
"necessary"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L145-L174 |
36,184 | saltstack/salt | salt/modules/git.py | _format_git_opts | def _format_git_opts(opts):
'''
Do a version check and make sure that the installed version of git can
support git -c
'''
if opts:
version_ = version(versioninfo=False)
if _LooseVersion(version_) < _LooseVersion('1.7.2'):
raise SaltInvocationError(
'git_op... | python | def _format_git_opts(opts):
'''
Do a version check and make sure that the installed version of git can
support git -c
'''
if opts:
version_ = version(versioninfo=False)
if _LooseVersion(version_) < _LooseVersion('1.7.2'):
raise SaltInvocationError(
'git_op... | [
"def",
"_format_git_opts",
"(",
"opts",
")",
":",
"if",
"opts",
":",
"version_",
"=",
"version",
"(",
"versioninfo",
"=",
"False",
")",
"if",
"_LooseVersion",
"(",
"version_",
")",
"<",
"_LooseVersion",
"(",
"'1.7.2'",
")",
":",
"raise",
"SaltInvocationError... | Do a version check and make sure that the installed version of git can
support git -c | [
"Do",
"a",
"version",
"check",
"and",
"make",
"sure",
"that",
"the",
"installed",
"version",
"of",
"git",
"can",
"support",
"git",
"-",
"c"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L177-L189 |
36,185 | saltstack/salt | salt/modules/git.py | _get_toplevel | def _get_toplevel(path, user=None, password=None, output_encoding=None):
'''
Use git rev-parse to return the top level of a repo
'''
return _git_run(
['git', 'rev-parse', '--show-toplevel'],
cwd=path,
user=user,
password=password,
output_encoding=output_encoding)[... | python | def _get_toplevel(path, user=None, password=None, output_encoding=None):
'''
Use git rev-parse to return the top level of a repo
'''
return _git_run(
['git', 'rev-parse', '--show-toplevel'],
cwd=path,
user=user,
password=password,
output_encoding=output_encoding)[... | [
"def",
"_get_toplevel",
"(",
"path",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"output_encoding",
"=",
"None",
")",
":",
"return",
"_git_run",
"(",
"[",
"'git'",
",",
"'rev-parse'",
",",
"'--show-toplevel'",
"]",
",",
"cwd",
"=",
"path... | Use git rev-parse to return the top level of a repo | [
"Use",
"git",
"rev",
"-",
"parse",
"to",
"return",
"the",
"top",
"level",
"of",
"a",
"repo"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L407-L416 |
36,186 | saltstack/salt | salt/modules/git.py | _git_config | def _git_config(cwd, user, password, output_encoding=None):
'''
Helper to retrieve git config options
'''
contextkey = 'git.config.' + cwd
if contextkey not in __context__:
git_dir = rev_parse(cwd,
opts=['--git-dir'],
user=user,
... | python | def _git_config(cwd, user, password, output_encoding=None):
'''
Helper to retrieve git config options
'''
contextkey = 'git.config.' + cwd
if contextkey not in __context__:
git_dir = rev_parse(cwd,
opts=['--git-dir'],
user=user,
... | [
"def",
"_git_config",
"(",
"cwd",
",",
"user",
",",
"password",
",",
"output_encoding",
"=",
"None",
")",
":",
"contextkey",
"=",
"'git.config.'",
"+",
"cwd",
"if",
"contextkey",
"not",
"in",
"__context__",
":",
"git_dir",
"=",
"rev_parse",
"(",
"cwd",
","... | Helper to retrieve git config options | [
"Helper",
"to",
"retrieve",
"git",
"config",
"options"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L419-L436 |
36,187 | saltstack/salt | salt/modules/git.py | _which_git_config | def _which_git_config(global_, cwd, user, password, output_encoding=None):
'''
Based on whether global or local config is desired, return a list of CLI
args to include in the git config command.
'''
if global_:
return ['--global']
version_ = _LooseVersion(version(versioninfo=False))
... | python | def _which_git_config(global_, cwd, user, password, output_encoding=None):
'''
Based on whether global or local config is desired, return a list of CLI
args to include in the git config command.
'''
if global_:
return ['--global']
version_ = _LooseVersion(version(versioninfo=False))
... | [
"def",
"_which_git_config",
"(",
"global_",
",",
"cwd",
",",
"user",
",",
"password",
",",
"output_encoding",
"=",
"None",
")",
":",
"if",
"global_",
":",
"return",
"[",
"'--global'",
"]",
"version_",
"=",
"_LooseVersion",
"(",
"version",
"(",
"versioninfo",... | Based on whether global or local config is desired, return a list of CLI
args to include in the git config command. | [
"Based",
"on",
"whether",
"global",
"or",
"local",
"config",
"is",
"desired",
"return",
"a",
"list",
"of",
"CLI",
"args",
"to",
"include",
"in",
"the",
"git",
"config",
"command",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L439-L453 |
36,188 | saltstack/salt | salt/modules/git.py | config_get | def config_get(key,
cwd=None,
user=None,
password=None,
ignore_retcode=False,
output_encoding=None,
**kwargs):
'''
Get the value of a key in the git configuration file
key
The name of the configuration key to ... | python | def config_get(key,
cwd=None,
user=None,
password=None,
ignore_retcode=False,
output_encoding=None,
**kwargs):
'''
Get the value of a key in the git configuration file
key
The name of the configuration key to ... | [
"def",
"config_get",
"(",
"key",
",",
"cwd",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"ignore_retcode",
"=",
"False",
",",
"output_encoding",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Sanitize kwargs and make sure ... | Get the value of a key in the git configuration file
key
The name of the configuration key to get
.. versionchanged:: 2015.8.0
Argument renamed from ``setting_name`` to ``key``
cwd
The path to the git checkout
.. versionchanged:: 2015.8.0
Now optional ... | [
"Get",
"the",
"value",
"of",
"a",
"key",
"in",
"the",
"git",
"configuration",
"file"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L1181-L1276 |
36,189 | saltstack/salt | salt/modules/git.py | current_branch | def current_branch(cwd,
user=None,
password=None,
ignore_retcode=False,
output_encoding=None):
'''
Returns the current branch name of a local checkout. If HEAD is detached,
return the SHA1 of the revision which is currently checked ... | python | def current_branch(cwd,
user=None,
password=None,
ignore_retcode=False,
output_encoding=None):
'''
Returns the current branch name of a local checkout. If HEAD is detached,
return the SHA1 of the revision which is currently checked ... | [
"def",
"current_branch",
"(",
"cwd",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"ignore_retcode",
"=",
"False",
",",
"output_encoding",
"=",
"None",
")",
":",
"cwd",
"=",
"_expand_path",
"(",
"cwd",
",",
"user",
")",
"command",
"=",
"... | Returns the current branch name of a local checkout. If HEAD is detached,
return the SHA1 of the revision which is currently checked out.
cwd
The path to the git checkout
user
User under which to run the git command. By default, the command is run
by the user under which the minion... | [
"Returns",
"the",
"current",
"branch",
"name",
"of",
"a",
"local",
"checkout",
".",
"If",
"HEAD",
"is",
"detached",
"return",
"the",
"SHA1",
"of",
"the",
"revision",
"which",
"is",
"currently",
"checked",
"out",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L1666-L1719 |
36,190 | saltstack/salt | salt/modules/git.py | remote_get | def remote_get(cwd,
remote='origin',
user=None,
password=None,
redact_auth=True,
ignore_retcode=False,
output_encoding=None):
'''
Get the fetch and push URL for a specific remote
cwd
The path to the git checko... | python | def remote_get(cwd,
remote='origin',
user=None,
password=None,
redact_auth=True,
ignore_retcode=False,
output_encoding=None):
'''
Get the fetch and push URL for a specific remote
cwd
The path to the git checko... | [
"def",
"remote_get",
"(",
"cwd",
",",
"remote",
"=",
"'origin'",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"redact_auth",
"=",
"True",
",",
"ignore_retcode",
"=",
"False",
",",
"output_encoding",
"=",
"None",
")",
":",
"cwd",
"=",
"_... | Get the fetch and push URL for a specific remote
cwd
The path to the git checkout
remote : origin
Name of the remote to query
user
User under which to run the git command. By default, the command is run
by the user under which the minion is running.
password
W... | [
"Get",
"the",
"fetch",
"and",
"push",
"URL",
"for",
"a",
"specific",
"remote"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L3748-L3823 |
36,191 | saltstack/salt | salt/modules/git.py | remote_set | def remote_set(cwd,
url,
remote='origin',
user=None,
password=None,
https_user=None,
https_pass=None,
push_url=None,
push_https_user=None,
push_https_pass=None,
ignore_re... | python | def remote_set(cwd,
url,
remote='origin',
user=None,
password=None,
https_user=None,
https_pass=None,
push_url=None,
push_https_user=None,
push_https_pass=None,
ignore_re... | [
"def",
"remote_set",
"(",
"cwd",
",",
"url",
",",
"remote",
"=",
"'origin'",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"https_user",
"=",
"None",
",",
"https_pass",
"=",
"None",
",",
"push_url",
"=",
"None",
",",
"push_https_user",
"... | cwd
The path to the git checkout
url
Remote URL to set
remote : origin
Name of the remote to set
push_url
If unset, the push URL will be identical to the fetch URL.
.. versionadded:: 2015.8.0
user
User under which to run the git command. By default, t... | [
"cwd",
"The",
"path",
"to",
"the",
"git",
"checkout"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L3962-L4098 |
36,192 | saltstack/salt | salt/modules/git.py | remotes | def remotes(cwd,
user=None,
password=None,
redact_auth=True,
ignore_retcode=False,
output_encoding=None):
'''
Get fetch and push URLs for each remote in a git checkout
cwd
The path to the git checkout
user
User under which to ... | python | def remotes(cwd,
user=None,
password=None,
redact_auth=True,
ignore_retcode=False,
output_encoding=None):
'''
Get fetch and push URLs for each remote in a git checkout
cwd
The path to the git checkout
user
User under which to ... | [
"def",
"remotes",
"(",
"cwd",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"redact_auth",
"=",
"True",
",",
"ignore_retcode",
"=",
"False",
",",
"output_encoding",
"=",
"None",
")",
":",
"cwd",
"=",
"_expand_path",
"(",
"cwd",
",",
"use... | Get fetch and push URLs for each remote in a git checkout
cwd
The path to the git checkout
user
User under which to run the git command. By default, the command is run
by the user under which the minion is running.
password
Windows only. Required when specifying ``user``. ... | [
"Get",
"fetch",
"and",
"push",
"URLs",
"for",
"each",
"remote",
"in",
"a",
"git",
"checkout"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L4101-L4189 |
36,193 | saltstack/salt | salt/modules/archive.py | _expand_sources | def _expand_sources(sources):
'''
Expands a user-provided specification of source files into a list of paths.
'''
if sources is None:
return []
if isinstance(sources, six.string_types):
sources = [x.strip() for x in sources.split(',')]
elif isinstance(sources, (float, six.integer... | python | def _expand_sources(sources):
'''
Expands a user-provided specification of source files into a list of paths.
'''
if sources is None:
return []
if isinstance(sources, six.string_types):
sources = [x.strip() for x in sources.split(',')]
elif isinstance(sources, (float, six.integer... | [
"def",
"_expand_sources",
"(",
"sources",
")",
":",
"if",
"sources",
"is",
"None",
":",
"return",
"[",
"]",
"if",
"isinstance",
"(",
"sources",
",",
"six",
".",
"string_types",
")",
":",
"sources",
"=",
"[",
"x",
".",
"strip",
"(",
")",
"for",
"x",
... | Expands a user-provided specification of source files into a list of paths. | [
"Expands",
"a",
"user",
"-",
"provided",
"specification",
"of",
"source",
"files",
"into",
"a",
"list",
"of",
"paths",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/archive.py#L450-L462 |
36,194 | saltstack/salt | salt/modules/archive.py | gzip | def gzip(sourcefile, template=None, runas=None, options=None):
'''
Uses the gzip command to create gzip files
template : None
Can be set to 'jinja' or another supported template engine to render
the command arguments before execution:
.. code-block:: bash
salt '*' arch... | python | def gzip(sourcefile, template=None, runas=None, options=None):
'''
Uses the gzip command to create gzip files
template : None
Can be set to 'jinja' or another supported template engine to render
the command arguments before execution:
.. code-block:: bash
salt '*' arch... | [
"def",
"gzip",
"(",
"sourcefile",
",",
"template",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'gzip'",
"]",
"if",
"options",
":",
"cmd",
".",
"append",
"(",
"options",
")",
"cmd",
".",
"append",... | Uses the gzip command to create gzip files
template : None
Can be set to 'jinja' or another supported template engine to render
the command arguments before execution:
.. code-block:: bash
salt '*' archive.gzip template=jinja /tmp/{{grains.id}}.txt
runas : None
Th... | [
"Uses",
"the",
"gzip",
"command",
"to",
"create",
"gzip",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/archive.py#L554-L590 |
36,195 | saltstack/salt | salt/modules/archive.py | gunzip | def gunzip(gzipfile, template=None, runas=None, options=None):
'''
Uses the gunzip command to unpack gzip files
template : None
Can be set to 'jinja' or another supported template engine to render
the command arguments before execution:
.. code-block:: bash
salt '*' ar... | python | def gunzip(gzipfile, template=None, runas=None, options=None):
'''
Uses the gunzip command to unpack gzip files
template : None
Can be set to 'jinja' or another supported template engine to render
the command arguments before execution:
.. code-block:: bash
salt '*' ar... | [
"def",
"gunzip",
"(",
"gzipfile",
",",
"template",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'gunzip'",
"]",
"if",
"options",
":",
"cmd",
".",
"append",
"(",
"options",
")",
"cmd",
".",
"append... | Uses the gunzip command to unpack gzip files
template : None
Can be set to 'jinja' or another supported template engine to render
the command arguments before execution:
.. code-block:: bash
salt '*' archive.gunzip template=jinja /tmp/{{grains.id}}.txt.gz
runas : None
... | [
"Uses",
"the",
"gunzip",
"command",
"to",
"unpack",
"gzip",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/archive.py#L594-L630 |
36,196 | saltstack/salt | salt/modules/archive.py | unzip | def unzip(zip_file,
dest,
excludes=None,
options=None,
template=None,
runas=None,
trim_output=False,
password=None,
extract_perms=True):
'''
Uses the ``zipfile`` Python module to unpack zip files
.. versionchanged:: 2015.5.0
... | python | def unzip(zip_file,
dest,
excludes=None,
options=None,
template=None,
runas=None,
trim_output=False,
password=None,
extract_perms=True):
'''
Uses the ``zipfile`` Python module to unpack zip files
.. versionchanged:: 2015.5.0
... | [
"def",
"unzip",
"(",
"zip_file",
",",
"dest",
",",
"excludes",
"=",
"None",
",",
"options",
"=",
"None",
",",
"template",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"trim_output",
"=",
"False",
",",
"password",
"=",
"None",
",",
"extract_perms",
"=",... | Uses the ``zipfile`` Python module to unpack zip files
.. versionchanged:: 2015.5.0
This function was rewritten to use Python's native zip file support.
The old functionality has been preserved in the new function
:mod:`archive.cmd_unzip <salt.modules.archive.cmd_unzip>`. For versions
... | [
"Uses",
"the",
"zipfile",
"Python",
"module",
"to",
"unpack",
"zip",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/archive.py#L960-L1119 |
36,197 | saltstack/salt | salt/modules/archive.py | rar | def rar(rarfile, sources, template=None, cwd=None, runas=None):
'''
Uses `rar for Linux`_ to create rar files
.. _`rar for Linux`: http://www.rarlab.com/
rarfile
Path of rar file to be created
sources
Comma-separated list of sources to include in the rar file. Sources can
... | python | def rar(rarfile, sources, template=None, cwd=None, runas=None):
'''
Uses `rar for Linux`_ to create rar files
.. _`rar for Linux`: http://www.rarlab.com/
rarfile
Path of rar file to be created
sources
Comma-separated list of sources to include in the rar file. Sources can
... | [
"def",
"rar",
"(",
"rarfile",
",",
"sources",
",",
"template",
"=",
"None",
",",
"cwd",
"=",
"None",
",",
"runas",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'rar'",
",",
"'a'",
",",
"'-idp'",
",",
"'{0}'",
".",
"format",
"(",
"rarfile",
")",
"]",
... | Uses `rar for Linux`_ to create rar files
.. _`rar for Linux`: http://www.rarlab.com/
rarfile
Path of rar file to be created
sources
Comma-separated list of sources to include in the rar file. Sources can
also be passed in a Python list.
.. versionchanged:: 2017.7.0
... | [
"Uses",
"rar",
"for",
"Linux",
"_",
"to",
"create",
"rar",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/archive.py#L1199-L1246 |
36,198 | saltstack/salt | salt/modules/archive.py | unrar | def unrar(rarfile, dest, excludes=None, template=None, runas=None, trim_output=False):
'''
Uses `rar for Linux`_ to unpack rar files
.. _`rar for Linux`: http://www.rarlab.com/
rarfile
Name of rar file to be unpacked
dest
The destination directory into which to **unpack** the rar ... | python | def unrar(rarfile, dest, excludes=None, template=None, runas=None, trim_output=False):
'''
Uses `rar for Linux`_ to unpack rar files
.. _`rar for Linux`: http://www.rarlab.com/
rarfile
Name of rar file to be unpacked
dest
The destination directory into which to **unpack** the rar ... | [
"def",
"unrar",
"(",
"rarfile",
",",
"dest",
",",
"excludes",
"=",
"None",
",",
"template",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"trim_output",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"excludes",
",",
"six",
".",
"string_types",
")",
... | Uses `rar for Linux`_ to unpack rar files
.. _`rar for Linux`: http://www.rarlab.com/
rarfile
Name of rar file to be unpacked
dest
The destination directory into which to **unpack** the rar file
template : None
Can be set to 'jinja' or another supported template engine to ren... | [
"Uses",
"rar",
"for",
"Linux",
"_",
"to",
"unpack",
"rar",
"files"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/archive.py#L1250-L1295 |
36,199 | saltstack/salt | salt/modules/archive.py | _trim_files | def _trim_files(files, trim_output):
'''
Trim the file list for output.
'''
count = 100
if not isinstance(trim_output, bool):
count = trim_output
if not(isinstance(trim_output, bool) and trim_output is False) and len(files) > count:
files = files[:count]
files.append("Li... | python | def _trim_files(files, trim_output):
'''
Trim the file list for output.
'''
count = 100
if not isinstance(trim_output, bool):
count = trim_output
if not(isinstance(trim_output, bool) and trim_output is False) and len(files) > count:
files = files[:count]
files.append("Li... | [
"def",
"_trim_files",
"(",
"files",
",",
"trim_output",
")",
":",
"count",
"=",
"100",
"if",
"not",
"isinstance",
"(",
"trim_output",
",",
"bool",
")",
":",
"count",
"=",
"trim_output",
"if",
"not",
"(",
"isinstance",
"(",
"trim_output",
",",
"bool",
")"... | Trim the file list for output. | [
"Trim",
"the",
"file",
"list",
"for",
"output",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/archive.py#L1351-L1363 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.