partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | vm_info | Return detailed information about the vms.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_info | salt/modules/xapi_virt.py | def vm_info(vm_=None):
'''
Return detailed information about the vms.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_info
'''
with _get_xapi_session()... | def vm_info(vm_=None):
'''
Return detailed information about the vms.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_info
'''
with _get_xapi_session()... | [
"Return",
"detailed",
"information",
"about",
"the",
"vms",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L200-L240 | [
"def",
"vm_info",
"(",
"vm_",
"=",
"None",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"def",
"_info",
"(",
"vm_",
")",
":",
"vm_rec",
"=",
"_get_record_by_label",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_rec",
"is... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | vm_state | Return list of all the vms and their state.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_state <vm name> | salt/modules/xapi_virt.py | def vm_state(vm_=None):
'''
Return list of all the vms and their state.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_state <vm name>
'''
with _get_x... | def vm_state(vm_=None):
'''
Return list of all the vms and their state.
If you pass a VM name in as an argument then it will return info
for just the named VM, otherwise it will return all VMs.
CLI Example:
.. code-block:: bash
salt '*' virt.vm_state <vm name>
'''
with _get_x... | [
"Return",
"list",
"of",
"all",
"the",
"vms",
"and",
"their",
"state",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L243-L265 | [
"def",
"vm_state",
"(",
"vm_",
"=",
"None",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"info",
"=",
"{",
"}",
"if",
"vm_",
":",
"info",
"[",
"vm_",
"]",
"=",
"_get_record_by_label",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | node_info | Return a dict with information about this node
CLI Example:
.. code-block:: bash
salt '*' virt.node_info | salt/modules/xapi_virt.py | def node_info():
'''
Return a dict with information about this node
CLI Example:
.. code-block:: bash
salt '*' virt.node_info
'''
with _get_xapi_session() as xapi:
# get node uuid
host_rec = _get_record(xapi, 'host', _get_all(xapi, 'host')[0])
# get first CPU (... | def node_info():
'''
Return a dict with information about this node
CLI Example:
.. code-block:: bash
salt '*' virt.node_info
'''
with _get_xapi_session() as xapi:
# get node uuid
host_rec = _get_record(xapi, 'host', _get_all(xapi, 'host')[0])
# get first CPU (... | [
"Return",
"a",
"dict",
"with",
"information",
"about",
"this",
"node"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L268-L350 | [
"def",
"node_info",
"(",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"# get node uuid",
"host_rec",
"=",
"_get_record",
"(",
"xapi",
",",
"'host'",
",",
"_get_all",
"(",
"xapi",
",",
"'host'",
")",
"[",
"0",
"]",
")",
"# get first... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_nics | Return info about the network interfaces of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_nics <vm name> | salt/modules/xapi_virt.py | def get_nics(vm_):
'''
Return info about the network interfaces of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_nics <vm name>
'''
with _get_xapi_session() as xapi:
nic = {}
vm_rec = _get_record_by_label(xapi, 'VM', vm_)
if vm_rec is False:
... | def get_nics(vm_):
'''
Return info about the network interfaces of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_nics <vm name>
'''
with _get_xapi_session() as xapi:
nic = {}
vm_rec = _get_record_by_label(xapi, 'VM', vm_)
if vm_rec is False:
... | [
"Return",
"info",
"about",
"the",
"network",
"interfaces",
"of",
"a",
"named",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L353-L377 | [
"def",
"get_nics",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"nic",
"=",
"{",
"}",
"vm_rec",
"=",
"_get_record_by_label",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_rec",
"is",
"False",
":",
"return",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_macs | Return a list off MAC addresses from the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_macs <vm name> | salt/modules/xapi_virt.py | def get_macs(vm_):
'''
Return a list off MAC addresses from the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_macs <vm name>
'''
macs = []
nics = get_nics(vm_)
if nics is None:
return None
for nic in nics:
macs.append(nic)
return macs | def get_macs(vm_):
'''
Return a list off MAC addresses from the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_macs <vm name>
'''
macs = []
nics = get_nics(vm_)
if nics is None:
return None
for nic in nics:
macs.append(nic)
return macs | [
"Return",
"a",
"list",
"off",
"MAC",
"addresses",
"from",
"the",
"named",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L380-L397 | [
"def",
"get_macs",
"(",
"vm_",
")",
":",
"macs",
"=",
"[",
"]",
"nics",
"=",
"get_nics",
"(",
"vm_",
")",
"if",
"nics",
"is",
"None",
":",
"return",
"None",
"for",
"nic",
"in",
"nics",
":",
"macs",
".",
"append",
"(",
"nic",
")",
"return",
"macs"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_disks | Return the disks of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_disks <vm name> | salt/modules/xapi_virt.py | def get_disks(vm_):
'''
Return the disks of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_disks <vm name>
'''
with _get_xapi_session() as xapi:
disk = {}
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False... | def get_disks(vm_):
'''
Return the disks of a named vm
CLI Example:
.. code-block:: bash
salt '*' virt.get_disks <vm name>
'''
with _get_xapi_session() as xapi:
disk = {}
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False... | [
"Return",
"the",
"disks",
"of",
"a",
"named",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L400-L428 | [
"def",
"get_disks",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"disk",
"=",
"{",
"}",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"F... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | setmem | Changes the amount of memory allocated to VM.
Memory is to be specified in MB
CLI Example:
.. code-block:: bash
salt '*' virt.setmem myvm 768 | salt/modules/xapi_virt.py | def setmem(vm_, memory):
'''
Changes the amount of memory allocated to VM.
Memory is to be specified in MB
CLI Example:
.. code-block:: bash
salt '*' virt.setmem myvm 768
'''
with _get_xapi_session() as xapi:
mem_target = int(memory) * 1024 * 1024
vm_uuid = _get_... | def setmem(vm_, memory):
'''
Changes the amount of memory allocated to VM.
Memory is to be specified in MB
CLI Example:
.. code-block:: bash
salt '*' virt.setmem myvm 768
'''
with _get_xapi_session() as xapi:
mem_target = int(memory) * 1024 * 1024
vm_uuid = _get_... | [
"Changes",
"the",
"amount",
"of",
"memory",
"allocated",
"to",
"VM",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L431-L454 | [
"def",
"setmem",
"(",
"vm_",
",",
"memory",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"mem_target",
"=",
"int",
"(",
"memory",
")",
"*",
"1024",
"*",
"1024",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | setvcpus | Changes the amount of vcpus allocated to VM.
vcpus is an int representing the number to be assigned
CLI Example:
.. code-block:: bash
salt '*' virt.setvcpus myvm 2 | salt/modules/xapi_virt.py | def setvcpus(vm_, vcpus):
'''
Changes the amount of vcpus allocated to VM.
vcpus is an int representing the number to be assigned
CLI Example:
.. code-block:: bash
salt '*' virt.setvcpus myvm 2
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm... | def setvcpus(vm_, vcpus):
'''
Changes the amount of vcpus allocated to VM.
vcpus is an int representing the number to be assigned
CLI Example:
.. code-block:: bash
salt '*' virt.setvcpus myvm 2
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm... | [
"Changes",
"the",
"amount",
"of",
"vcpus",
"allocated",
"to",
"VM",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L457-L477 | [
"def",
"setvcpus",
"(",
"vm_",
",",
"vcpus",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | vcpu_pin | Set which CPUs a VCPU can use.
CLI Example:
.. code-block:: bash
salt 'foo' virt.vcpu_pin domU-id 2 1
salt 'foo' virt.vcpu_pin domU-id 2 2-6 | salt/modules/xapi_virt.py | def vcpu_pin(vm_, vcpu, cpus):
'''
Set which CPUs a VCPU can use.
CLI Example:
.. code-block:: bash
salt 'foo' virt.vcpu_pin domU-id 2 1
salt 'foo' virt.vcpu_pin domU-id 2 2-6
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if ... | def vcpu_pin(vm_, vcpu, cpus):
'''
Set which CPUs a VCPU can use.
CLI Example:
.. code-block:: bash
salt 'foo' virt.vcpu_pin domU-id 2 1
salt 'foo' virt.vcpu_pin domU-id 2 2-6
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if ... | [
"Set",
"which",
"CPUs",
"a",
"VCPU",
"can",
"use",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L480-L532 | [
"def",
"vcpu_pin",
"(",
"vm_",
",",
"vcpu",
",",
"cpus",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | shutdown | Send a soft shutdown signal to the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.shutdown <vm name> | salt/modules/xapi_virt.py | def shutdown(vm_):
'''
Send a soft shutdown signal to the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.shutdown <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
... | def shutdown(vm_):
'''
Send a soft shutdown signal to the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.shutdown <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
... | [
"Send",
"a",
"soft",
"shutdown",
"signal",
"to",
"the",
"named",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L576-L594 | [
"def",
"shutdown",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | pause | Pause the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.pause <vm name> | salt/modules/xapi_virt.py | def pause(vm_):
'''
Pause the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.pause <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
xapi.VM.pause(... | def pause(vm_):
'''
Pause the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.pause <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
xapi.VM.pause(... | [
"Pause",
"the",
"named",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L597-L615 | [
"def",
"pause",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | resume | Resume the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.resume <vm name> | salt/modules/xapi_virt.py | def resume(vm_):
'''
Resume the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.resume <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
xapi.VM.unp... | def resume(vm_):
'''
Resume the named vm
CLI Example:
.. code-block:: bash
salt '*' virt.resume <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
xapi.VM.unp... | [
"Resume",
"the",
"named",
"vm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L618-L636 | [
"def",
"resume",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reboot | Reboot a domain via ACPI request
CLI Example:
.. code-block:: bash
salt '*' virt.reboot <vm name> | salt/modules/xapi_virt.py | def reboot(vm_):
'''
Reboot a domain via ACPI request
CLI Example:
.. code-block:: bash
salt '*' virt.reboot <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
... | def reboot(vm_):
'''
Reboot a domain via ACPI request
CLI Example:
.. code-block:: bash
salt '*' virt.reboot <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return False
try:
... | [
"Reboot",
"a",
"domain",
"via",
"ACPI",
"request"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L656-L674 | [
"def",
"reboot",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reset | Reset a VM by emulating the reset button on a physical machine
CLI Example:
.. code-block:: bash
salt '*' virt.reset <vm name> | salt/modules/xapi_virt.py | def reset(vm_):
'''
Reset a VM by emulating the reset button on a physical machine
CLI Example:
.. code-block:: bash
salt '*' virt.reset <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return F... | def reset(vm_):
'''
Reset a VM by emulating the reset button on a physical machine
CLI Example:
.. code-block:: bash
salt '*' virt.reset <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
return F... | [
"Reset",
"a",
"VM",
"by",
"emulating",
"the",
"reset",
"button",
"on",
"a",
"physical",
"machine"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L677-L695 | [
"def",
"reset",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | migrate | Migrates the virtual machine to another hypervisor
CLI Example:
.. code-block:: bash
salt '*' virt.migrate <vm name> <target hypervisor> [live] [port] [node] [ssl] [change_home_server]
Optional values:
live
Use live migration
port
Use a specified port
node
Us... | salt/modules/xapi_virt.py | def migrate(vm_, target,
live=1, port=0, node=-1, ssl=None, change_home_server=0):
'''
Migrates the virtual machine to another hypervisor
CLI Example:
.. code-block:: bash
salt '*' virt.migrate <vm name> <target hypervisor> [live] [port] [node] [ssl] [change_home_server]
Opti... | def migrate(vm_, target,
live=1, port=0, node=-1, ssl=None, change_home_server=0):
'''
Migrates the virtual machine to another hypervisor
CLI Example:
.. code-block:: bash
salt '*' virt.migrate <vm name> <target hypervisor> [live] [port] [node] [ssl] [change_home_server]
Opti... | [
"Migrates",
"the",
"virtual",
"machine",
"to",
"another",
"hypervisor"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L698-L736 | [
"def",
"migrate",
"(",
"vm_",
",",
"target",
",",
"live",
"=",
"1",
",",
"port",
"=",
"0",
",",
"node",
"=",
"-",
"1",
",",
"ssl",
"=",
"None",
",",
"change_home_server",
"=",
"0",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stop | Hard power down the virtual machine, this is equivalent to pulling the
power
CLI Example:
.. code-block:: bash
salt '*' virt.stop <vm name> | salt/modules/xapi_virt.py | def stop(vm_):
'''
Hard power down the virtual machine, this is equivalent to pulling the
power
CLI Example:
.. code-block:: bash
salt '*' virt.stop <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
... | def stop(vm_):
'''
Hard power down the virtual machine, this is equivalent to pulling the
power
CLI Example:
.. code-block:: bash
salt '*' virt.stop <vm name>
'''
with _get_xapi_session() as xapi:
vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
if vm_uuid is False:
... | [
"Hard",
"power",
"down",
"the",
"virtual",
"machine",
"this",
"is",
"equivalent",
"to",
"pulling",
"the",
"power"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L739-L758 | [
"def",
"stop",
"(",
"vm_",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"if",
"vm_uuid",
"is",
"False",
":",
"return",
"False",
"try",
":",
"xapi",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_hyper | Returns a bool whether or not this node is a hypervisor of any kind
CLI Example:
.. code-block:: bash
salt '*' virt.is_hyper | salt/modules/xapi_virt.py | def is_hyper():
'''
Returns a bool whether or not this node is a hypervisor of any kind
CLI Example:
.. code-block:: bash
salt '*' virt.is_hyper
'''
try:
if __grains__['virtual_subtype'] != 'Xen Dom0':
return False
except KeyError:
# virtual_subtype isn... | def is_hyper():
'''
Returns a bool whether or not this node is a hypervisor of any kind
CLI Example:
.. code-block:: bash
salt '*' virt.is_hyper
'''
try:
if __grains__['virtual_subtype'] != 'Xen Dom0':
return False
except KeyError:
# virtual_subtype isn... | [
"Returns",
"a",
"bool",
"whether",
"or",
"not",
"this",
"node",
"is",
"a",
"hypervisor",
"of",
"any",
"kind"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L761-L784 | [
"def",
"is_hyper",
"(",
")",
":",
"try",
":",
"if",
"__grains__",
"[",
"'virtual_subtype'",
"]",
"!=",
"'Xen Dom0'",
":",
"return",
"False",
"except",
"KeyError",
":",
"# virtual_subtype isn't set everywhere.",
"return",
"False",
"try",
":",
"with",
"salt",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | vm_cputime | Return cputime used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'cputime' <int>
'cputime_percent' <int>
},
...
]
If you pass a VM name in as an argument then it will return i... | salt/modules/xapi_virt.py | def vm_cputime(vm_=None):
'''
Return cputime used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'cputime' <int>
'cputime_percent' <int>
},
...
]
If you pass a VM name i... | def vm_cputime(vm_=None):
'''
Return cputime used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'cputime' <int>
'cputime_percent' <int>
},
...
]
If you pass a VM name i... | [
"Return",
"cputime",
"used",
"by",
"the",
"vms",
"on",
"this",
"hyper",
"in",
"a",
"list",
"of",
"dicts",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L787-L834 | [
"def",
"vm_cputime",
"(",
"vm_",
"=",
"None",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"def",
"_info",
"(",
"vm_",
")",
":",
"host_rec",
"=",
"_get_record_by_label",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
")",
"host_cpus",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | vm_netstats | Return combined network counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_total_read_kbs' : 0,
'io_total_write_kbs' : 0,
'io_write_kbs' ... | salt/modules/xapi_virt.py | def vm_netstats(vm_=None):
'''
Return combined network counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_total_read_kbs' : 0,
'io_total_write_kbs' ... | def vm_netstats(vm_=None):
'''
Return combined network counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_total_read_kbs' : 0,
'io_total_write_kbs' ... | [
"Return",
"combined",
"network",
"counters",
"used",
"by",
"the",
"vms",
"on",
"this",
"hyper",
"in",
"a",
"list",
"of",
"dicts",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L837-L883 | [
"def",
"vm_netstats",
"(",
"vm_",
"=",
"None",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"def",
"_info",
"(",
"vm_",
")",
":",
"ret",
"=",
"{",
"}",
"vm_rec",
"=",
"_get_record_by_label",
"(",
"xapi",
",",
"'VM'",
",",
"vm_"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | vm_diskstats | Return disk usage counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_write_kbs' : 0
},
...
]
If you pass a VM name in as an argument then it ... | salt/modules/xapi_virt.py | def vm_diskstats(vm_=None):
'''
Return disk usage counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_write_kbs' : 0
},
...
]
If you p... | def vm_diskstats(vm_=None):
'''
Return disk usage counters used by the vms on this hyper in a
list of dicts:
.. code-block:: python
[
'your-vm': {
'io_read_kbs' : 0,
'io_write_kbs' : 0
},
...
]
If you p... | [
"Return",
"disk",
"usage",
"counters",
"used",
"by",
"the",
"vms",
"on",
"this",
"hyper",
"in",
"a",
"list",
"of",
"dicts",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xapi_virt.py#L886-L930 | [
"def",
"vm_diskstats",
"(",
"vm_",
"=",
"None",
")",
":",
"with",
"_get_xapi_session",
"(",
")",
"as",
"xapi",
":",
"def",
"_info",
"(",
"vm_",
")",
":",
"ret",
"=",
"{",
"}",
"vm_uuid",
"=",
"_get_label_uuid",
"(",
"xapi",
",",
"'VM'",
",",
"vm_",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _clean_message | Internal helper to sanitize message output | salt/modules/zonecfg.py | def _clean_message(message):
'''Internal helper to sanitize message output'''
message = message.replace('zonecfg: ', '')
message = message.splitlines()
for line in message:
if line.startswith('On line'):
message.remove(line)
return "\n".join(message) | def _clean_message(message):
'''Internal helper to sanitize message output'''
message = message.replace('zonecfg: ', '')
message = message.splitlines()
for line in message:
if line.startswith('On line'):
message.remove(line)
return "\n".join(message) | [
"Internal",
"helper",
"to",
"sanitize",
"message",
"output"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L117-L124 | [
"def",
"_clean_message",
"(",
"message",
")",
":",
"message",
"=",
"message",
".",
"replace",
"(",
"'zonecfg: '",
",",
"''",
")",
"message",
"=",
"message",
".",
"splitlines",
"(",
")",
"for",
"line",
"in",
"message",
":",
"if",
"line",
".",
"startswith"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_value | Internal helper for parsing configuration values into python values | salt/modules/zonecfg.py | def _parse_value(value):
'''Internal helper for parsing configuration values into python values'''
if isinstance(value, bool):
return 'true' if value else 'false'
elif isinstance(value, six.string_types):
# parse compacted notation to dict
listparser = re.compile(r'''((?:[^,"']|"[^"]... | def _parse_value(value):
'''Internal helper for parsing configuration values into python values'''
if isinstance(value, bool):
return 'true' if value else 'false'
elif isinstance(value, six.string_types):
# parse compacted notation to dict
listparser = re.compile(r'''((?:[^,"']|"[^"]... | [
"Internal",
"helper",
"for",
"parsing",
"configuration",
"values",
"into",
"python",
"values"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L127-L165 | [
"def",
"_parse_value",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"bool",
")",
":",
"return",
"'true'",
"if",
"value",
"else",
"'false'",
"elif",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"# parse compacted ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _sanitize_value | Internal helper for converting pythonic values to configuration file values | salt/modules/zonecfg.py | def _sanitize_value(value):
'''Internal helper for converting pythonic values to configuration file values'''
# dump dict into compated
if isinstance(value, dict):
new_value = []
new_value.append('(')
for k, v in value.items():
new_value.append(k)
new_value.ap... | def _sanitize_value(value):
'''Internal helper for converting pythonic values to configuration file values'''
# dump dict into compated
if isinstance(value, dict):
new_value = []
new_value.append('(')
for k, v in value.items():
new_value.append(k)
new_value.ap... | [
"Internal",
"helper",
"for",
"converting",
"pythonic",
"values",
"to",
"configuration",
"file",
"values"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L168-L198 | [
"def",
"_sanitize_value",
"(",
"value",
")",
":",
"# dump dict into compated",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"new_value",
"=",
"[",
"]",
"new_value",
".",
"append",
"(",
"'('",
")",
"for",
"k",
",",
"v",
"in",
"value",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _dump_cfg | Internal helper for debugging cfg files | salt/modules/zonecfg.py | def _dump_cfg(cfg_file):
'''Internal helper for debugging cfg files'''
if __salt__['file.file_exists'](cfg_file):
with salt.utils.files.fopen(cfg_file, 'r') as fp_:
log.debug(
"zonecfg - configuration file:\n%s",
"".join(salt.utils.data.decode(fp_.readline... | def _dump_cfg(cfg_file):
'''Internal helper for debugging cfg files'''
if __salt__['file.file_exists'](cfg_file):
with salt.utils.files.fopen(cfg_file, 'r') as fp_:
log.debug(
"zonecfg - configuration file:\n%s",
"".join(salt.utils.data.decode(fp_.readline... | [
"Internal",
"helper",
"for",
"debugging",
"cfg",
"files"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L201-L208 | [
"def",
"_dump_cfg",
"(",
"cfg_file",
")",
":",
"if",
"__salt__",
"[",
"'file.file_exists'",
"]",
"(",
"cfg_file",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"cfg_file",
",",
"'r'",
")",
"as",
"fp_",
":",
"log",
".",
"deb... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create an in-memory configuration for the specified zone.
zone : string
name of zone
brand : string
brand name
zonepath : string
path of zone
force : boolean
overwrite configuration
CLI Example:
.. code-block:: bash
salt '*' zonecfg.create deathscythe ... | salt/modules/zonecfg.py | def create(zone, brand, zonepath, force=False):
'''
Create an in-memory configuration for the specified zone.
zone : string
name of zone
brand : string
brand name
zonepath : string
path of zone
force : boolean
overwrite configuration
CLI Example:
.. cod... | def create(zone, brand, zonepath, force=False):
'''
Create an in-memory configuration for the specified zone.
zone : string
name of zone
brand : string
brand name
zonepath : string
path of zone
force : boolean
overwrite configuration
CLI Example:
.. cod... | [
"Create",
"an",
"in",
"-",
"memory",
"configuration",
"for",
"the",
"specified",
"zone",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L211-L259 | [
"def",
"create",
"(",
"zone",
",",
"brand",
",",
"zonepath",
",",
"force",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# write config",
"cfg_file",
"=",
"salt",
".",
"utils",
".",
"files",
".",
"mkstemp",
"(",
")",
"with",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_from_template | Create an in-memory configuration from a template for the specified zone.
zone : string
name of zone
template : string
name of template
.. warning::
existing config will be overwritten!
CLI Example:
.. code-block:: bash
salt '*' zonecfg.create_from_template leo t... | salt/modules/zonecfg.py | def create_from_template(zone, template):
'''
Create an in-memory configuration from a template for the specified zone.
zone : string
name of zone
template : string
name of template
.. warning::
existing config will be overwritten!
CLI Example:
.. code-block:: bas... | def create_from_template(zone, template):
'''
Create an in-memory configuration from a template for the specified zone.
zone : string
name of zone
template : string
name of template
.. warning::
existing config will be overwritten!
CLI Example:
.. code-block:: bas... | [
"Create",
"an",
"in",
"-",
"memory",
"configuration",
"from",
"a",
"template",
"for",
"the",
"specified",
"zone",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L262-L295 | [
"def",
"create_from_template",
"(",
"zone",
",",
"template",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# create from template",
"_dump_cfg",
"(",
"template",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'zonecfg -z {zone} create ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Delete the specified configuration from memory and stable storage.
zone : string
name of zone
CLI Example:
.. code-block:: bash
salt '*' zonecfg.delete epyon | salt/modules/zonecfg.py | def delete(zone):
'''
Delete the specified configuration from memory and stable storage.
zone : string
name of zone
CLI Example:
.. code-block:: bash
salt '*' zonecfg.delete epyon
'''
ret = {'status': True}
# delete zone
res = __salt__['cmd.run_all']('zonecfg -z ... | def delete(zone):
'''
Delete the specified configuration from memory and stable storage.
zone : string
name of zone
CLI Example:
.. code-block:: bash
salt '*' zonecfg.delete epyon
'''
ret = {'status': True}
# delete zone
res = __salt__['cmd.run_all']('zonecfg -z ... | [
"Delete",
"the",
"specified",
"configuration",
"from",
"memory",
"and",
"stable",
"storage",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L298-L324 | [
"def",
"delete",
"(",
"zone",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# delete zone",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'zonecfg -z {zone} delete -F'",
".",
"format",
"(",
"zone",
"=",
"zone",
",",
")",
")",
"ret"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | export | Export the configuration from memory to stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.export epyon
salt '*' zonecfg.export epyon /zones/epyon.cfg | salt/modules/zonecfg.py | def export(zone, path=None):
'''
Export the configuration from memory to stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.export epyon
salt '*' zonecfg.export epyon /zones/epy... | def export(zone, path=None):
'''
Export the configuration from memory to stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.export epyon
salt '*' zonecfg.export epyon /zones/epy... | [
"Export",
"the",
"configuration",
"from",
"memory",
"to",
"stable",
"storage",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L327-L357 | [
"def",
"export",
"(",
"zone",
",",
"path",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# export zone",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'zonecfg -z {zone} export{path}'",
".",
"format",
"(",
"zone",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | import_ | Import the configuration to memory from stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.import epyon /zones/epyon.cfg | salt/modules/zonecfg.py | def import_(zone, path):
'''
Import the configuration to memory from stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.import epyon /zones/epyon.cfg
'''
ret = {'status': True}
... | def import_(zone, path):
'''
Import the configuration to memory from stable storage.
zone : string
name of zone
path : string
path of file to export to
CLI Example:
.. code-block:: bash
salt '*' zonecfg.import epyon /zones/epyon.cfg
'''
ret = {'status': True}
... | [
"Import",
"the",
"configuration",
"to",
"memory",
"from",
"stable",
"storage",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L360-L390 | [
"def",
"import_",
"(",
"zone",
",",
"path",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# create from file",
"_dump_cfg",
"(",
"path",
")",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'zonecfg -z {zone} -f {path}'",
".",
"format",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _property | internal handler for set and clear_property
methode : string
either set, add, or clear
zone : string
name of zone
key : string
name of property
value : string
value of property | salt/modules/zonecfg.py | def _property(methode, zone, key, value):
'''
internal handler for set and clear_property
methode : string
either set, add, or clear
zone : string
name of zone
key : string
name of property
value : string
value of property
'''
ret = {'status': True}
... | def _property(methode, zone, key, value):
'''
internal handler for set and clear_property
methode : string
either set, add, or clear
zone : string
name of zone
key : string
name of property
value : string
value of property
'''
ret = {'status': True}
... | [
"internal",
"handler",
"for",
"set",
"and",
"clear_property"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L393-L443 | [
"def",
"_property",
"(",
"methode",
",",
"zone",
",",
"key",
",",
"value",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# generate update script",
"cfg_file",
"=",
"None",
"if",
"methode",
"not",
"in",
"[",
"'set'",
",",
"'clear'",
"]",
":... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _resource | internal resource hanlder
methode : string
add or update
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
**kwargs : string|int|...
resource properties | salt/modules/zonecfg.py | def _resource(methode, zone, resource_type, resource_selector, **kwargs):
'''
internal resource hanlder
methode : string
add or update
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
**k... | def _resource(methode, zone, resource_type, resource_selector, **kwargs):
'''
internal resource hanlder
methode : string
add or update
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
**k... | [
"internal",
"resource",
"hanlder"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L494-L570 | [
"def",
"_resource",
"(",
"methode",
",",
"zone",
",",
"resource_type",
",",
"resource_selector",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# parse kwargs",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_resource | Add a resource
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
kwargs : string|int|...
resource properties
.. note::
Set resource_selector to None for resource that do not require one.
... | salt/modules/zonecfg.py | def update_resource(zone, resource_type, resource_selector, **kwargs):
'''
Add a resource
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
kwargs : string|int|...
resource properties
.. ... | def update_resource(zone, resource_type, resource_selector, **kwargs):
'''
Add a resource
zone : string
name of zone
resource_type : string
type of resource
resource_selector : string
unique resource identifier
kwargs : string|int|...
resource properties
.. ... | [
"Add",
"a",
"resource"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L593-L615 | [
"def",
"update_resource",
"(",
"zone",
",",
"resource_type",
",",
"resource_selector",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_resource",
"(",
"'update'",
",",
"zone",
",",
"resource_type",
",",
"resource_selector",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_resource | Remove a resource
zone : string
name of zone
resource_type : string
type of resource
resource_key : string
key for resource selection
resource_value : string
value for resource selection
.. note::
Set resource_selector to None for resource that do not requir... | salt/modules/zonecfg.py | def remove_resource(zone, resource_type, resource_key, resource_value):
'''
Remove a resource
zone : string
name of zone
resource_type : string
type of resource
resource_key : string
key for resource selection
resource_value : string
value for resource selection
... | def remove_resource(zone, resource_type, resource_key, resource_value):
'''
Remove a resource
zone : string
name of zone
resource_type : string
type of resource
resource_key : string
key for resource selection
resource_value : string
value for resource selection
... | [
"Remove",
"a",
"resource"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L618-L668 | [
"def",
"remove_resource",
"(",
"zone",
",",
"resource_type",
",",
"resource_key",
",",
"resource_value",
")",
":",
"ret",
"=",
"{",
"'status'",
":",
"True",
"}",
"# generate update script",
"cfg_file",
"=",
"salt",
".",
"utils",
".",
"files",
".",
"mkstemp",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | info | Display the configuration from memory
zone : string
name of zone
show_all : boolean
also include calculated values like capped-cpu, cpu-shares, ...
CLI Example:
.. code-block:: bash
salt '*' zonecfg.info tallgeese | salt/modules/zonecfg.py | def info(zone, show_all=False):
'''
Display the configuration from memory
zone : string
name of zone
show_all : boolean
also include calculated values like capped-cpu, cpu-shares, ...
CLI Example:
.. code-block:: bash
salt '*' zonecfg.info tallgeese
'''
ret = ... | def info(zone, show_all=False):
'''
Display the configuration from memory
zone : string
name of zone
show_all : boolean
also include calculated values like capped-cpu, cpu-shares, ...
CLI Example:
.. code-block:: bash
salt '*' zonecfg.info tallgeese
'''
ret = ... | [
"Display",
"the",
"configuration",
"from",
"memory"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zonecfg.py#L671-L769 | [
"def",
"info",
"(",
"zone",
",",
"show_all",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"# dump zone",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'zonecfg -z {zone} info'",
".",
"format",
"(",
"zone",
"=",
"zone",
",",
")",
")",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | DaemonsMixin.verify_hash_type | Verify and display a nag-messsage to the log if vulnerable hash-type is used.
:return: | salt/cli/daemons.py | def verify_hash_type(self):
'''
Verify and display a nag-messsage to the log if vulnerable hash-type is used.
:return:
'''
if self.config['hash_type'].lower() in ['md5', 'sha1']:
log.warning(
'IMPORTANT: Do not use %s hashing algorithm! Please set '
... | def verify_hash_type(self):
'''
Verify and display a nag-messsage to the log if vulnerable hash-type is used.
:return:
'''
if self.config['hash_type'].lower() in ['md5', 'sha1']:
log.warning(
'IMPORTANT: Do not use %s hashing algorithm! Please set '
... | [
"Verify",
"and",
"display",
"a",
"nag",
"-",
"messsage",
"to",
"the",
"log",
"if",
"vulnerable",
"hash",
"-",
"type",
"is",
"used",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L65-L76 | [
"def",
"verify_hash_type",
"(",
"self",
")",
":",
"if",
"self",
".",
"config",
"[",
"'hash_type'",
"]",
".",
"lower",
"(",
")",
"in",
"[",
"'md5'",
",",
"'sha1'",
"]",
":",
"log",
".",
"warning",
"(",
"'IMPORTANT: Do not use %s hashing algorithm! Please set '"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | DaemonsMixin.environment_failure | Log environment failure for the daemon and exit with the error code.
:param error:
:return: | salt/cli/daemons.py | def environment_failure(self, error):
'''
Log environment failure for the daemon and exit with the error code.
:param error:
:return:
'''
log.exception(
'Failed to create environment for %s: %s',
self.__class__.__name__, get_error_message(error)
... | def environment_failure(self, error):
'''
Log environment failure for the daemon and exit with the error code.
:param error:
:return:
'''
log.exception(
'Failed to create environment for %s: %s',
self.__class__.__name__, get_error_message(error)
... | [
"Log",
"environment",
"failure",
"for",
"the",
"daemon",
"and",
"exit",
"with",
"the",
"error",
"code",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L103-L114 | [
"def",
"environment_failure",
"(",
"self",
",",
"error",
")",
":",
"log",
".",
"exception",
"(",
"'Failed to create environment for %s: %s'",
",",
"self",
".",
"__class__",
".",
"__name__",
",",
"get_error_message",
"(",
"error",
")",
")",
"self",
".",
"shutdown... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Master.prepare | Run the preparation sequence required to start a salt master server.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare() | salt/cli/daemons.py | def prepare(self):
'''
Run the preparation sequence required to start a salt master server.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Master, self).prepare()
try:
if self.config['verify_env']:
... | def prepare(self):
'''
Run the preparation sequence required to start a salt master server.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Master, self).prepare()
try:
if self.config['verify_env']:
... | [
"Run",
"the",
"preparation",
"sequence",
"required",
"to",
"start",
"a",
"salt",
"master",
"server",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L130-L190 | [
"def",
"prepare",
"(",
"self",
")",
":",
"super",
"(",
"Master",
",",
"self",
")",
".",
"prepare",
"(",
")",
"try",
":",
"if",
"self",
".",
"config",
"[",
"'verify_env'",
"]",
":",
"v_dirs",
"=",
"[",
"self",
".",
"config",
"[",
"'pki_dir'",
"]",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Master.start | Start the actual master.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`. | salt/cli/daemons.py | def start(self):
'''
Start the actual master.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Master, self).start()
if check_user(self.config['user']):
... | def start(self):
'''
Start the actual master.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Master, self).start()
if check_user(self.config['user']):
... | [
"Start",
"the",
"actual",
"master",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L192-L206 | [
"def",
"start",
"(",
"self",
")",
":",
"super",
"(",
"Master",
",",
"self",
")",
".",
"start",
"(",
")",
"if",
"check_user",
"(",
"self",
".",
"config",
"[",
"'user'",
"]",
")",
":",
"self",
".",
"action_log_info",
"(",
"'Starting up'",
")",
"self",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Master.shutdown | If sub-classed, run any shutdown operations on this method. | salt/cli/daemons.py | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
'''
self.shutdown_log_info()
msg = 'The salt master is shutdown. '
if exitmsg is not None:
exitmsg = msg + exitmsg
else:
exitmsg =... | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
'''
self.shutdown_log_info()
msg = 'The salt master is shutdown. '
if exitmsg is not None:
exitmsg = msg + exitmsg
else:
exitmsg =... | [
"If",
"sub",
"-",
"classed",
"run",
"any",
"shutdown",
"operations",
"on",
"this",
"method",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L208-L218 | [
"def",
"shutdown",
"(",
"self",
",",
"exitcode",
"=",
"0",
",",
"exitmsg",
"=",
"None",
")",
":",
"self",
".",
"shutdown_log_info",
"(",
")",
"msg",
"=",
"'The salt master is shutdown. '",
"if",
"exitmsg",
"is",
"not",
"None",
":",
"exitmsg",
"=",
"msg",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion.prepare | Run the preparation sequence required to start a salt minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare() | salt/cli/daemons.py | def prepare(self):
'''
Run the preparation sequence required to start a salt minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Minion, self).prepare()
try:
if self.config['verify_env']:
... | def prepare(self):
'''
Run the preparation sequence required to start a salt minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Minion, self).prepare()
try:
if self.config['verify_env']:
... | [
"Run",
"the",
"preparation",
"sequence",
"required",
"to",
"start",
"a",
"salt",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L233-L311 | [
"def",
"prepare",
"(",
"self",
")",
":",
"super",
"(",
"Minion",
",",
"self",
")",
".",
"prepare",
"(",
")",
"try",
":",
"if",
"self",
".",
"config",
"[",
"'verify_env'",
"]",
":",
"confd",
"=",
"self",
".",
"config",
".",
"get",
"(",
"'default_inc... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion.start | Start the actual minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`. | salt/cli/daemons.py | def start(self):
'''
Start the actual minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Minion, self).start()
while True:
try:
... | def start(self):
'''
Start the actual minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Minion, self).start()
while True:
try:
... | [
"Start",
"the",
"actual",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L313-L331 | [
"def",
"start",
"(",
"self",
")",
":",
"super",
"(",
"Minion",
",",
"self",
")",
".",
"start",
"(",
")",
"while",
"True",
":",
"try",
":",
"self",
".",
"_real_start",
"(",
")",
"except",
"SaltClientError",
"as",
"exc",
":",
"# Restart for multi_master fa... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion.call | Start the actual minion as a caller minion.
cleanup_protecteds is list of yard host addresses that should not be
cleaned up this is to fix race condition when salt-caller minion starts up
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE... | salt/cli/daemons.py | def call(self, cleanup_protecteds):
'''
Start the actual minion as a caller minion.
cleanup_protecteds is list of yard host addresses that should not be
cleaned up this is to fix race condition when salt-caller minion starts up
If sub-classed, don't **ever** forget to run:
... | def call(self, cleanup_protecteds):
'''
Start the actual minion as a caller minion.
cleanup_protecteds is list of yard host addresses that should not be
cleaned up this is to fix race condition when salt-caller minion starts up
If sub-classed, don't **ever** forget to run:
... | [
"Start",
"the",
"actual",
"minion",
"as",
"a",
"caller",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L350-L375 | [
"def",
"call",
"(",
"self",
",",
"cleanup_protecteds",
")",
":",
"try",
":",
"self",
".",
"prepare",
"(",
")",
"if",
"check_user",
"(",
"self",
".",
"config",
"[",
"'user'",
"]",
")",
":",
"self",
".",
"minion",
".",
"opts",
"[",
"'__role'",
"]",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Minion.shutdown | If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg | salt/cli/daemons.py | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
self.action_log_info('Shutting down')
if hasattr(self, 'minion') and hasattr(self.minion, 'destroy'):
self... | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
self.action_log_info('Shutting down')
if hasattr(self, 'minion') and hasattr(self.minion, 'destroy'):
self... | [
"If",
"sub",
"-",
"classed",
"run",
"any",
"shutdown",
"operations",
"on",
"this",
"method",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L377-L389 | [
"def",
"shutdown",
"(",
"self",
",",
"exitcode",
"=",
"0",
",",
"exitmsg",
"=",
"None",
")",
":",
"self",
".",
"action_log_info",
"(",
"'Shutting down'",
")",
"if",
"hasattr",
"(",
"self",
",",
"'minion'",
")",
"and",
"hasattr",
"(",
"self",
".",
"mini... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ProxyMinion.prepare | Run the preparation sequence required to start a salt proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare() | salt/cli/daemons.py | def prepare(self):
'''
Run the preparation sequence required to start a salt proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(ProxyMinion, self).prepare()
if not self.values.proxyid:
self.... | def prepare(self):
'''
Run the preparation sequence required to start a salt proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(ProxyMinion, self).prepare()
if not self.values.proxyid:
self.... | [
"Run",
"the",
"preparation",
"sequence",
"required",
"to",
"start",
"a",
"salt",
"proxy",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L404-L483 | [
"def",
"prepare",
"(",
"self",
")",
":",
"super",
"(",
"ProxyMinion",
",",
"self",
")",
".",
"prepare",
"(",
")",
"if",
"not",
"self",
".",
"values",
".",
"proxyid",
":",
"self",
".",
"error",
"(",
"'salt-proxy requires --proxyid'",
")",
"# Proxies get the... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ProxyMinion.start | Start the actual proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`. | salt/cli/daemons.py | def start(self):
'''
Start the actual proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(ProxyMinion, self).start()
try:
if check_... | def start(self):
'''
Start the actual proxy minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(ProxyMinion, self).start()
try:
if check_... | [
"Start",
"the",
"actual",
"proxy",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L485-L510 | [
"def",
"start",
"(",
"self",
")",
":",
"super",
"(",
"ProxyMinion",
",",
"self",
")",
".",
"start",
"(",
")",
"try",
":",
"if",
"check_user",
"(",
"self",
".",
"config",
"[",
"'user'",
"]",
")",
":",
"self",
".",
"action_log_info",
"(",
"'The Proxy M... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ProxyMinion.shutdown | If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg | salt/cli/daemons.py | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
if hasattr(self, 'minion') and 'proxymodule' in self.minion.opts:
proxy_fn = self.minion.opts['proxymodule'].loade... | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
if hasattr(self, 'minion') and 'proxymodule' in self.minion.opts:
proxy_fn = self.minion.opts['proxymodule'].loade... | [
"If",
"sub",
"-",
"classed",
"run",
"any",
"shutdown",
"operations",
"on",
"this",
"method",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L512-L525 | [
"def",
"shutdown",
"(",
"self",
",",
"exitcode",
"=",
"0",
",",
"exitmsg",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'minion'",
")",
"and",
"'proxymodule'",
"in",
"self",
".",
"minion",
".",
"opts",
":",
"proxy_fn",
"=",
"self",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Syndic.prepare | Run the preparation sequence required to start a salt syndic minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare() | salt/cli/daemons.py | def prepare(self):
'''
Run the preparation sequence required to start a salt syndic minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Syndic, self).prepare()
try:
if self.config['verify_env']:
... | def prepare(self):
'''
Run the preparation sequence required to start a salt syndic minion.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).prepare()
'''
super(Syndic, self).prepare()
try:
if self.config['verify_env']:
... | [
"Run",
"the",
"preparation",
"sequence",
"required",
"to",
"start",
"a",
"salt",
"syndic",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L534-L568 | [
"def",
"prepare",
"(",
"self",
")",
":",
"super",
"(",
"Syndic",
",",
"self",
")",
".",
"prepare",
"(",
")",
"try",
":",
"if",
"self",
".",
"config",
"[",
"'verify_env'",
"]",
":",
"verify_env",
"(",
"[",
"self",
".",
"config",
"[",
"'pki_dir'",
"]... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Syndic.start | Start the actual syndic.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`. | salt/cli/daemons.py | def start(self):
'''
Start the actual syndic.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Syndic, self).start()
if check_user(self.config['user']):
... | def start(self):
'''
Start the actual syndic.
If sub-classed, don't **ever** forget to run:
super(YourSubClass, self).start()
NOTE: Run any required code before calling `super()`.
'''
super(Syndic, self).start()
if check_user(self.config['user']):
... | [
"Start",
"the",
"actual",
"syndic",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L570-L588 | [
"def",
"start",
"(",
"self",
")",
":",
"super",
"(",
"Syndic",
",",
"self",
")",
".",
"start",
"(",
")",
"if",
"check_user",
"(",
"self",
".",
"config",
"[",
"'user'",
"]",
")",
":",
"self",
".",
"action_log_info",
"(",
"'Starting up'",
")",
"self",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | Syndic.shutdown | If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg | salt/cli/daemons.py | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
self.action_log_info('Shutting down')
super(Syndic, self).shutdown(
exitcode, ('The Salt {0} is shutdown. ... | def shutdown(self, exitcode=0, exitmsg=None):
'''
If sub-classed, run any shutdown operations on this method.
:param exitcode
:param exitmsg
'''
self.action_log_info('Shutting down')
super(Syndic, self).shutdown(
exitcode, ('The Salt {0} is shutdown. ... | [
"If",
"sub",
"-",
"classed",
"run",
"any",
"shutdown",
"operations",
"on",
"this",
"method",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L590-L600 | [
"def",
"shutdown",
"(",
"self",
",",
"exitcode",
"=",
"0",
",",
"exitmsg",
"=",
"None",
")",
":",
"self",
".",
"action_log_info",
"(",
"'Shutting down'",
")",
"super",
"(",
"Syndic",
",",
"self",
")",
".",
"shutdown",
"(",
"exitcode",
",",
"(",
"'The S... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __execute_cmd | Execute rac commands | salt/modules/drac.py | def __execute_cmd(command):
'''
Execute rac commands
'''
cmd = __salt__['cmd.run_all']('racadm {0}'.format(command))
if cmd['retcode'] != 0:
log.warning('racadm return an exit code \'%s\'.', cmd['retcode'])
return False
return True | def __execute_cmd(command):
'''
Execute rac commands
'''
cmd = __salt__['cmd.run_all']('racadm {0}'.format(command))
if cmd['retcode'] != 0:
log.warning('racadm return an exit code \'%s\'.', cmd['retcode'])
return False
return True | [
"Execute",
"rac",
"commands"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L48-L58 | [
"def",
"__execute_cmd",
"(",
"command",
")",
":",
"cmd",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'racadm {0}'",
".",
"format",
"(",
"command",
")",
")",
"if",
"cmd",
"[",
"'retcode'",
"]",
"!=",
"0",
":",
"log",
".",
"warning",
"(",
"'racadm ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | nameservers | Configure the nameservers on the DRAC
CLI Example:
.. code-block:: bash
salt dell drac.nameservers [NAMESERVERS]
salt dell drac.nameservers ns1.example.com ns2.example.com | salt/modules/drac.py | def nameservers(*ns):
'''
Configure the nameservers on the DRAC
CLI Example:
.. code-block:: bash
salt dell drac.nameservers [NAMESERVERS]
salt dell drac.nameservers ns1.example.com ns2.example.com
'''
if len(ns) > 2:
log.warning('racadm only supports two nameservers')... | def nameservers(*ns):
'''
Configure the nameservers on the DRAC
CLI Example:
.. code-block:: bash
salt dell drac.nameservers [NAMESERVERS]
salt dell drac.nameservers ns1.example.com ns2.example.com
'''
if len(ns) > 2:
log.warning('racadm only supports two nameservers')... | [
"Configure",
"the",
"nameservers",
"on",
"the",
"DRAC"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L98-L118 | [
"def",
"nameservers",
"(",
"*",
"ns",
")",
":",
"if",
"len",
"(",
"ns",
")",
">",
"2",
":",
"log",
".",
"warning",
"(",
"'racadm only supports two nameservers'",
")",
"return",
"False",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"ns",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | syslog | Configure syslog remote logging, by default syslog will automatically be
enabled if a server is specified. However, if you want to disable syslog
you will need to specify a server followed by False
CLI Example:
.. code-block:: bash
salt dell drac.syslog [SYSLOG IP] [ENABLE/DISABLE]
sa... | salt/modules/drac.py | def syslog(server, enable=True):
'''
Configure syslog remote logging, by default syslog will automatically be
enabled if a server is specified. However, if you want to disable syslog
you will need to specify a server followed by False
CLI Example:
.. code-block:: bash
salt dell drac.s... | def syslog(server, enable=True):
'''
Configure syslog remote logging, by default syslog will automatically be
enabled if a server is specified. However, if you want to disable syslog
you will need to specify a server followed by False
CLI Example:
.. code-block:: bash
salt dell drac.s... | [
"Configure",
"syslog",
"remote",
"logging",
"by",
"default",
"syslog",
"will",
"automatically",
"be",
"enabled",
"if",
"a",
"server",
"is",
"specified",
".",
"However",
"if",
"you",
"want",
"to",
"disable",
"syslog",
"you",
"will",
"need",
"to",
"specify",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L121-L139 | [
"def",
"syslog",
"(",
"server",
",",
"enable",
"=",
"True",
")",
":",
"if",
"enable",
"and",
"__execute_cmd",
"(",
"'config -g cfgRemoteHosts -o \\\n cfgRhostsSyslogEnable 1'",
")",
":",
"return",
"__execute_cmd",
"(",
"'config -g cfgRemoteHosts -o \\\n ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_users | List all DRAC users
CLI Example:
.. code-block:: bash
salt dell drac.list_users | salt/modules/drac.py | def list_users():
'''
List all DRAC users
CLI Example:
.. code-block:: bash
salt dell drac.list_users
'''
users = {}
_username = ''
for idx in range(1, 17):
cmd = __salt__['cmd.run_all']('racadm getconfig -g \
cfgUserAdmin -i {0}'.format(idx))
... | def list_users():
'''
List all DRAC users
CLI Example:
.. code-block:: bash
salt dell drac.list_users
'''
users = {}
_username = ''
for idx in range(1, 17):
cmd = __salt__['cmd.run_all']('racadm getconfig -g \
cfgUserAdmin -i {0}'.format(idx))
... | [
"List",
"all",
"DRAC",
"users"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L162-L198 | [
"def",
"list_users",
"(",
")",
":",
"users",
"=",
"{",
"}",
"_username",
"=",
"''",
"for",
"idx",
"in",
"range",
"(",
"1",
",",
"17",
")",
":",
"cmd",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'racadm getconfig -g \\\n cfgUserAdmin -i ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_user | Delete a user
CLI Example:
.. code-block:: bash
salt dell drac.delete_user [USERNAME] [UID - optional]
salt dell drac.delete_user diana 4 | salt/modules/drac.py | def delete_user(username, uid=None):
'''
Delete a user
CLI Example:
.. code-block:: bash
salt dell drac.delete_user [USERNAME] [UID - optional]
salt dell drac.delete_user diana 4
'''
if uid is None:
user = list_users()
uid = user[username]['index']
if uid:... | def delete_user(username, uid=None):
'''
Delete a user
CLI Example:
.. code-block:: bash
salt dell drac.delete_user [USERNAME] [UID - optional]
salt dell drac.delete_user diana 4
'''
if uid is None:
user = list_users()
uid = user[username]['index']
if uid:... | [
"Delete",
"a",
"user"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L201-L224 | [
"def",
"delete_user",
"(",
"username",
",",
"uid",
"=",
"None",
")",
":",
"if",
"uid",
"is",
"None",
":",
"user",
"=",
"list_users",
"(",
")",
"uid",
"=",
"user",
"[",
"username",
"]",
"[",
"'index'",
"]",
"if",
"uid",
":",
"return",
"__execute_cmd",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | change_password | Change users password
CLI Example:
.. code-block:: bash
salt dell drac.change_password [USERNAME] [PASSWORD] [UID - optional]
salt dell drac.change_password diana secret | salt/modules/drac.py | def change_password(username, password, uid=None):
'''
Change users password
CLI Example:
.. code-block:: bash
salt dell drac.change_password [USERNAME] [PASSWORD] [UID - optional]
salt dell drac.change_password diana secret
'''
if uid is None:
user = list_users()
... | def change_password(username, password, uid=None):
'''
Change users password
CLI Example:
.. code-block:: bash
salt dell drac.change_password [USERNAME] [PASSWORD] [UID - optional]
salt dell drac.change_password diana secret
'''
if uid is None:
user = list_users()
... | [
"Change",
"users",
"password"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L227-L249 | [
"def",
"change_password",
"(",
"username",
",",
"password",
",",
"uid",
"=",
"None",
")",
":",
"if",
"uid",
"is",
"None",
":",
"user",
"=",
"list_users",
"(",
")",
"uid",
"=",
"user",
"[",
"username",
"]",
"[",
"'index'",
"]",
"if",
"uid",
":",
"re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_user | Create user accounts
CLI Example:
.. code-block:: bash
salt dell drac.create_user [USERNAME] [PASSWORD] [PRIVILEGES]
salt dell drac.create_user diana secret login,test_alerts,clear_logs
DRAC Privileges
* login : Login to iDRAC
* drac : Con... | salt/modules/drac.py | def create_user(username, password, permissions, users=None):
'''
Create user accounts
CLI Example:
.. code-block:: bash
salt dell drac.create_user [USERNAME] [PASSWORD] [PRIVILEGES]
salt dell drac.create_user diana secret login,test_alerts,clear_logs
DRAC Privileges
* logi... | def create_user(username, password, permissions, users=None):
'''
Create user accounts
CLI Example:
.. code-block:: bash
salt dell drac.create_user [USERNAME] [PASSWORD] [PRIVILEGES]
salt dell drac.create_user diana secret login,test_alerts,clear_logs
DRAC Privileges
* logi... | [
"Create",
"user",
"accounts"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L252-L312 | [
"def",
"create_user",
"(",
"username",
",",
"password",
",",
"permissions",
",",
"users",
"=",
"None",
")",
":",
"_uids",
"=",
"set",
"(",
")",
"if",
"users",
"is",
"None",
":",
"users",
"=",
"list_users",
"(",
")",
"if",
"username",
"in",
"users",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_permissions | Configure users permissions
CLI Example:
.. code-block:: bash
salt dell drac.set_permissions [USERNAME] [PRIVILEGES] [USER INDEX - optional]
salt dell drac.set_permissions diana login,test_alerts,clear_logs 4
DRAC Privileges
* login : Login to iDRAC
* drac ... | salt/modules/drac.py | def set_permissions(username, permissions, uid=None):
'''
Configure users permissions
CLI Example:
.. code-block:: bash
salt dell drac.set_permissions [USERNAME] [PRIVILEGES] [USER INDEX - optional]
salt dell drac.set_permissions diana login,test_alerts,clear_logs 4
DRAC Privileg... | def set_permissions(username, permissions, uid=None):
'''
Configure users permissions
CLI Example:
.. code-block:: bash
salt dell drac.set_permissions [USERNAME] [PRIVILEGES] [USER INDEX - optional]
salt dell drac.set_permissions diana login,test_alerts,clear_logs 4
DRAC Privileg... | [
"Configure",
"users",
"permissions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L315-L362 | [
"def",
"set_permissions",
"(",
"username",
",",
"permissions",
",",
"uid",
"=",
"None",
")",
":",
"privileges",
"=",
"{",
"'login'",
":",
"'0x0000001'",
",",
"'drac'",
":",
"'0x0000002'",
",",
"'user_management'",
":",
"'0x0000004'",
",",
"'clear_logs'",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | server_pxe | Configure server to PXE perform a one off PXE boot
CLI Example:
.. code-block:: bash
salt dell drac.server_pxe | salt/modules/drac.py | def server_pxe():
'''
Configure server to PXE perform a one off PXE boot
CLI Example:
.. code-block:: bash
salt dell drac.server_pxe
'''
if __execute_cmd('config -g cfgServerInfo -o \
cfgServerFirstBootDevice PXE'):
if __execute_cmd('config -g cfgServerInfo -o cfgS... | def server_pxe():
'''
Configure server to PXE perform a one off PXE boot
CLI Example:
.. code-block:: bash
salt dell drac.server_pxe
'''
if __execute_cmd('config -g cfgServerInfo -o \
cfgServerFirstBootDevice PXE'):
if __execute_cmd('config -g cfgServerInfo -o cfgS... | [
"Configure",
"server",
"to",
"PXE",
"perform",
"a",
"one",
"off",
"PXE",
"boot"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/drac.py#L450-L469 | [
"def",
"server_pxe",
"(",
")",
":",
"if",
"__execute_cmd",
"(",
"'config -g cfgServerInfo -o \\\n cfgServerFirstBootDevice PXE'",
")",
":",
"if",
"__execute_cmd",
"(",
"'config -g cfgServerInfo -o cfgServerBootOnce 1'",
")",
":",
"return",
"server_reboot",
"else",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_mtime | Get the modified time of the RPM Database.
Returns:
Unix ticks | scripts/suse/yum/plugins/yumnotify.py | def _get_mtime():
"""
Get the modified time of the RPM Database.
Returns:
Unix ticks
"""
return os.path.exists(RPM_PATH) and int(os.path.getmtime(RPM_PATH)) or 0 | def _get_mtime():
"""
Get the modified time of the RPM Database.
Returns:
Unix ticks
"""
return os.path.exists(RPM_PATH) and int(os.path.getmtime(RPM_PATH)) or 0 | [
"Get",
"the",
"modified",
"time",
"of",
"the",
"RPM",
"Database",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/scripts/suse/yum/plugins/yumnotify.py#L18-L25 | [
"def",
"_get_mtime",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"RPM_PATH",
")",
"and",
"int",
"(",
"os",
".",
"path",
".",
"getmtime",
"(",
"RPM_PATH",
")",
")",
"or",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_checksum | Get the checksum of the RPM Database.
Returns:
hexdigest | scripts/suse/yum/plugins/yumnotify.py | def _get_checksum():
"""
Get the checksum of the RPM Database.
Returns:
hexdigest
"""
digest = hashlib.sha256()
with open(RPM_PATH, "rb") as rpm_db_fh:
while True:
buff = rpm_db_fh.read(0x1000)
if not buff:
break
digest.update(... | def _get_checksum():
"""
Get the checksum of the RPM Database.
Returns:
hexdigest
"""
digest = hashlib.sha256()
with open(RPM_PATH, "rb") as rpm_db_fh:
while True:
buff = rpm_db_fh.read(0x1000)
if not buff:
break
digest.update(... | [
"Get",
"the",
"checksum",
"of",
"the",
"RPM",
"Database",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/scripts/suse/yum/plugins/yumnotify.py#L28-L42 | [
"def",
"_get_checksum",
"(",
")",
":",
"digest",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"with",
"open",
"(",
"RPM_PATH",
",",
"\"rb\"",
")",
"as",
"rpm_db_fh",
":",
"while",
"True",
":",
"buff",
"=",
"rpm_db_fh",
".",
"read",
"(",
"0x1000",
")",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | posttrans_hook | Hook after the package installation transaction.
:param conduit:
:return: | scripts/suse/yum/plugins/yumnotify.py | def posttrans_hook(conduit):
"""
Hook after the package installation transaction.
:param conduit:
:return:
"""
# Integrate Yum with Salt
if 'SALT_RUNNING' not in os.environ:
with open(CK_PATH, 'w') as ck_fh:
ck_fh.write('{chksum} {mtime}\n'.format(chksum=_get_checksum(),... | def posttrans_hook(conduit):
"""
Hook after the package installation transaction.
:param conduit:
:return:
"""
# Integrate Yum with Salt
if 'SALT_RUNNING' not in os.environ:
with open(CK_PATH, 'w') as ck_fh:
ck_fh.write('{chksum} {mtime}\n'.format(chksum=_get_checksum(),... | [
"Hook",
"after",
"the",
"package",
"installation",
"transaction",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/scripts/suse/yum/plugins/yumnotify.py#L45-L55 | [
"def",
"posttrans_hook",
"(",
"conduit",
")",
":",
"# Integrate Yum with Salt",
"if",
"'SALT_RUNNING'",
"not",
"in",
"os",
".",
"environ",
":",
"with",
"open",
"(",
"CK_PATH",
",",
"'w'",
")",
"as",
"ck_fh",
":",
"ck_fh",
".",
"write",
"(",
"'{chksum} {mtime... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_master | Parse the master.cf file. This file is essentially a whitespace-delimited
columnar file. The columns are: service, type, private (yes), unpriv (yes),
chroot (yes), wakeup (never), maxproc (100), command + args.
This function parses out the columns, leaving empty lines and comments
intact. Where the val... | salt/modules/postfix.py | def _parse_master(path=MASTER_CF):
'''
Parse the master.cf file. This file is essentially a whitespace-delimited
columnar file. The columns are: service, type, private (yes), unpriv (yes),
chroot (yes), wakeup (never), maxproc (100), command + args.
This function parses out the columns, leaving emp... | def _parse_master(path=MASTER_CF):
'''
Parse the master.cf file. This file is essentially a whitespace-delimited
columnar file. The columns are: service, type, private (yes), unpriv (yes),
chroot (yes), wakeup (never), maxproc (100), command + args.
This function parses out the columns, leaving emp... | [
"Parse",
"the",
"master",
".",
"cf",
"file",
".",
"This",
"file",
"is",
"essentially",
"a",
"whitespace",
"-",
"delimited",
"columnar",
"file",
".",
"The",
"columns",
"are",
":",
"service",
"type",
"private",
"(",
"yes",
")",
"unpriv",
"(",
"yes",
")",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L45-L84 | [
"def",
"_parse_master",
"(",
"path",
"=",
"MASTER_CF",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fh_",
":",
"full_conf",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_master | Set a single config value in the master.cf file. If the value does not
already exist, it will be appended to the end.
Because of shell parsing issues, '-' cannot be set as a value, as is normal
in the master.cf file; either 'y', 'n' or a number should be used when
calling this function from the command... | salt/modules/postfix.py | def set_master(service,
conn_type,
private='y',
unpriv='y',
chroot='y',
wakeup='n',
maxproc='100',
command='',
write_conf=True,
path=MASTER_CF):
'''
Set a single config value in... | def set_master(service,
conn_type,
private='y',
unpriv='y',
chroot='y',
wakeup='n',
maxproc='100',
command='',
write_conf=True,
path=MASTER_CF):
'''
Set a single config value in... | [
"Set",
"a",
"single",
"config",
"value",
"in",
"the",
"master",
".",
"cf",
"file",
".",
"If",
"the",
"value",
"does",
"not",
"already",
"exist",
"it",
"will",
"be",
"appended",
"to",
"the",
"end",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L104-L169 | [
"def",
"set_master",
"(",
"service",
",",
"conn_type",
",",
"private",
"=",
"'y'",
",",
"unpriv",
"=",
"'y'",
",",
"chroot",
"=",
"'y'",
",",
"wakeup",
"=",
"'n'",
",",
"maxproc",
"=",
"'100'",
",",
"command",
"=",
"''",
",",
"write_conf",
"=",
"True... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _format_master | Format the given values into the style of line normally used in the
master.cf file. | salt/modules/postfix.py | def _format_master(service,
conn_type,
private,
unpriv,
chroot,
wakeup,
maxproc,
command):
'''
Format the given values into the style of line normally used in the
master.cf fi... | def _format_master(service,
conn_type,
private,
unpriv,
chroot,
wakeup,
maxproc,
command):
'''
Format the given values into the style of line normally used in the
master.cf fi... | [
"Format",
"the",
"given",
"values",
"into",
"the",
"style",
"of",
"line",
"normally",
"used",
"in",
"the",
"master",
".",
"cf",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L172-L216 | [
"def",
"_format_master",
"(",
"service",
",",
"conn_type",
",",
"private",
",",
"unpriv",
",",
"chroot",
",",
"wakeup",
",",
"maxproc",
",",
"command",
")",
":",
"#==========================================================================",
"#service type private unpriv c... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _parse_main | Parse files in the style of main.cf. This is not just a "name = value" file;
there are other rules:
* Comments start with #
* Any whitespace at the beginning of a line denotes that that line is a
continuation from the previous line.
* The whitespace rule applies to comments.
* Keys defined ... | salt/modules/postfix.py | def _parse_main(path=MAIN_CF):
'''
Parse files in the style of main.cf. This is not just a "name = value" file;
there are other rules:
* Comments start with #
* Any whitespace at the beginning of a line denotes that that line is a
continuation from the previous line.
* The whitespace ru... | def _parse_main(path=MAIN_CF):
'''
Parse files in the style of main.cf. This is not just a "name = value" file;
there are other rules:
* Comments start with #
* Any whitespace at the beginning of a line denotes that that line is a
continuation from the previous line.
* The whitespace ru... | [
"Parse",
"files",
"in",
"the",
"style",
"of",
"main",
".",
"cf",
".",
"This",
"is",
"not",
"just",
"a",
"name",
"=",
"value",
"file",
";",
"there",
"are",
"other",
"rules",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L219-L264 | [
"def",
"_parse_main",
"(",
"path",
"=",
"MAIN_CF",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'r'",
")",
"as",
"fh_",
":",
"full_conf",
"=",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_unicode",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_main | Set a single config value in the main.cf file. If the value does not already
exist, it will be appended to the end.
CLI Example:
salt <minion> postfix.set_main mailq_path /usr/bin/mailq | salt/modules/postfix.py | def set_main(key, value, path=MAIN_CF):
'''
Set a single config value in the main.cf file. If the value does not already
exist, it will be appended to the end.
CLI Example:
salt <minion> postfix.set_main mailq_path /usr/bin/mailq
'''
pairs, conf_list = _parse_main(path)
new_conf =... | def set_main(key, value, path=MAIN_CF):
'''
Set a single config value in the main.cf file. If the value does not already
exist, it will be appended to the end.
CLI Example:
salt <minion> postfix.set_main mailq_path /usr/bin/mailq
'''
pairs, conf_list = _parse_main(path)
new_conf =... | [
"Set",
"a",
"single",
"config",
"value",
"in",
"the",
"main",
".",
"cf",
"file",
".",
"If",
"the",
"value",
"does",
"not",
"already",
"exist",
"it",
"will",
"be",
"appended",
"to",
"the",
"end",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L284-L308 | [
"def",
"set_main",
"(",
"key",
",",
"value",
",",
"path",
"=",
"MAIN_CF",
")",
":",
"pairs",
",",
"conf_list",
"=",
"_parse_main",
"(",
"path",
")",
"new_conf",
"=",
"[",
"]",
"key_line_match",
"=",
"re",
".",
"compile",
"(",
"\"^{0}([\\\\s=]|$)\"",
".",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _write_conf | Write out configuration file. | salt/modules/postfix.py | def _write_conf(conf, path=MAIN_CF):
'''
Write out configuration file.
'''
with salt.utils.files.fopen(path, 'w') as fh_:
for line in conf:
line = salt.utils.stringutils.to_str(line)
if isinstance(line, dict):
fh_.write(' '.join(line))
else:
... | def _write_conf(conf, path=MAIN_CF):
'''
Write out configuration file.
'''
with salt.utils.files.fopen(path, 'w') as fh_:
for line in conf:
line = salt.utils.stringutils.to_str(line)
if isinstance(line, dict):
fh_.write(' '.join(line))
else:
... | [
"Write",
"out",
"configuration",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L311-L322 | [
"def",
"_write_conf",
"(",
"conf",
",",
"path",
"=",
"MAIN_CF",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"path",
",",
"'w'",
")",
"as",
"fh_",
":",
"for",
"line",
"in",
"conf",
":",
"line",
"=",
"salt",
".",
"utils... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_queue | Show contents of the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.show_queue | salt/modules/postfix.py | def show_queue():
'''
Show contents of the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.show_queue
'''
cmd = 'mailq'
out = __salt__['cmd.run'](cmd).splitlines()
queue = []
queue_pattern = re.compile(r"(?P<queue_id>^[A-Z0-9]+)\s+(?P<size>\d+)\s(?P<timesta... | def show_queue():
'''
Show contents of the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.show_queue
'''
cmd = 'mailq'
out = __salt__['cmd.run'](cmd).splitlines()
queue = []
queue_pattern = re.compile(r"(?P<queue_id>^[A-Z0-9]+)\s+(?P<size>\d+)\s(?P<timesta... | [
"Show",
"contents",
"of",
"the",
"mail",
"queue"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L325-L357 | [
"def",
"show_queue",
"(",
")",
":",
"cmd",
"=",
"'mailq'",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"cmd",
")",
".",
"splitlines",
"(",
")",
"queue",
"=",
"[",
"]",
"queue_pattern",
"=",
"re",
".",
"compile",
"(",
"r\"(?P<queue_id>^[A-Z0-9]+)\... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete | Delete message(s) from the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.delete 5C33CA0DEA
salt '*' postfix.delete ALL | salt/modules/postfix.py | def delete(queue_id):
'''
Delete message(s) from the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.delete 5C33CA0DEA
salt '*' postfix.delete ALL
'''
ret = {'message': '',
'result': True
}
if not queue_id:
log.error('Require... | def delete(queue_id):
'''
Delete message(s) from the mail queue
CLI Example:
.. code-block:: bash
salt '*' postfix.delete 5C33CA0DEA
salt '*' postfix.delete ALL
'''
ret = {'message': '',
'result': True
}
if not queue_id:
log.error('Require... | [
"Delete",
"message",
"(",
"s",
")",
"from",
"the",
"mail",
"queue"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/postfix.py#L360-L406 | [
"def",
"delete",
"(",
"queue_id",
")",
":",
"ret",
"=",
"{",
"'message'",
":",
"''",
",",
"'result'",
":",
"True",
"}",
"if",
"not",
"queue_id",
":",
"log",
".",
"error",
"(",
"'Require argument queue_id'",
")",
"if",
"not",
"queue_id",
"==",
"'ALL'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | collection_get_options | Get collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
CLI Example:
.. code-block:: bash
salt '*' solrcloud.collection_get_options collection_name | salt/modules/solrcloud.py | def collection_get_options(collection_name, **kwargs):
'''
Get collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
CLI Example:
.. code-block:: bash
salt '*' solrcloud.collection_get_options collection_name
'''
cluster = cluster_st... | def collection_get_options(collection_name, **kwargs):
'''
Get collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
CLI Example:
.. code-block:: bash
salt '*' solrcloud.collection_get_options collection_name
'''
cluster = cluster_st... | [
"Get",
"collection",
"options"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solrcloud.py#L445-L473 | [
"def",
"collection_get_options",
"(",
"collection_name",
",",
"*",
"*",
"kwargs",
")",
":",
"cluster",
"=",
"cluster_status",
"(",
"*",
"*",
"kwargs",
")",
"options",
"=",
"{",
"\"collection.configName\"",
":",
"cluster",
"[",
"\"collections\"",
"]",
"[",
"col... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | collection_set_options | Change collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
Note that not every parameter can be changed after collection creation
CLI Example:
.. code-block:: bash
salt '*' solrcloud.collection_set_options collection_name options={"replication... | salt/modules/solrcloud.py | def collection_set_options(collection_name, options, **kwargs):
'''
Change collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
Note that not every parameter can be changed after collection creation
CLI Example:
.. code-block:: bash
sal... | def collection_set_options(collection_name, options, **kwargs):
'''
Change collection options
Additional parameters (kwargs) may be passed, they will be proxied to http.query
Note that not every parameter can be changed after collection creation
CLI Example:
.. code-block:: bash
sal... | [
"Change",
"collection",
"options"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solrcloud.py#L476-L497 | [
"def",
"collection_set_options",
"(",
"collection_name",
",",
"options",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"option",
"in",
"list",
"(",
"options",
".",
"keys",
"(",
")",
")",
":",
"if",
"option",
"not",
"in",
"CREATION_ONLY_OPTION",
":",
"raise",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list | Lists certificates in a keytool managed keystore.
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the keystore
:param alias: (Optional) If found, displays details on only this key
:param return_certs: (Optional) Also return certificate PEM.
... | salt/modules/keystore.py | def list(keystore, passphrase, alias=None, return_cert=False):
'''
Lists certificates in a keytool managed keystore.
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the keystore
:param alias: (Optional) If found, displays details on only t... | def list(keystore, passphrase, alias=None, return_cert=False):
'''
Lists certificates in a keytool managed keystore.
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the keystore
:param alias: (Optional) If found, displays details on only t... | [
"Lists",
"certificates",
"in",
"a",
"keytool",
"managed",
"keystore",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystore.py#L63-L121 | [
"def",
"list",
"(",
"keystore",
",",
"passphrase",
",",
"alias",
"=",
"None",
",",
"return_cert",
"=",
"False",
")",
":",
"ASN1",
"=",
"OpenSSL",
".",
"crypto",
".",
"FILETYPE_ASN1",
"PEM",
"=",
"OpenSSL",
".",
"crypto",
".",
"FILETYPE_PEM",
"decoded_certs... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add | Adds certificates to an existing keystore or creates a new one if necesssary.
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the keystore
:param certificate: The PEM public certificate to add to keystore.... | salt/modules/keystore.py | def add(name, keystore, passphrase, certificate, private_key=None):
'''
Adds certificates to an existing keystore or creates a new one if necesssary.
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the... | def add(name, keystore, passphrase, certificate, private_key=None):
'''
Adds certificates to an existing keystore or creates a new one if necesssary.
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the... | [
"Adds",
"certificates",
"to",
"an",
"existing",
"keystore",
"or",
"creates",
"a",
"new",
"one",
"if",
"necesssary",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystore.py#L124-L172 | [
"def",
"add",
"(",
"name",
",",
"keystore",
",",
"passphrase",
",",
"certificate",
",",
"private_key",
"=",
"None",
")",
":",
"ASN1",
"=",
"OpenSSL",
".",
"crypto",
".",
"FILETYPE_ASN1",
"PEM",
"=",
"OpenSSL",
".",
"crypto",
".",
"FILETYPE_PEM",
"certs_lis... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove | Removes a certificate from an existing keystore.
Returns True if remove was successful, otherwise False
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode the keystore
CLI Example:
.. code-block:: b... | salt/modules/keystore.py | def remove(name, keystore, passphrase):
'''
Removes a certificate from an existing keystore.
Returns True if remove was successful, otherwise False
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode t... | def remove(name, keystore, passphrase):
'''
Removes a certificate from an existing keystore.
Returns True if remove was successful, otherwise False
:param name: alias for the certificate
:param keystore: The path to the keystore file to query
:param passphrase: The passphrase to use to decode t... | [
"Removes",
"a",
"certificate",
"from",
"an",
"existing",
"keystore",
".",
"Returns",
"True",
"if",
"remove",
"was",
"successful",
"otherwise",
"False"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystore.py#L175-L203 | [
"def",
"remove",
"(",
"name",
",",
"keystore",
",",
"passphrase",
")",
":",
"certs_list",
"=",
"[",
"]",
"keystore_object",
"=",
"jks",
".",
"KeyStore",
".",
"load",
"(",
"keystore",
",",
"passphrase",
")",
"for",
"alias",
",",
"loaded_cert",
"in",
"keys... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | store | Store information in a file. | salt/cache/localfs.py | def store(bank, key, data, cachedir):
'''
Store information in a file.
'''
base = os.path.join(cachedir, os.path.normpath(bank))
try:
os.makedirs(base)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise SaltCacheError(
'The cache directory, {0}... | def store(bank, key, data, cachedir):
'''
Store information in a file.
'''
base = os.path.join(cachedir, os.path.normpath(bank))
try:
os.makedirs(base)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise SaltCacheError(
'The cache directory, {0}... | [
"Store",
"information",
"in",
"a",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L44-L72 | [
"def",
"store",
"(",
"bank",
",",
"key",
",",
"data",
",",
"cachedir",
")",
":",
"base",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cachedir",
",",
"os",
".",
"path",
".",
"normpath",
"(",
"bank",
")",
")",
"try",
":",
"os",
".",
"makedirs",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | fetch | Fetch information from a file. | salt/cache/localfs.py | def fetch(bank, key, cachedir):
'''
Fetch information from a file.
'''
inkey = False
key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
if not os.path.isfile(key_file):
# The bank includes the full filename, and the key is inside the file
key_file = os... | def fetch(bank, key, cachedir):
'''
Fetch information from a file.
'''
inkey = False
key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
if not os.path.isfile(key_file):
# The bank includes the full filename, and the key is inside the file
key_file = os... | [
"Fetch",
"information",
"from",
"a",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L75-L100 | [
"def",
"fetch",
"(",
"bank",
",",
"key",
",",
"cachedir",
")",
":",
"inkey",
"=",
"False",
"key_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cachedir",
",",
"os",
".",
"path",
".",
"normpath",
"(",
"bank",
")",
",",
"'{0}.p'",
".",
"format",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | updated | Return the epoch of the mtime for this cache file | salt/cache/localfs.py | def updated(bank, key, cachedir):
'''
Return the epoch of the mtime for this cache file
'''
key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
if not os.path.isfile(key_file):
log.warning('Cache file "%s" does not exist', key_file)
return None
try:
... | def updated(bank, key, cachedir):
'''
Return the epoch of the mtime for this cache file
'''
key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
if not os.path.isfile(key_file):
log.warning('Cache file "%s" does not exist', key_file)
return None
try:
... | [
"Return",
"the",
"epoch",
"of",
"the",
"mtime",
"for",
"this",
"cache",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L103-L118 | [
"def",
"updated",
"(",
"bank",
",",
"key",
",",
"cachedir",
")",
":",
"key_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cachedir",
",",
"os",
".",
"path",
".",
"normpath",
"(",
"bank",
")",
",",
"'{0}.p'",
".",
"format",
"(",
"key",
")",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | flush | Remove the key from the cache bank with all the key content. | salt/cache/localfs.py | def flush(bank, key=None, cachedir=None):
'''
Remove the key from the cache bank with all the key content.
'''
if cachedir is None:
cachedir = __cachedir()
try:
if key is None:
target = os.path.join(cachedir, os.path.normpath(bank))
if not os.path.isdir(targe... | def flush(bank, key=None, cachedir=None):
'''
Remove the key from the cache bank with all the key content.
'''
if cachedir is None:
cachedir = __cachedir()
try:
if key is None:
target = os.path.join(cachedir, os.path.normpath(bank))
if not os.path.isdir(targe... | [
"Remove",
"the",
"key",
"from",
"the",
"cache",
"bank",
"with",
"all",
"the",
"key",
"content",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L121-L145 | [
"def",
"flush",
"(",
"bank",
",",
"key",
"=",
"None",
",",
"cachedir",
"=",
"None",
")",
":",
"if",
"cachedir",
"is",
"None",
":",
"cachedir",
"=",
"__cachedir",
"(",
")",
"try",
":",
"if",
"key",
"is",
"None",
":",
"target",
"=",
"os",
".",
"pat... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_ | Return an iterable object containing all entries stored in the specified bank. | salt/cache/localfs.py | def list_(bank, cachedir):
'''
Return an iterable object containing all entries stored in the specified bank.
'''
base = os.path.join(cachedir, os.path.normpath(bank))
if not os.path.isdir(base):
return []
try:
items = os.listdir(base)
except OSError as exc:
raise Sal... | def list_(bank, cachedir):
'''
Return an iterable object containing all entries stored in the specified bank.
'''
base = os.path.join(cachedir, os.path.normpath(bank))
if not os.path.isdir(base):
return []
try:
items = os.listdir(base)
except OSError as exc:
raise Sal... | [
"Return",
"an",
"iterable",
"object",
"containing",
"all",
"entries",
"stored",
"in",
"the",
"specified",
"bank",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L148-L169 | [
"def",
"list_",
"(",
"bank",
",",
"cachedir",
")",
":",
"base",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cachedir",
",",
"os",
".",
"path",
".",
"normpath",
"(",
"bank",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"base",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | contains | Checks if the specified bank contains the specified key. | salt/cache/localfs.py | def contains(bank, key, cachedir):
'''
Checks if the specified bank contains the specified key.
'''
if key is None:
base = os.path.join(cachedir, os.path.normpath(bank))
return os.path.isdir(base)
else:
keyfile = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(k... | def contains(bank, key, cachedir):
'''
Checks if the specified bank contains the specified key.
'''
if key is None:
base = os.path.join(cachedir, os.path.normpath(bank))
return os.path.isdir(base)
else:
keyfile = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(k... | [
"Checks",
"if",
"the",
"specified",
"bank",
"contains",
"the",
"specified",
"key",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cache/localfs.py#L172-L181 | [
"def",
"contains",
"(",
"bank",
",",
"key",
",",
"cachedir",
")",
":",
"if",
"key",
"is",
"None",
":",
"base",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cachedir",
",",
"os",
".",
"path",
".",
"normpath",
"(",
"bank",
")",
")",
"return",
"os",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | key_exists | Check that the key is found in the registry. This refers to keys and not
value/data pairs. To check value/data pairs, use ``value_exists``
Args:
hive (str): The hive to connect to
key (str): The key to check
use_32bit_registry (bool): Look in the 32bit portion of the registry
Re... | salt/utils/win_reg.py | def key_exists(hive, key, use_32bit_registry=False):
'''
Check that the key is found in the registry. This refers to keys and not
value/data pairs. To check value/data pairs, use ``value_exists``
Args:
hive (str): The hive to connect to
key (str): The key to check
use_32bit_r... | def key_exists(hive, key, use_32bit_registry=False):
'''
Check that the key is found in the registry. This refers to keys and not
value/data pairs. To check value/data pairs, use ``value_exists``
Args:
hive (str): The hive to connect to
key (str): The key to check
use_32bit_r... | [
"Check",
"that",
"the",
"key",
"is",
"found",
"in",
"the",
"registry",
".",
"This",
"refers",
"to",
"keys",
"and",
"not",
"value",
"/",
"data",
"pairs",
".",
"To",
"check",
"value",
"/",
"data",
"pairs",
"use",
"value_exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L162-L205 | [
"def",
"key_exists",
"(",
"hive",
",",
"key",
",",
"use_32bit_registry",
"=",
"False",
")",
":",
"local_hive",
"=",
"_to_unicode",
"(",
"hive",
")",
"local_key",
"=",
"_to_unicode",
"(",
"key",
")",
"registry",
"=",
"Registry",
"(",
")",
"try",
":",
"hke... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | value_exists | Check that the value/data pair is found in the registry.
.. version-added:: 2018.3.4
Args:
hive (str): The hive to connect to
key (str): The key to check in
vname (str): The name of the value/data pair you're checking
use_32bit_registry (bool): Look in the 32bit portion of ... | salt/utils/win_reg.py | def value_exists(hive, key, vname, use_32bit_registry=False):
'''
Check that the value/data pair is found in the registry.
.. version-added:: 2018.3.4
Args:
hive (str): The hive to connect to
key (str): The key to check in
vname (str): The name of the value/data pair you're ... | def value_exists(hive, key, vname, use_32bit_registry=False):
'''
Check that the value/data pair is found in the registry.
.. version-added:: 2018.3.4
Args:
hive (str): The hive to connect to
key (str): The key to check in
vname (str): The name of the value/data pair you're ... | [
"Check",
"that",
"the",
"value",
"/",
"data",
"pair",
"is",
"found",
"in",
"the",
"registry",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L208-L266 | [
"def",
"value_exists",
"(",
"hive",
",",
"key",
",",
"vname",
",",
"use_32bit_registry",
"=",
"False",
")",
":",
"local_hive",
"=",
"_to_unicode",
"(",
"hive",
")",
"local_key",
"=",
"_to_unicode",
"(",
"key",
")",
"local_vname",
"=",
"_to_unicode",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | broadcast_change | Refresh the windows environment.
.. note::
This will only effect new processes and windows. Services will not see
the change until the system restarts.
Returns:
bool: True if successful, otherwise False
Usage:
.. code-block:: python
import salt.utils.win_reg
... | salt/utils/win_reg.py | def broadcast_change():
'''
Refresh the windows environment.
.. note::
This will only effect new processes and windows. Services will not see
the change until the system restarts.
Returns:
bool: True if successful, otherwise False
Usage:
.. code-block:: python
... | def broadcast_change():
'''
Refresh the windows environment.
.. note::
This will only effect new processes and windows. Services will not see
the change until the system restarts.
Returns:
bool: True if successful, otherwise False
Usage:
.. code-block:: python
... | [
"Refresh",
"the",
"windows",
"environment",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L269-L291 | [
"def",
"broadcast_change",
"(",
")",
":",
"# https://msdn.microsoft.com/en-us/library/windows/desktop/ms644952(v=vs.85).aspx",
"_",
",",
"res",
"=",
"win32gui",
".",
"SendMessageTimeout",
"(",
"win32con",
".",
"HWND_BROADCAST",
",",
"win32con",
".",
"WM_SETTINGCHANGE",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_keys | Enumerates the subkeys in a registry key or hive.
Args:
hive (str):
The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
- HKEY_USERS or HKU
- HKEY_CLASSES_ROOT or HKCR
... | salt/utils/win_reg.py | def list_keys(hive, key=None, use_32bit_registry=False):
'''
Enumerates the subkeys in a registry key or hive.
Args:
hive (str):
The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
-... | def list_keys(hive, key=None, use_32bit_registry=False):
'''
Enumerates the subkeys in a registry key or hive.
Args:
hive (str):
The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
-... | [
"Enumerates",
"the",
"subkeys",
"in",
"a",
"registry",
"key",
"or",
"hive",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L294-L357 | [
"def",
"list_keys",
"(",
"hive",
",",
"key",
"=",
"None",
",",
"use_32bit_registry",
"=",
"False",
")",
":",
"local_hive",
"=",
"_to_unicode",
"(",
"hive",
")",
"local_key",
"=",
"_to_unicode",
"(",
"key",
")",
"registry",
"=",
"Registry",
"(",
")",
"try... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_values | Enumerates the values in a registry key or hive.
Args:
hive (str):
The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
- HKEY_USER or HKU
- HKEY_CLASSES_ROOT or HKCR
... | salt/utils/win_reg.py | def list_values(hive, key=None, use_32bit_registry=False, include_default=True):
'''
Enumerates the values in a registry key or hive.
Args:
hive (str):
The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER o... | def list_values(hive, key=None, use_32bit_registry=False, include_default=True):
'''
Enumerates the values in a registry key or hive.
Args:
hive (str):
The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER o... | [
"Enumerates",
"the",
"values",
"in",
"a",
"registry",
"key",
"or",
"hive",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L360-L438 | [
"def",
"list_values",
"(",
"hive",
",",
"key",
"=",
"None",
",",
"use_32bit_registry",
"=",
"False",
",",
"include_default",
"=",
"True",
")",
":",
"local_hive",
"=",
"_to_unicode",
"(",
"hive",
")",
"local_key",
"=",
"_to_unicode",
"(",
"key",
")",
"regis... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | read_value | r'''
Reads a registry value entry or the default value for a key. To read the
default value, don't pass ``vname``
Args:
hive (str): The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
- HKEY_USER or HKU
... | salt/utils/win_reg.py | def read_value(hive, key, vname=None, use_32bit_registry=False):
r'''
Reads a registry value entry or the default value for a key. To read the
default value, don't pass ``vname``
Args:
hive (str): The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
... | def read_value(hive, key, vname=None, use_32bit_registry=False):
r'''
Reads a registry value entry or the default value for a key. To read the
default value, don't pass ``vname``
Args:
hive (str): The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
... | [
"r",
"Reads",
"a",
"registry",
"value",
"entry",
"or",
"the",
"default",
"value",
"for",
"a",
"key",
".",
"To",
"read",
"the",
"default",
"value",
"don",
"t",
"pass",
"vname"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L441-L555 | [
"def",
"read_value",
"(",
"hive",
",",
"key",
",",
"vname",
"=",
"None",
",",
"use_32bit_registry",
"=",
"False",
")",
":",
"# If no name is passed, the default value of the key will be returned",
"# The value name is Default",
"# Setup the return array",
"local_hive",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_value | Sets a value in the registry. If ``vname`` is passed, it will be the value
for that value name, otherwise it will be the default value for the
specified key
Args:
hive (str):
The name of the hive. Can be one of the following
- HKEY_LOCAL_MACHINE or HKLM
... | salt/utils/win_reg.py | def set_value(hive,
key,
vname=None,
vdata=None,
vtype='REG_SZ',
use_32bit_registry=False,
volatile=False):
'''
Sets a value in the registry. If ``vname`` is passed, it will be the value
for that value name, otherwise it wil... | def set_value(hive,
key,
vname=None,
vdata=None,
vtype='REG_SZ',
use_32bit_registry=False,
volatile=False):
'''
Sets a value in the registry. If ``vname`` is passed, it will be the value
for that value name, otherwise it wil... | [
"Sets",
"a",
"value",
"in",
"the",
"registry",
".",
"If",
"vname",
"is",
"passed",
"it",
"will",
"be",
"the",
"value",
"for",
"that",
"value",
"name",
"otherwise",
"it",
"will",
"be",
"the",
"default",
"value",
"for",
"the",
"specified",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L558-L719 | [
"def",
"set_value",
"(",
"hive",
",",
"key",
",",
"vname",
"=",
"None",
",",
"vdata",
"=",
"None",
",",
"vtype",
"=",
"'REG_SZ'",
",",
"use_32bit_registry",
"=",
"False",
",",
"volatile",
"=",
"False",
")",
":",
"local_hive",
"=",
"_to_unicode",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cast_vdata | Cast the ``vdata` value to the appropriate data type for the registry type
specified in ``vtype``
Args:
vdata (str, int, list, bytes): The data to cast
vtype (str):
The type of data to be written to the registry. Must be one of the
following:
- REG_BIN... | salt/utils/win_reg.py | def cast_vdata(vdata=None, vtype='REG_SZ'):
'''
Cast the ``vdata` value to the appropriate data type for the registry type
specified in ``vtype``
Args:
vdata (str, int, list, bytes): The data to cast
vtype (str):
The type of data to be written to the registry. Must be one ... | def cast_vdata(vdata=None, vtype='REG_SZ'):
'''
Cast the ``vdata` value to the appropriate data type for the registry type
specified in ``vtype``
Args:
vdata (str, int, list, bytes): The data to cast
vtype (str):
The type of data to be written to the registry. Must be one ... | [
"Cast",
"the",
"vdata",
"value",
"to",
"the",
"appropriate",
"data",
"type",
"for",
"the",
"registry",
"type",
"specified",
"in",
"vtype"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L722-L777 | [
"def",
"cast_vdata",
"(",
"vdata",
"=",
"None",
",",
"vtype",
"=",
"'REG_SZ'",
")",
":",
"# Check data type and cast to expected type",
"# int will automatically become long on 64bit numbers",
"# https://www.python.org/dev/peps/pep-0237/",
"registry",
"=",
"Registry",
"(",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_key_recursive | .. versionadded:: 2015.5.4
Delete a registry key to include all subkeys and value/data pairs.
Args:
hive (str):
The name of the hive. Can be one of the following
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
- HKEY_USER or HKU
... | salt/utils/win_reg.py | def delete_key_recursive(hive, key, use_32bit_registry=False):
'''
.. versionadded:: 2015.5.4
Delete a registry key to include all subkeys and value/data pairs.
Args:
hive (str):
The name of the hive. Can be one of the following
- HKEY_LOCAL_MACHINE or HKLM
... | def delete_key_recursive(hive, key, use_32bit_registry=False):
'''
.. versionadded:: 2015.5.4
Delete a registry key to include all subkeys and value/data pairs.
Args:
hive (str):
The name of the hive. Can be one of the following
- HKEY_LOCAL_MACHINE or HKLM
... | [
"..",
"versionadded",
"::",
"2015",
".",
"5",
".",
"4"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L780-L887 | [
"def",
"delete_key_recursive",
"(",
"hive",
",",
"key",
",",
"use_32bit_registry",
"=",
"False",
")",
":",
"local_hive",
"=",
"_to_unicode",
"(",
"hive",
")",
"local_key",
"=",
"_to_unicode",
"(",
"key",
")",
"# Instantiate the registry object",
"registry",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_value | Delete a registry value entry or the default value for a key.
Args:
hive (str):
The name of the hive. Can be one of the following
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or HKCU
- HKEY_USER or HKU
- HKEY_CLASSES_ROOT or ... | salt/utils/win_reg.py | def delete_value(hive, key, vname=None, use_32bit_registry=False):
'''
Delete a registry value entry or the default value for a key.
Args:
hive (str):
The name of the hive. Can be one of the following
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or ... | def delete_value(hive, key, vname=None, use_32bit_registry=False):
'''
Delete a registry value entry or the default value for a key.
Args:
hive (str):
The name of the hive. Can be one of the following
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER or ... | [
"Delete",
"a",
"registry",
"value",
"entry",
"or",
"the",
"default",
"value",
"for",
"a",
"key",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_reg.py#L890-L955 | [
"def",
"delete_value",
"(",
"hive",
",",
"key",
",",
"vname",
"=",
"None",
",",
"use_32bit_registry",
"=",
"False",
")",
":",
"local_hive",
"=",
"_to_unicode",
"(",
"hive",
")",
"local_key",
"=",
"_to_unicode",
"(",
"key",
")",
"local_vname",
"=",
"_to_uni... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | atq | List all queued and running jobs or only those with
an optional 'tag'.
CLI Example:
.. code-block:: bash
salt '*' at.atq
salt '*' at.atq [tag]
salt '*' at.atq [job number] | salt/modules/at_solaris.py | def atq(tag=None):
'''
List all queued and running jobs or only those with
an optional 'tag'.
CLI Example:
.. code-block:: bash
salt '*' at.atq
salt '*' at.atq [tag]
salt '*' at.atq [job number]
'''
jobs = []
res = __salt__['cmd.run_all']('atq')
if res['r... | def atq(tag=None):
'''
List all queued and running jobs or only those with
an optional 'tag'.
CLI Example:
.. code-block:: bash
salt '*' at.atq
salt '*' at.atq [tag]
salt '*' at.atq [job number]
'''
jobs = []
res = __salt__['cmd.run_all']('atq')
if res['r... | [
"List",
"all",
"queued",
"and",
"running",
"jobs",
"or",
"only",
"those",
"with",
"an",
"optional",
"tag",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at_solaris.py#L50-L121 | [
"def",
"atq",
"(",
"tag",
"=",
"None",
")",
":",
"jobs",
"=",
"[",
"]",
"res",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"'atq'",
")",
"if",
"res",
"[",
"'retcode'",
"]",
">",
"0",
":",
"return",
"{",
"'error'",
":",
"res",
"[",
"'stderr'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | atrm | Remove jobs from the queue.
CLI Example:
.. code-block:: bash
salt '*' at.atrm <jobid> <jobid> .. <jobid>
salt '*' at.atrm all
salt '*' at.atrm all [tag] | salt/modules/at_solaris.py | def atrm(*args):
'''
Remove jobs from the queue.
CLI Example:
.. code-block:: bash
salt '*' at.atrm <jobid> <jobid> .. <jobid>
salt '*' at.atrm all
salt '*' at.atrm all [tag]
'''
if not args:
return {'jobs': {'removed': [], 'tag': None}}
if args[0] == 'al... | def atrm(*args):
'''
Remove jobs from the queue.
CLI Example:
.. code-block:: bash
salt '*' at.atrm <jobid> <jobid> .. <jobid>
salt '*' at.atrm all
salt '*' at.atrm all [tag]
'''
if not args:
return {'jobs': {'removed': [], 'tag': None}}
if args[0] == 'al... | [
"Remove",
"jobs",
"from",
"the",
"queue",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at_solaris.py#L124-L167 | [
"def",
"atrm",
"(",
"*",
"args",
")",
":",
"if",
"not",
"args",
":",
"return",
"{",
"'jobs'",
":",
"{",
"'removed'",
":",
"[",
"]",
",",
"'tag'",
":",
"None",
"}",
"}",
"if",
"args",
"[",
"0",
"]",
"==",
"'all'",
":",
"if",
"len",
"(",
"args"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | at | Add a job to the queue.
The 'timespec' follows the format documented in the
at(1) manpage.
CLI Example:
.. code-block:: bash
salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>]
salt '*' at.at 12:05am '/sbin/reboot' tag=reboot
salt '*' at.at '3:05am +3 days' 'bin/myscri... | salt/modules/at_solaris.py | def at(*args, **kwargs): # pylint: disable=C0103
'''
Add a job to the queue.
The 'timespec' follows the format documented in the
at(1) manpage.
CLI Example:
.. code-block:: bash
salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>]
salt '*' at.at 12:05am '/sbin/reboot' ... | def at(*args, **kwargs): # pylint: disable=C0103
'''
Add a job to the queue.
The 'timespec' follows the format documented in the
at(1) manpage.
CLI Example:
.. code-block:: bash
salt '*' at.at <timespec> <cmd> [tag=<tag>] [runas=<user>]
salt '*' at.at 12:05am '/sbin/reboot' ... | [
"Add",
"a",
"job",
"to",
"the",
"queue",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at_solaris.py#L170-L211 | [
"def",
"at",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=C0103",
"# check args",
"if",
"len",
"(",
"args",
")",
"<",
"2",
":",
"return",
"{",
"'jobs'",
":",
"[",
"]",
"}",
"# build job",
"if",
"'tag'",
"in",
"kwargs",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | atc | Print the at(1) script that will run for the passed job
id. This is mostly for debugging so the output will
just be text.
CLI Example:
.. code-block:: bash
salt '*' at.atc <jobid> | salt/modules/at_solaris.py | def atc(jobid):
'''
Print the at(1) script that will run for the passed job
id. This is mostly for debugging so the output will
just be text.
CLI Example:
.. code-block:: bash
salt '*' at.atc <jobid>
'''
atjob_file = '/var/spool/cron/atjobs/{job}'.format(
job=jobid
... | def atc(jobid):
'''
Print the at(1) script that will run for the passed job
id. This is mostly for debugging so the output will
just be text.
CLI Example:
.. code-block:: bash
salt '*' at.atc <jobid>
'''
atjob_file = '/var/spool/cron/atjobs/{job}'.format(
job=jobid
... | [
"Print",
"the",
"at",
"(",
"1",
")",
"script",
"that",
"will",
"run",
"for",
"the",
"passed",
"job",
"id",
".",
"This",
"is",
"mostly",
"for",
"debugging",
"so",
"the",
"output",
"will",
"just",
"be",
"text",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at_solaris.py#L214-L235 | [
"def",
"atc",
"(",
"jobid",
")",
":",
"atjob_file",
"=",
"'/var/spool/cron/atjobs/{job}'",
".",
"format",
"(",
"job",
"=",
"jobid",
")",
"if",
"__salt__",
"[",
"'file.file_exists'",
"]",
"(",
"atjob_file",
")",
":",
"with",
"salt",
".",
"utils",
".",
"file... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _refine_enc | Return the properly formatted ssh value for the authorized encryption key
type. ecdsa defaults to 256 bits, must give full ecdsa enc schema string
if using higher enc. If the type is not found, raise CommandExecutionError. | salt/modules/ssh.py | def _refine_enc(enc):
'''
Return the properly formatted ssh value for the authorized encryption key
type. ecdsa defaults to 256 bits, must give full ecdsa enc schema string
if using higher enc. If the type is not found, raise CommandExecutionError.
'''
rsa = ['r', 'rsa', 'ssh-rsa']
dss = ['... | def _refine_enc(enc):
'''
Return the properly formatted ssh value for the authorized encryption key
type. ecdsa defaults to 256 bits, must give full ecdsa enc schema string
if using higher enc. If the type is not found, raise CommandExecutionError.
'''
rsa = ['r', 'rsa', 'ssh-rsa']
dss = ['... | [
"Return",
"the",
"properly",
"formatted",
"ssh",
"value",
"for",
"the",
"authorized",
"encryption",
"key",
"type",
".",
"ecdsa",
"defaults",
"to",
"256",
"bits",
"must",
"give",
"full",
"ecdsa",
"enc",
"schema",
"string",
"if",
"using",
"higher",
"enc",
".",... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L52-L80 | [
"def",
"_refine_enc",
"(",
"enc",
")",
":",
"rsa",
"=",
"[",
"'r'",
",",
"'rsa'",
",",
"'ssh-rsa'",
"]",
"dss",
"=",
"[",
"'d'",
",",
"'dsa'",
",",
"'dss'",
",",
"'ssh-dss'",
"]",
"ecdsa",
"=",
"[",
"'e'",
",",
"'ecdsa'",
",",
"'ecdsa-sha2-nistp521'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _format_auth_line | Properly format user input. | salt/modules/ssh.py | def _format_auth_line(key, enc, comment, options):
'''
Properly format user input.
'''
line = ''
if options:
line += '{0} '.format(','.join(options))
line += '{0} {1} {2}\n'.format(enc, key, comment)
return line | def _format_auth_line(key, enc, comment, options):
'''
Properly format user input.
'''
line = ''
if options:
line += '{0} '.format(','.join(options))
line += '{0} {1} {2}\n'.format(enc, key, comment)
return line | [
"Properly",
"format",
"user",
"input",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L83-L91 | [
"def",
"_format_auth_line",
"(",
"key",
",",
"enc",
",",
"comment",
",",
"options",
")",
":",
"line",
"=",
"''",
"if",
"options",
":",
"line",
"+=",
"'{0} '",
".",
"format",
"(",
"','",
".",
"join",
"(",
"options",
")",
")",
"line",
"+=",
"'{0} {1} {... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _expand_authorized_keys_path | Expand the AuthorizedKeysFile expression. Defined in man sshd_config(5) | salt/modules/ssh.py | def _expand_authorized_keys_path(path, user, home):
'''
Expand the AuthorizedKeysFile expression. Defined in man sshd_config(5)
'''
converted_path = ''
had_escape = False
for char in path:
if had_escape:
had_escape = False
if char == '%':
converted... | def _expand_authorized_keys_path(path, user, home):
'''
Expand the AuthorizedKeysFile expression. Defined in man sshd_config(5)
'''
converted_path = ''
had_escape = False
for char in path:
if had_escape:
had_escape = False
if char == '%':
converted... | [
"Expand",
"the",
"AuthorizedKeysFile",
"expression",
".",
"Defined",
"in",
"man",
"sshd_config",
"(",
"5",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L94-L120 | [
"def",
"_expand_authorized_keys_path",
"(",
"path",
",",
"user",
",",
"home",
")",
":",
"converted_path",
"=",
"''",
"had_escape",
"=",
"False",
"for",
"char",
"in",
"path",
":",
"if",
"had_escape",
":",
"had_escape",
"=",
"False",
"if",
"char",
"==",
"'%'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_config_file | Get absolute path to a user's ssh_config. | salt/modules/ssh.py | def _get_config_file(user, config):
'''
Get absolute path to a user's ssh_config.
'''
uinfo = __salt__['user.info'](user)
if not uinfo:
raise CommandExecutionError('User \'{0}\' does not exist'.format(user))
home = uinfo['home']
config = _expand_authorized_keys_path(config, user, hom... | def _get_config_file(user, config):
'''
Get absolute path to a user's ssh_config.
'''
uinfo = __salt__['user.info'](user)
if not uinfo:
raise CommandExecutionError('User \'{0}\' does not exist'.format(user))
home = uinfo['home']
config = _expand_authorized_keys_path(config, user, hom... | [
"Get",
"absolute",
"path",
"to",
"a",
"user",
"s",
"ssh_config",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L123-L134 | [
"def",
"_get_config_file",
"(",
"user",
",",
"config",
")",
":",
"uinfo",
"=",
"__salt__",
"[",
"'user.info'",
"]",
"(",
"user",
")",
"if",
"not",
"uinfo",
":",
"raise",
"CommandExecutionError",
"(",
"'User \\'{0}\\' does not exist'",
".",
"format",
"(",
"user... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _replace_auth_key | Replace an existing key | salt/modules/ssh.py | def _replace_auth_key(
user,
key,
enc='ssh-rsa',
comment='',
options=None,
config='.ssh/authorized_keys'):
'''
Replace an existing key
'''
auth_line = _format_auth_line(key, enc, comment, options or [])
lines = []
full = _get_config_file(user, co... | def _replace_auth_key(
user,
key,
enc='ssh-rsa',
comment='',
options=None,
config='.ssh/authorized_keys'):
'''
Replace an existing key
'''
auth_line = _format_auth_line(key, enc, comment, options or [])
lines = []
full = _get_config_file(user, co... | [
"Replace",
"an",
"existing",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L137-L181 | [
"def",
"_replace_auth_key",
"(",
"user",
",",
"key",
",",
"enc",
"=",
"'ssh-rsa'",
",",
"comment",
"=",
"''",
",",
"options",
"=",
"None",
",",
"config",
"=",
"'.ssh/authorized_keys'",
")",
":",
"auth_line",
"=",
"_format_auth_line",
"(",
"key",
",",
"enc"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _validate_keys | Return a dict containing validated keys in the passed file | salt/modules/ssh.py | def _validate_keys(key_file, fingerprint_hash_type):
'''
Return a dict containing validated keys in the passed file
'''
ret = {}
linere = re.compile(r'^(.*?)\s?((?:ssh\-|ecds)[\w-]+\s.+)$')
try:
with salt.utils.files.fopen(key_file, 'r') as _fh:
for line in _fh:
... | def _validate_keys(key_file, fingerprint_hash_type):
'''
Return a dict containing validated keys in the passed file
'''
ret = {}
linere = re.compile(r'^(.*?)\s?((?:ssh\-|ecds)[\w-]+\s.+)$')
try:
with salt.utils.files.fopen(key_file, 'r') as _fh:
for line in _fh:
... | [
"Return",
"a",
"dict",
"containing",
"validated",
"keys",
"in",
"the",
"passed",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ssh.py#L184-L239 | [
"def",
"_validate_keys",
"(",
"key_file",
",",
"fingerprint_hash_type",
")",
":",
"ret",
"=",
"{",
"}",
"linere",
"=",
"re",
".",
"compile",
"(",
"r'^(.*?)\\s?((?:ssh\\-|ecds)[\\w-]+\\s.+)$'",
")",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.