repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/smartos_vmadm.py | stop | def stop(vm, force=False, key='uuid'):
'''
Stop a vm
vm : string
vm to be stopped
force : boolean
force stop of vm if true
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.stop 186da9ab-7392-4... | python | def stop(vm, force=False, key='uuid'):
'''
Stop a vm
vm : string
vm to be stopped
force : boolean
force stop of vm if true
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.stop 186da9ab-7392-4... | [
"def",
"stop",
"(",
"vm",
",",
"force",
"=",
"False",
",",
"key",
"=",
"'uuid'",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"key",
"not",
"in",
"[",
"'uuid'",
",",
"'alias'",
",",
"'hostname'",
"]",
":",
"ret",
"[",
"'Error'",
"]",
"=",
"'Key must be ... | Stop a vm
vm : string
vm to be stopped
force : boolean
force stop of vm if true
key : string [uuid|alias|hostname]
value type of 'vm' parameter
CLI Example:
.. code-block:: bash
salt '*' vmadm.stop 186da9ab-7392-4f55-91a5-b8f1fe770543
salt '*' vmadm.stop 1... | [
"Stop",
"a",
"vm"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L204-L241 | train |
saltstack/salt | salt/modules/smartos_vmadm.py | list_vms | def list_vms(search=None, sort=None, order='uuid,type,ram,state,alias', keyed=True):
'''
Return a list of VMs
search : string
vmadm filter property
sort : string
vmadm sort (-s) property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
keyed... | python | def list_vms(search=None, sort=None, order='uuid,type,ram,state,alias', keyed=True):
'''
Return a list of VMs
search : string
vmadm filter property
sort : string
vmadm sort (-s) property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
keyed... | [
"def",
"list_vms",
"(",
"search",
"=",
"None",
",",
"sort",
"=",
"None",
",",
"order",
"=",
"'uuid,type,ram,state,alias'",
",",
"keyed",
"=",
"True",
")",
":",
"ret",
"=",
"{",
"}",
"# vmadm list [-p] [-H] [-o field,...] [-s field,...] [field=value ...]",
"cmd",
"... | Return a list of VMs
search : string
vmadm filter property
sort : string
vmadm sort (-s) property
order : string
vmadm order (-o) property -- Default: uuid,type,ram,state,alias
keyed : boolean
specified if the output should be an array (False) or dict (True)
... | [
"Return",
"a",
"list",
"of",
"VMs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smartos_vmadm.py#L284-L339 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/modules/win_dism.py | remove_package | def remove_package(package, image=None, restart=False):
'''
Uninstall 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. This can also be ... | python | def remove_package(package, image=None, restart=False):
'''
Uninstall 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. This can also be ... | [
"def",
"remove_package",
"(",
"package",
",",
"image",
"=",
"None",
",",
"restart",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"'DISM'",
",",
"'/Quiet'",
",",
"'/Image:{0}'",
".",
"format",
"(",
"image",
")",
"if",
"image",
"else",
"'/Online'",
",",
"'/R... | Uninstall 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. This can also be the name of a package as listed in
``dism.installed_pack... | [
"Uninstall",
"a",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_dism.py#L480-L520 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/modules/zfs.py | set | def set(*dataset, **kwargs):
'''
Sets the property or list of properties to the given value(s) for each dataset.
dataset : string
name of snapshot(s), filesystem(s), or volume(s)
properties : string
additional zfs properties pairs
.. note::
properties are passed as key-val... | python | def set(*dataset, **kwargs):
'''
Sets the property or list of properties to the given value(s) for each dataset.
dataset : string
name of snapshot(s), filesystem(s), or volume(s)
properties : string
additional zfs properties pairs
.. note::
properties are passed as key-val... | [
"def",
"set",
"(",
"*",
"dataset",
",",
"*",
"*",
"kwargs",
")",
":",
"## Configure command",
"# NOTE: push filesystem properties",
"filesystem_properties",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"## Set proper... | Sets the property or list of properties to the given value(s) for each dataset.
dataset : string
name of snapshot(s), filesystem(s), or volume(s)
properties : string
additional zfs properties pairs
.. note::
properties are passed as key-value pairs. e.g.
compression=o... | [
"Sets",
"the",
"property",
"or",
"list",
"of",
"properties",
"to",
"the",
"given",
"value",
"(",
"s",
")",
"for",
"each",
"dataset",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L1103-L1155 | train |
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 | train |
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 | train |
saltstack/salt | salt/utils/versions.py | kwargs_warn_until | def kwargs_warn_until(kwargs,
version,
category=DeprecationWarning,
stacklevel=None,
_version_info_=None,
_dont_call_warnings=False):
'''
Helper function to raise a warning (by default, a ``DeprecationW... | python | def kwargs_warn_until(kwargs,
version,
category=DeprecationWarning,
stacklevel=None,
_version_info_=None,
_dont_call_warnings=False):
'''
Helper function to raise a warning (by default, a ``DeprecationW... | [
"def",
"kwargs_warn_until",
"(",
"kwargs",
",",
"version",
",",
"category",
"=",
"DeprecationWarning",
",",
"stacklevel",
"=",
"None",
",",
"_version_info_",
"=",
"None",
",",
"_dont_call_warnings",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"vers... | Helper function to raise a warning (by default, a ``DeprecationWarning``)
when unhandled keyword arguments are passed to function, until the
provided ``version_info``, after which, a ``RuntimeError`` will be raised
to remind the developers to remove the ``**kwargs`` because the target
version has been r... | [
"Helper",
"function",
"to",
"raise",
"a",
"warning",
"(",
"by",
"default",
"a",
"DeprecationWarning",
")",
"when",
"unhandled",
"keyword",
"arguments",
"are",
"passed",
"to",
"function",
"until",
"the",
"provided",
"version_info",
"after",
"which",
"a",
"Runtime... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/versions.py#L165-L232 | train |
saltstack/salt | salt/utils/versions.py | version_cmp | def version_cmp(pkg1, pkg2, ignore_epoch=False):
'''
Compares two version strings using salt.utils.versions.LooseVersion. This
is a fallback for providers which don't have a version comparison utility
built into them. Return -1 if version1 < version2, 0 if version1 ==
version2, and 1 if version1 > ... | python | def version_cmp(pkg1, pkg2, ignore_epoch=False):
'''
Compares two version strings using salt.utils.versions.LooseVersion. This
is a fallback for providers which don't have a version comparison utility
built into them. Return -1 if version1 < version2, 0 if version1 ==
version2, and 1 if version1 > ... | [
"def",
"version_cmp",
"(",
"pkg1",
",",
"pkg2",
",",
"ignore_epoch",
"=",
"False",
")",
":",
"normalize",
"=",
"lambda",
"x",
":",
"six",
".",
"text_type",
"(",
"x",
")",
".",
"split",
"(",
"':'",
",",
"1",
")",
"[",
"-",
"1",
"]",
"if",
"ignore_... | Compares two version strings using salt.utils.versions.LooseVersion. This
is a fallback for providers which don't have a version comparison utility
built into them. Return -1 if version1 < version2, 0 if version1 ==
version2, and 1 if version1 > version2. Return None if there was a problem
making the c... | [
"Compares",
"two",
"version",
"strings",
"using",
"salt",
".",
"utils",
".",
"versions",
".",
"LooseVersion",
".",
"This",
"is",
"a",
"fallback",
"for",
"providers",
"which",
"don",
"t",
"have",
"a",
"version",
"comparison",
"utility",
"built",
"into",
"them... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/versions.py#L235-L258 | train |
saltstack/salt | salt/utils/versions.py | compare | def compare(ver1='', oper='==', ver2='', cmp_func=None, ignore_epoch=False):
'''
Compares two version numbers. Accepts a custom function to perform the
cmp-style version comparison, otherwise uses version_cmp().
'''
cmp_map = {'<': (-1,), '<=': (-1, 0), '==': (0,),
'>=': (0, 1), '>': ... | python | def compare(ver1='', oper='==', ver2='', cmp_func=None, ignore_epoch=False):
'''
Compares two version numbers. Accepts a custom function to perform the
cmp-style version comparison, otherwise uses version_cmp().
'''
cmp_map = {'<': (-1,), '<=': (-1, 0), '==': (0,),
'>=': (0, 1), '>': ... | [
"def",
"compare",
"(",
"ver1",
"=",
"''",
",",
"oper",
"=",
"'=='",
",",
"ver2",
"=",
"''",
",",
"cmp_func",
"=",
"None",
",",
"ignore_epoch",
"=",
"False",
")",
":",
"cmp_map",
"=",
"{",
"'<'",
":",
"(",
"-",
"1",
",",
")",
",",
"'<='",
":",
... | Compares two version numbers. Accepts a custom function to perform the
cmp-style version comparison, otherwise uses version_cmp(). | [
"Compares",
"two",
"version",
"numbers",
".",
"Accepts",
"a",
"custom",
"function",
"to",
"perform",
"the",
"cmp",
"-",
"style",
"version",
"comparison",
"otherwise",
"uses",
"version_cmp",
"()",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/versions.py#L261-L294 | train |
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 | train |
saltstack/salt | salt/states/boto_elbv2.py | create_target_group | def create_target_group(name, protocol, port, vpc_id,
region=None, key=None, keyid=None, profile=None,
health_check_protocol='HTTP', health_check_port='traffic-port',
health_check_path='/', health_check_interval_seconds=30,
... | python | def create_target_group(name, protocol, port, vpc_id,
region=None, key=None, keyid=None, profile=None,
health_check_protocol='HTTP', health_check_port='traffic-port',
health_check_path='/', health_check_interval_seconds=30,
... | [
"def",
"create_target_group",
"(",
"name",
",",
"protocol",
",",
"port",
",",
"vpc_id",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"health_check_protocol",
"=",
"'HTTP'",
",",
"health... | .. versionadded:: 2017.11.0
Create target group if not present.
name
(string) - The name of the target group.
protocol
(string) - The protocol to use for routing traffic to the targets
port
(int) - The port on which the targets receive traffic. This port is used unless
... | [
"..",
"versionadded",
"::",
"2017",
".",
"11",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elbv2.py#L58-L150 | train |
saltstack/salt | salt/states/boto_elbv2.py | delete_target_group | def delete_target_group(name, region=None, key=None, keyid=None, profile=None):
'''
Delete target group.
name
(string) - The Amazon Resource Name (ARN) of the resource.
returns
(bool) - True on success, False on failure.
CLI example:
.. code-block:: bash
check-target... | python | def delete_target_group(name, region=None, key=None, keyid=None, profile=None):
'''
Delete target group.
name
(string) - The Amazon Resource Name (ARN) of the resource.
returns
(bool) - True on success, False on failure.
CLI example:
.. code-block:: bash
check-target... | [
"def",
"delete_target_group",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"None",
",",
"'comment'",
... | Delete target group.
name
(string) - The Amazon Resource Name (ARN) of the resource.
returns
(bool) - True on success, False on failure.
CLI example:
.. code-block:: bash
check-target:
boto_elb2.delete_targets_group:
- name: myALB
- protocol... | [
"Delete",
"target",
"group",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elbv2.py#L153-L198 | train |
saltstack/salt | salt/states/boto_elbv2.py | targets_registered | def targets_registered(name, targets, region=None, key=None, keyid=None,
profile=None, **kwargs):
'''
.. versionadded:: 2017.7.0
Add targets to an Application Load Balancer target group. This state will not remove targets.
name
The ARN of the Application Load Balancer Ta... | python | def targets_registered(name, targets, region=None, key=None, keyid=None,
profile=None, **kwargs):
'''
.. versionadded:: 2017.7.0
Add targets to an Application Load Balancer target group. This state will not remove targets.
name
The ARN of the Application Load Balancer Ta... | [
"def",
"targets_registered",
"(",
"name",
",",
"targets",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
... | .. versionadded:: 2017.7.0
Add targets to an Application Load Balancer target group. This state will not remove targets.
name
The ARN of the Application Load Balancer Target Group to add targets to.
targets
A list of target IDs or a string of a single target that this target group should
... | [
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_elbv2.py#L201-L279 | train |
saltstack/salt | salt/modules/bamboohr.py | list_employees | def list_employees(order_by='id'):
'''
Show all employees for this company.
CLI Example:
salt myminion bamboohr.list_employees
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
duplica... | python | def list_employees(order_by='id'):
'''
Show all employees for this company.
CLI Example:
salt myminion bamboohr.list_employees
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
duplica... | [
"def",
"list_employees",
"(",
"order_by",
"=",
"'id'",
")",
":",
"ret",
"=",
"{",
"}",
"status",
",",
"result",
"=",
"_query",
"(",
"action",
"=",
"'employees'",
",",
"command",
"=",
"'directory'",
")",
"root",
"=",
"ET",
".",
"fromstring",
"(",
"resul... | Show all employees for this company.
CLI Example:
salt myminion bamboohr.list_employees
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 compan... | [
"Show",
"all",
"employees",
"for",
"this",
"company",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bamboohr.py#L45-L79 | train |
saltstack/salt | salt/modules/bamboohr.py | show_employee | def show_employee(emp_id, fields=None):
'''
Show all employees for this company.
CLI Example:
salt myminion bamboohr.show_employee 1138
By default, the fields normally returned from bamboohr.list_employees are
returned. These fields are:
- canUploadPhoto
- department
... | python | def show_employee(emp_id, fields=None):
'''
Show all employees for this company.
CLI Example:
salt myminion bamboohr.show_employee 1138
By default, the fields normally returned from bamboohr.list_employees are
returned. These fields are:
- canUploadPhoto
- department
... | [
"def",
"show_employee",
"(",
"emp_id",
",",
"fields",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"fields",
"is",
"None",
":",
"fields",
"=",
"','",
".",
"join",
"(",
"(",
"'canUploadPhoto'",
",",
"'department'",
",",
"'displayName'",
",",
"'fir... | Show all employees for this company.
CLI Example:
salt myminion bamboohr.show_employee 1138
By default, the fields normally returned from bamboohr.list_employees are
returned. These fields are:
- canUploadPhoto
- department
- displayName
- firstName
- id
... | [
"Show",
"all",
"employees",
"for",
"this",
"company",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/bamboohr.py#L82-L150 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/spm/pkgdb/sqlite3.py | info | def info(package, conn=None):
'''
List info for a package
'''
close = False
if conn is None:
close = True
conn = init()
fields = (
'package',
'version',
'release',
'installed',
'os',
'os_family',
'dependencies',
'os... | python | def info(package, conn=None):
'''
List info for a package
'''
close = False
if conn is None:
close = True
conn = init()
fields = (
'package',
'version',
'release',
'installed',
'os',
'os_family',
'dependencies',
'os... | [
"def",
"info",
"(",
"package",
",",
"conn",
"=",
"None",
")",
":",
"close",
"=",
"False",
"if",
"conn",
"is",
"None",
":",
"close",
"=",
"True",
"conn",
"=",
"init",
"(",
")",
"fields",
"=",
"(",
"'package'",
",",
"'version'",
",",
"'release'",
","... | List info for a package | [
"List",
"info",
"for",
"a",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/pkgdb/sqlite3.py#L72-L107 | train |
saltstack/salt | salt/spm/pkgdb/sqlite3.py | list_packages | def list_packages(conn=None):
'''
List files for an installed package
'''
close = False
if conn is None:
close = True
conn = init()
ret = []
data = conn.execute('SELECT package FROM packages')
for pkg in data.fetchall():
ret.append(pkg)
if close:
con... | python | def list_packages(conn=None):
'''
List files for an installed package
'''
close = False
if conn is None:
close = True
conn = init()
ret = []
data = conn.execute('SELECT package FROM packages')
for pkg in data.fetchall():
ret.append(pkg)
if close:
con... | [
"def",
"list_packages",
"(",
"conn",
"=",
"None",
")",
":",
"close",
"=",
"False",
"if",
"conn",
"is",
"None",
":",
"close",
"=",
"True",
"conn",
"=",
"init",
"(",
")",
"ret",
"=",
"[",
"]",
"data",
"=",
"conn",
".",
"execute",
"(",
"'SELECT packag... | List files for an installed package | [
"List",
"files",
"for",
"an",
"installed",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/pkgdb/sqlite3.py#L110-L126 | train |
saltstack/salt | salt/spm/pkgdb/sqlite3.py | list_files | def list_files(package, conn=None):
'''
List files for an installed package
'''
close = False
if conn is None:
close = True
conn = init()
data = conn.execute('SELECT package FROM packages WHERE package=?', (package, ))
if not data.fetchone():
if close:
co... | python | def list_files(package, conn=None):
'''
List files for an installed package
'''
close = False
if conn is None:
close = True
conn = init()
data = conn.execute('SELECT package FROM packages WHERE package=?', (package, ))
if not data.fetchone():
if close:
co... | [
"def",
"list_files",
"(",
"package",
",",
"conn",
"=",
"None",
")",
":",
"close",
"=",
"False",
"if",
"conn",
"is",
"None",
":",
"close",
"=",
"True",
"conn",
"=",
"init",
"(",
")",
"data",
"=",
"conn",
".",
"execute",
"(",
"'SELECT package FROM packag... | List files for an installed package | [
"List",
"files",
"for",
"an",
"installed",
"package"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/pkgdb/sqlite3.py#L129-L151 | train |
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 | train |
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 | train |
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 | train |
saltstack/salt | salt/proxy/bluecoat_sslv.py | init | def init(opts):
'''
This function gets called when the proxy starts up.
'''
if 'host' not in opts['proxy']:
log.critical('No \'host\' key found in pillar for this proxy.')
return False
if 'username' not in opts['proxy']:
log.critical('No \'username\' key found in pillar for t... | python | def init(opts):
'''
This function gets called when the proxy starts up.
'''
if 'host' not in opts['proxy']:
log.critical('No \'host\' key found in pillar for this proxy.')
return False
if 'username' not in opts['proxy']:
log.critical('No \'username\' key found in pillar for t... | [
"def",
"init",
"(",
"opts",
")",
":",
"if",
"'host'",
"not",
"in",
"opts",
"[",
"'proxy'",
"]",
":",
"log",
".",
"critical",
"(",
"'No \\'host\\' key found in pillar for this proxy.'",
")",
"return",
"False",
"if",
"'username'",
"not",
"in",
"opts",
"[",
"'p... | This function gets called when the proxy starts up. | [
"This",
"function",
"gets",
"called",
"when",
"the",
"proxy",
"starts",
"up",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/bluecoat_sslv.py#L110-L142 | train |
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 | train |
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 | train |
saltstack/salt | salt/proxy/bluecoat_sslv.py | logout | def logout(session, cookies, csrf_token):
'''
Closes the session with the device.
'''
payload = {"jsonrpc": "2.0",
"id": "ID0",
"method": "logout",
"params": []
}
session.post(DETAILS['url'],
data=json.dumps(payload),
... | python | def logout(session, cookies, csrf_token):
'''
Closes the session with the device.
'''
payload = {"jsonrpc": "2.0",
"id": "ID0",
"method": "logout",
"params": []
}
session.post(DETAILS['url'],
data=json.dumps(payload),
... | [
"def",
"logout",
"(",
"session",
",",
"cookies",
",",
"csrf_token",
")",
":",
"payload",
"=",
"{",
"\"jsonrpc\"",
":",
"\"2.0\"",
",",
"\"id\"",
":",
"\"ID0\"",
",",
"\"method\"",
":",
"\"logout\"",
",",
"\"params\"",
":",
"[",
"]",
"}",
"session",
".",
... | Closes the session with the device. | [
"Closes",
"the",
"session",
"with",
"the",
"device",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/bluecoat_sslv.py#L201-L213 | train |
saltstack/salt | salt/proxy/bluecoat_sslv.py | grains | def grains():
'''
Get the grains from the proxied device
'''
if not DETAILS.get('grains_cache', {}):
DETAILS['grains_cache'] = GRAINS_CACHE
try:
DETAILS['grains_cache'] = _get_grain_information()
except salt.exceptions.CommandExecutionError:
pass
e... | python | def grains():
'''
Get the grains from the proxied device
'''
if not DETAILS.get('grains_cache', {}):
DETAILS['grains_cache'] = GRAINS_CACHE
try:
DETAILS['grains_cache'] = _get_grain_information()
except salt.exceptions.CommandExecutionError:
pass
e... | [
"def",
"grains",
"(",
")",
":",
"if",
"not",
"DETAILS",
".",
"get",
"(",
"'grains_cache'",
",",
"{",
"}",
")",
":",
"DETAILS",
"[",
"'grains_cache'",
"]",
"=",
"GRAINS_CACHE",
"try",
":",
"DETAILS",
"[",
"'grains_cache'",
"]",
"=",
"_get_grain_information"... | Get the grains from the proxied device | [
"Get",
"the",
"grains",
"from",
"the",
"proxied",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/bluecoat_sslv.py#L250-L262 | train |
saltstack/salt | salt/proxy/bluecoat_sslv.py | ping | def ping():
'''
Returns true if the device is reachable, else false.
'''
try:
session, cookies, csrf_token = logon()
logout(session, cookies, csrf_token)
except salt.exceptions.CommandExecutionError:
return False
except Exception as err:
log.debug(err)
ret... | python | def ping():
'''
Returns true if the device is reachable, else false.
'''
try:
session, cookies, csrf_token = logon()
logout(session, cookies, csrf_token)
except salt.exceptions.CommandExecutionError:
return False
except Exception as err:
log.debug(err)
ret... | [
"def",
"ping",
"(",
")",
":",
"try",
":",
"session",
",",
"cookies",
",",
"csrf_token",
"=",
"logon",
"(",
")",
"logout",
"(",
"session",
",",
"cookies",
",",
"csrf_token",
")",
"except",
"salt",
".",
"exceptions",
".",
"CommandExecutionError",
":",
"ret... | Returns true if the device is reachable, else false. | [
"Returns",
"true",
"if",
"the",
"device",
"is",
"reachable",
"else",
"false",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/bluecoat_sslv.py#L273-L285 | train |
saltstack/salt | salt/runners/ssh.py | cmd | def cmd(tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
kwarg=None):
'''
.. versionadded:: 2015.5.0
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Execute a singl... | python | def cmd(tgt,
fun,
arg=(),
timeout=None,
tgt_type='glob',
kwarg=None):
'''
.. versionadded:: 2015.5.0
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Execute a singl... | [
"def",
"cmd",
"(",
"tgt",
",",
"fun",
",",
"arg",
"=",
"(",
")",
",",
"timeout",
"=",
"None",
",",
"tgt_type",
"=",
"'glob'",
",",
"kwarg",
"=",
"None",
")",
":",
"client",
"=",
"salt",
".",
"client",
".",
"ssh",
".",
"client",
".",
"SSHClient",
... | .. versionadded:: 2015.5.0
.. versionchanged:: 2017.7.0
The ``expr_form`` argument has been renamed to ``tgt_type``, earlier
releases must use ``expr_form``.
Execute a single command via the salt-ssh subsystem and return all
routines at once
A wrapper around the :py:meth:`SSHClient.cmd... | [
"..",
"versionadded",
"::",
"2015",
".",
"5",
".",
"0",
"..",
"versionchanged",
"::",
"2017",
".",
"7",
".",
"0",
"The",
"expr_form",
"argument",
"has",
"been",
"renamed",
"to",
"tgt_type",
"earlier",
"releases",
"must",
"use",
"expr_form",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/ssh.py#L15-L40 | train |
saltstack/salt | salt/tokens/localfs.py | mk_token | def mk_token(opts, tdata):
'''
Mint a new token using the config option hash_type and store tdata with 'token' attribute set
to the token.
This module uses the hash of random 512 bytes as a token.
:param opts: Salt master config options
:param tdata: Token data to be stored with 'token' attirbu... | python | def mk_token(opts, tdata):
'''
Mint a new token using the config option hash_type and store tdata with 'token' attribute set
to the token.
This module uses the hash of random 512 bytes as a token.
:param opts: Salt master config options
:param tdata: Token data to be stored with 'token' attirbu... | [
"def",
"mk_token",
"(",
"opts",
",",
"tdata",
")",
":",
"hash_type",
"=",
"getattr",
"(",
"hashlib",
",",
"opts",
".",
"get",
"(",
"'hash_type'",
",",
"'md5'",
")",
")",
"tok",
"=",
"six",
".",
"text_type",
"(",
"hash_type",
"(",
"os",
".",
"urandom"... | Mint a new token using the config option hash_type and store tdata with 'token' attribute set
to the token.
This module uses the hash of random 512 bytes as a token.
:param opts: Salt master config options
:param tdata: Token data to be stored with 'token' attirbute of this dict set to the token.
:... | [
"Mint",
"a",
"new",
"token",
"using",
"the",
"config",
"option",
"hash_type",
"and",
"store",
"tdata",
"with",
"token",
"attribute",
"set",
"to",
"the",
"token",
".",
"This",
"module",
"uses",
"the",
"hash",
"of",
"random",
"512",
"bytes",
"as",
"a",
"to... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/localfs.py#L24-L50 | train |
saltstack/salt | salt/tokens/localfs.py | get_token | def get_token(opts, tok):
'''
Fetch the token data from the store.
:param opts: Salt master config options
:param tok: Token value to get
:returns: Token data if successful. Empty dict if failed.
'''
t_path = os.path.join(opts['token_dir'], tok)
if not os.path.isfile(t_path):
re... | python | def get_token(opts, tok):
'''
Fetch the token data from the store.
:param opts: Salt master config options
:param tok: Token value to get
:returns: Token data if successful. Empty dict if failed.
'''
t_path = os.path.join(opts['token_dir'], tok)
if not os.path.isfile(t_path):
re... | [
"def",
"get_token",
"(",
"opts",
",",
"tok",
")",
":",
"t_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"opts",
"[",
"'token_dir'",
"]",
",",
"tok",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"t_path",
")",
":",
"return",
"{",
... | Fetch the token data from the store.
:param opts: Salt master config options
:param tok: Token value to get
:returns: Token data if successful. Empty dict if failed. | [
"Fetch",
"the",
"token",
"data",
"from",
"the",
"store",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/localfs.py#L53-L72 | train |
saltstack/salt | salt/tokens/localfs.py | rm_token | def rm_token(opts, tok):
'''
Remove token from the store.
:param opts: Salt master config options
:param tok: Token to remove
:returns: Empty dict if successful. None if failed.
'''
t_path = os.path.join(opts['token_dir'], tok)
try:
os.remove(t_path)
return {}
except... | python | def rm_token(opts, tok):
'''
Remove token from the store.
:param opts: Salt master config options
:param tok: Token to remove
:returns: Empty dict if successful. None if failed.
'''
t_path = os.path.join(opts['token_dir'], tok)
try:
os.remove(t_path)
return {}
except... | [
"def",
"rm_token",
"(",
"opts",
",",
"tok",
")",
":",
"t_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"opts",
"[",
"'token_dir'",
"]",
",",
"tok",
")",
"try",
":",
"os",
".",
"remove",
"(",
"t_path",
")",
"return",
"{",
"}",
"except",
"(",
... | Remove token from the store.
:param opts: Salt master config options
:param tok: Token to remove
:returns: Empty dict if successful. None if failed. | [
"Remove",
"token",
"from",
"the",
"store",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/localfs.py#L75-L88 | train |
saltstack/salt | salt/tokens/localfs.py | list_tokens | def list_tokens(opts):
'''
List all tokens in the store.
:param opts: Salt master config options
:returns: List of dicts (tokens)
'''
ret = []
for (dirpath, dirnames, filenames) in salt.utils.path.os_walk(opts['token_dir']):
for token in filenames:
ret.append(token)
... | python | def list_tokens(opts):
'''
List all tokens in the store.
:param opts: Salt master config options
:returns: List of dicts (tokens)
'''
ret = []
for (dirpath, dirnames, filenames) in salt.utils.path.os_walk(opts['token_dir']):
for token in filenames:
ret.append(token)
... | [
"def",
"list_tokens",
"(",
"opts",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"(",
"dirpath",
",",
"dirnames",
",",
"filenames",
")",
"in",
"salt",
".",
"utils",
".",
"path",
".",
"os_walk",
"(",
"opts",
"[",
"'token_dir'",
"]",
")",
":",
"for",
"token... | List all tokens in the store.
:param opts: Salt master config options
:returns: List of dicts (tokens) | [
"List",
"all",
"tokens",
"in",
"the",
"store",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tokens/localfs.py#L91-L102 | train |
saltstack/salt | salt/utils/path.py | islink | def islink(path):
'''
Equivalent to os.path.islink()
'''
if six.PY3 or not salt.utils.platform.is_windows():
return os.path.islink(path)
if not HAS_WIN32FILE:
log.error('Cannot check if %s is a link, missing required modules', path)
if not _is_reparse_point(path):
retur... | python | def islink(path):
'''
Equivalent to os.path.islink()
'''
if six.PY3 or not salt.utils.platform.is_windows():
return os.path.islink(path)
if not HAS_WIN32FILE:
log.error('Cannot check if %s is a link, missing required modules', path)
if not _is_reparse_point(path):
retur... | [
"def",
"islink",
"(",
"path",
")",
":",
"if",
"six",
".",
"PY3",
"or",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"islink",
"(",
"path",
")",
"if",
"not",
"HAS_WIN32FILE",
":",
... | Equivalent to os.path.islink() | [
"Equivalent",
"to",
"os",
".",
"path",
".",
"islink",
"()"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/path.py#L41-L73 | train |
saltstack/salt | salt/utils/path.py | readlink | def readlink(path):
'''
Equivalent to os.readlink()
'''
if six.PY3 or not salt.utils.platform.is_windows():
return os.readlink(path)
if not HAS_WIN32FILE:
log.error('Cannot read %s, missing required modules', path)
reparse_data = _get_reparse_data(path)
if not reparse_data... | python | def readlink(path):
'''
Equivalent to os.readlink()
'''
if six.PY3 or not salt.utils.platform.is_windows():
return os.readlink(path)
if not HAS_WIN32FILE:
log.error('Cannot read %s, missing required modules', path)
reparse_data = _get_reparse_data(path)
if not reparse_data... | [
"def",
"readlink",
"(",
"path",
")",
":",
"if",
"six",
".",
"PY3",
"or",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"return",
"os",
".",
"readlink",
"(",
"path",
")",
"if",
"not",
"HAS_WIN32FILE",
":",
"log",
".... | Equivalent to os.readlink() | [
"Equivalent",
"to",
"os",
".",
"readlink",
"()"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/path.py#L76-L136 | train |
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 | train |
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 | train |
saltstack/salt | salt/utils/path.py | which | def which(exe=None):
'''
Python clone of /usr/bin/which
'''
if not exe:
log.error('No executable was passed to be searched by salt.utils.path.which()')
return None
## define some utilities (we use closures here because our predecessor used them)
def is_executable_common(path):
... | python | def which(exe=None):
'''
Python clone of /usr/bin/which
'''
if not exe:
log.error('No executable was passed to be searched by salt.utils.path.which()')
return None
## define some utilities (we use closures here because our predecessor used them)
def is_executable_common(path):
... | [
"def",
"which",
"(",
"exe",
"=",
"None",
")",
":",
"if",
"not",
"exe",
":",
"log",
".",
"error",
"(",
"'No executable was passed to be searched by salt.utils.path.which()'",
")",
"return",
"None",
"## define some utilities (we use closures here because our predecessor used th... | Python clone of /usr/bin/which | [
"Python",
"clone",
"of",
"/",
"usr",
"/",
"bin",
"/",
"which"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/path.py#L192-L300 | train |
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 | train |
saltstack/salt | salt/utils/path.py | join | def join(*parts, **kwargs):
'''
This functions tries to solve some issues when joining multiple absolute
paths on both *nix and windows platforms.
See tests/unit/utils/path_join_test.py for some examples on what's being
talked about here.
The "use_posixpath" kwarg can be be used to force joini... | python | def join(*parts, **kwargs):
'''
This functions tries to solve some issues when joining multiple absolute
paths on both *nix and windows platforms.
See tests/unit/utils/path_join_test.py for some examples on what's being
talked about here.
The "use_posixpath" kwarg can be be used to force joini... | [
"def",
"join",
"(",
"*",
"parts",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"six",
".",
"PY3",
":",
"new_parts",
"=",
"[",
"]",
"for",
"part",
"in",
"parts",
":",
"new_parts",
".",
"append",
"(",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_... | This functions tries to solve some issues when joining multiple absolute
paths on both *nix and windows platforms.
See tests/unit/utils/path_join_test.py for some examples on what's being
talked about here.
The "use_posixpath" kwarg can be be used to force joining using poxixpath,
which is useful ... | [
"This",
"functions",
"tries",
"to",
"solve",
"some",
"issues",
"when",
"joining",
"multiple",
"absolute",
"paths",
"on",
"both",
"*",
"nix",
"and",
"windows",
"platforms",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/path.py#L318-L357 | train |
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 | train |
saltstack/salt | salt/utils/path.py | safe_path | def safe_path(path, allow_path=None):
r'''
.. versionadded:: 2017.7.3
Checks that the path is safe for modification by Salt. For example, you
wouldn't want to have salt delete the contents of ``C:\Windows``. The
following directories are considered unsafe:
- C:\, D:\, E:\, etc.
- \
- C... | python | def safe_path(path, allow_path=None):
r'''
.. versionadded:: 2017.7.3
Checks that the path is safe for modification by Salt. For example, you
wouldn't want to have salt delete the contents of ``C:\Windows``. The
following directories are considered unsafe:
- C:\, D:\, E:\, etc.
- \
- C... | [
"def",
"safe_path",
"(",
"path",
",",
"allow_path",
"=",
"None",
")",
":",
"# Create regex definitions for directories that may be unsafe to modify",
"system_root",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'SystemRoot'",
",",
"'C:\\\\Windows'",
")",
"deny_paths",
... | r'''
.. versionadded:: 2017.7.3
Checks that the path is safe for modification by Salt. For example, you
wouldn't want to have salt delete the contents of ``C:\Windows``. The
following directories are considered unsafe:
- C:\, D:\, E:\, etc.
- \
- C:\Windows
Args:
path (str): ... | [
"r",
"..",
"versionadded",
"::",
"2017",
".",
"7",
".",
"3"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/path.py#L389-L443 | train |
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 | train |
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 | train |
saltstack/salt | salt/modules/ebuildpkg.py | check_db | def check_db(*names, **kwargs):
'''
.. versionadded:: 0.17.0
Returns a dict containing the following information for each specified
package:
1. A key ``found``, which will be a boolean value denoting if a match was
found in the package database.
2. If ``found`` is ``False``, then a seco... | python | def check_db(*names, **kwargs):
'''
.. versionadded:: 0.17.0
Returns a dict containing the following information for each specified
package:
1. A key ``found``, which will be a boolean value denoting if a match was
found in the package database.
2. If ``found`` is ``False``, then a seco... | [
"def",
"check_db",
"(",
"*",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"### NOTE: kwargs is not used here but needs to be present due to it being",
"### required in the check_db function in other package providers.",
"ret",
"=",
"{",
"}",
"for",
"name",
"in",
"names",
":"... | .. versionadded:: 0.17.0
Returns a dict containing the following information for each specified
package:
1. A key ``found``, which will be a boolean value denoting if a match was
found in the package database.
2. If ``found`` is ``False``, then a second key called ``suggestions`` will
be... | [
"..",
"versionadded",
"::",
"0",
".",
"17",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L173-L211 | train |
saltstack/salt | salt/modules/ebuildpkg.py | _get_upgradable | def _get_upgradable(backtrack=3):
'''
Utility function to get upgradable packages
Sample return data:
{ 'pkgname': '1.2.3-45', ... }
'''
cmd = ['emerge',
'--ask', 'n',
'--backtrack', '{0}'.format(backtrack),
'--pretend',
'--update',
'--new... | python | def _get_upgradable(backtrack=3):
'''
Utility function to get upgradable packages
Sample return data:
{ 'pkgname': '1.2.3-45', ... }
'''
cmd = ['emerge',
'--ask', 'n',
'--backtrack', '{0}'.format(backtrack),
'--pretend',
'--update',
'--new... | [
"def",
"_get_upgradable",
"(",
"backtrack",
"=",
"3",
")",
":",
"cmd",
"=",
"[",
"'emerge'",
",",
"'--ask'",
",",
"'n'",
",",
"'--backtrack'",
",",
"'{0}'",
".",
"format",
"(",
"backtrack",
")",
",",
"'--pretend'",
",",
"'--update'",
",",
"'--newuse'",
"... | Utility function to get upgradable packages
Sample return data:
{ 'pkgname': '1.2.3-45', ... } | [
"Utility",
"function",
"to",
"get",
"upgradable",
"packages"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L288-L335 | train |
saltstack/salt | salt/modules/ebuildpkg.py | list_upgrades | def list_upgrades(refresh=True, backtrack=3, **kwargs): # pylint: disable=W0613
'''
List all available package upgrades.
refresh
Whether or not to sync the portage tree before checking for upgrades.
backtrack
Specifies an integer number of times to backtrack if dependency
calc... | python | def list_upgrades(refresh=True, backtrack=3, **kwargs): # pylint: disable=W0613
'''
List all available package upgrades.
refresh
Whether or not to sync the portage tree before checking for upgrades.
backtrack
Specifies an integer number of times to backtrack if dependency
calc... | [
"def",
"list_upgrades",
"(",
"refresh",
"=",
"True",
",",
"backtrack",
"=",
"3",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"refresh",
")",
":",
"refresh_db",
"(",
")",
"r... | List all available package upgrades.
refresh
Whether or not to sync the portage tree before checking for upgrades.
backtrack
Specifies an integer number of times to backtrack if dependency
calculation fails due to a conflict or an unsatisfied dependency
(default: ´3´).
... | [
"List",
"all",
"available",
"package",
"upgrades",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L338-L360 | train |
saltstack/salt | salt/modules/ebuildpkg.py | porttree_matches | def porttree_matches(name):
'''
Returns a list containing the matches for a given package name from the
portage tree. Note that the specific version of the package will not be
provided for packages that have several versions in the portage tree, but
rather the name of the package (i.e. "dev-python/p... | python | def porttree_matches(name):
'''
Returns a list containing the matches for a given package name from the
portage tree. Note that the specific version of the package will not be
provided for packages that have several versions in the portage tree, but
rather the name of the package (i.e. "dev-python/p... | [
"def",
"porttree_matches",
"(",
"name",
")",
":",
"matches",
"=",
"[",
"]",
"for",
"category",
"in",
"_porttree",
"(",
")",
".",
"dbapi",
".",
"categories",
":",
"if",
"_porttree",
"(",
")",
".",
"dbapi",
".",
"cp_list",
"(",
"category",
"+",
"\"/\"",
... | Returns a list containing the matches for a given package name from the
portage tree. Note that the specific version of the package will not be
provided for packages that have several versions in the portage tree, but
rather the name of the package (i.e. "dev-python/paramiko"). | [
"Returns",
"a",
"list",
"containing",
"the",
"matches",
"for",
"a",
"given",
"package",
"name",
"from",
"the",
"portage",
"tree",
".",
"Note",
"that",
"the",
"specific",
"version",
"of",
"the",
"package",
"will",
"not",
"be",
"provided",
"for",
"packages",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L392-L403 | train |
saltstack/salt | salt/modules/ebuildpkg.py | list_pkgs | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the packages currently installed in a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
versions_as_list = salt.utils.data.is_true(versions_as_list)
# not yet imple... | python | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the packages currently installed in a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
versions_as_list = salt.utils.data.is_true(versions_as_list)
# not yet imple... | [
"def",
"list_pkgs",
"(",
"versions_as_list",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"versions_as_list",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"versions_as_list",
")",
"# not yet implemented or not applicable",
"if",
"any",
"(",
... | List the packages currently installed in a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs | [
"List",
"the",
"packages",
"currently",
"installed",
"in",
"a",
"dict",
"::"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L406-L442 | train |
saltstack/salt | salt/modules/ebuildpkg.py | refresh_db | def refresh_db(**kwargs):
'''
Update the portage tree using the first available method from the following
list:
- emaint sync
- eix-sync
- emerge-webrsync
- emerge --sync
To prevent the portage tree from being synced within one day of the
previous sync, add the following pillar dat... | python | def refresh_db(**kwargs):
'''
Update the portage tree using the first available method from the following
list:
- emaint sync
- eix-sync
- emerge-webrsync
- emerge --sync
To prevent the portage tree from being synced within one day of the
previous sync, add the following pillar dat... | [
"def",
"refresh_db",
"(",
"*",
"*",
"kwargs",
")",
":",
"has_emaint",
"=",
"os",
".",
"path",
".",
"isdir",
"(",
"'/etc/portage/repos.conf'",
")",
"has_eix",
"=",
"True",
"if",
"'eix.sync'",
"in",
"__salt__",
"else",
"False",
"has_webrsync",
"=",
"True",
"... | Update the portage tree using the first available method from the following
list:
- emaint sync
- eix-sync
- emerge-webrsync
- emerge --sync
To prevent the portage tree from being synced within one day of the
previous sync, add the following pillar data for this minion:
.. code-block:... | [
"Update",
"the",
"portage",
"tree",
"using",
"the",
"first",
"available",
"method",
"from",
"the",
"following",
"list",
":"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L445-L499 | train |
saltstack/salt | salt/modules/ebuildpkg.py | install | def install(name=None,
refresh=False,
pkgs=None,
sources=None,
slot=None,
fromrepo=None,
uses=None,
binhost=None,
**kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=20... | python | def install(name=None,
refresh=False,
pkgs=None,
sources=None,
slot=None,
fromrepo=None,
uses=None,
binhost=None,
**kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=20... | [
"def",
"install",
"(",
"name",
"=",
"None",
",",
"refresh",
"=",
"False",
",",
"pkgs",
"=",
"None",
",",
"sources",
"=",
"None",
",",
"slot",
"=",
"None",
",",
"fromrepo",
"=",
"None",
",",
"uses",
"=",
"None",
",",
"binhost",
"=",
"None",
",",
"... | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd
from killing any emerge commands spawned by Sa... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L521-L767 | train |
saltstack/salt | salt/modules/ebuildpkg.py | update | def update(pkg, slot=None, fromrepo=None, refresh=False, binhost=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's cont... | python | def update(pkg, slot=None, fromrepo=None, refresh=False, binhost=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's cont... | [
"def",
"update",
"(",
"pkg",
",",
"slot",
"=",
"None",
",",
"fromrepo",
"=",
"None",
",",
"refresh",
"=",
"False",
",",
"binhost",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"refr... | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd
from killing any emerge commands spawned by Sa... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L770-L860 | train |
saltstack/salt | salt/modules/ebuildpkg.py | remove | def remove(name=None, slot=None, fromrepo=None, pkgs=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. T... | python | def remove(name=None, slot=None, fromrepo=None, pkgs=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. T... | [
"def",
"remove",
"(",
"name",
"=",
"None",
",",
"slot",
"=",
"None",
",",
"fromrepo",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"pkg_params",
"=",
"__salt__",
"[",
"'pkg_resource.parse_targets'",
"]",
"(",
... | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd
from killing any emerge commands spawned by Sa... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L953-L1049 | train |
saltstack/salt | salt/modules/ebuildpkg.py | purge | def purge(name=None, slot=None, fromrepo=None, pkgs=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. Th... | python | def purge(name=None, slot=None, fromrepo=None, pkgs=None, **kwargs):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. Th... | [
"def",
"purge",
"(",
"name",
"=",
"None",
",",
"slot",
"=",
"None",
",",
"fromrepo",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"remove",
"(",
"name",
"=",
"name",
",",
"slot",
"=",
"slot",
",",
"fromr... | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands which modify installed packages from the
``salt-minion`` daemon's control group. This is done to keep systemd
from killing any emerge commands spawned by Sa... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L1052-L1102 | train |
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 | train |
saltstack/salt | salt/modules/ebuildpkg.py | version_cmp | def version_cmp(pkg1, pkg2, **kwargs):
'''
Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if
pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem
making the comparison.
CLI Example:
.. code-block:: bash
salt '*' pkg.version_cmp '0.2.4-0' '0.2.... | python | def version_cmp(pkg1, pkg2, **kwargs):
'''
Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if
pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem
making the comparison.
CLI Example:
.. code-block:: bash
salt '*' pkg.version_cmp '0.2.4-0' '0.2.... | [
"def",
"version_cmp",
"(",
"pkg1",
",",
"pkg2",
",",
"*",
"*",
"kwargs",
")",
":",
"# ignore_epoch is not supported here, but has to be included for API",
"# compatibility. Rather than putting this argument into the function",
"# definition (and thus have it show up in the docs), we just... | Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if
pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem
making the comparison.
CLI Example:
.. code-block:: bash
salt '*' pkg.version_cmp '0.2.4-0' '0.2.4.1-0' | [
"Do",
"a",
"cmp",
"-",
"style",
"comparison",
"on",
"two",
"packages",
".",
"Return",
"-",
"1",
"if",
"pkg1",
"<",
"pkg2",
"0",
"if",
"pkg1",
"==",
"pkg2",
"and",
"1",
"if",
"pkg1",
">",
"pkg2",
".",
"Return",
"None",
"if",
"there",
"was",
"a",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ebuildpkg.py#L1157-L1185 | train |
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 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.