repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
saltstack/salt
salt/cloud/clouds/vmware.py
list_nodes
def list_nodes(kwargs=None, call=None): ''' Return a list of all VMs and templates that are on the specified provider, with basic fields CLI Example: .. code-block:: bash salt-cloud -f list_nodes my-vmware-config To return a list of all VMs and templates present on ALL configured provide...
python
def list_nodes(kwargs=None, call=None): ''' Return a list of all VMs and templates that are on the specified provider, with basic fields CLI Example: .. code-block:: bash salt-cloud -f list_nodes my-vmware-config To return a list of all VMs and templates present on ALL configured provide...
[ "def", "list_nodes", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_nodes function must be called '", "'with -f or --function.'", ")", "ret", "=", "{", "}", "vm...
Return a list of all VMs and templates that are on the specified provider, with basic fields CLI Example: .. code-block:: bash salt-cloud -f list_nodes my-vmware-config To return a list of all VMs and templates present on ALL configured providers, with basic fields: CLI Example: .....
[ "Return", "a", "list", "of", "all", "VMs", "and", "templates", "that", "are", "on", "the", "specified", "provider", "with", "basic", "fields" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L1775-L1829
train
saltstack/salt
salt/cloud/clouds/vmware.py
list_nodes_select
def list_nodes_select(call=None): ''' Return a list of all VMs and templates that are on the specified provider, with fields specified under ``query.selection`` in ``/etc/salt/cloud`` CLI Example: .. code-block:: bash salt-cloud -f list_nodes_select my-vmware-config To return a list ...
python
def list_nodes_select(call=None): ''' Return a list of all VMs and templates that are on the specified provider, with fields specified under ``query.selection`` in ``/etc/salt/cloud`` CLI Example: .. code-block:: bash salt-cloud -f list_nodes_select my-vmware-config To return a list ...
[ "def", "list_nodes_select", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_nodes_select function must be called '", "'with -f or --function.'", ")", "ret", "=", "{", "}", "vm_properties", "=", ...
Return a list of all VMs and templates that are on the specified provider, with fields specified under ``query.selection`` in ``/etc/salt/cloud`` CLI Example: .. code-block:: bash salt-cloud -f list_nodes_select my-vmware-config To return a list of all VMs and templates present on ALL config...
[ "Return", "a", "list", "of", "all", "VMs", "and", "templates", "that", "are", "on", "the", "specified", "provider", "with", "fields", "specified", "under", "query", ".", "selection", "in", "/", "etc", "/", "salt", "/", "cloud" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L1883-L1968
train
saltstack/salt
salt/cloud/clouds/vmware.py
show_instance
def show_instance(name, call=None): ''' List all available details of the specified VM CLI Example: .. code-block:: bash salt-cloud -a show_instance vmname ''' if call != 'action': raise SaltCloudSystemExit( 'The show_instance action must be called with ' ...
python
def show_instance(name, call=None): ''' List all available details of the specified VM CLI Example: .. code-block:: bash salt-cloud -a show_instance vmname ''' if call != 'action': raise SaltCloudSystemExit( 'The show_instance action must be called with ' ...
[ "def", "show_instance", "(", "name", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The show_instance action must be called with '", "'-a or --action.'", ")", "vm_properties", "=", "[", "\"config.hardwar...
List all available details of the specified VM CLI Example: .. code-block:: bash salt-cloud -a show_instance vmname
[ "List", "all", "available", "details", "of", "the", "specified", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L1971-L2010
train
saltstack/salt
salt/cloud/clouds/vmware.py
avail_images
def avail_images(call=None): ''' Return a list of all the templates present in this VMware environment with basic details CLI Example: .. code-block:: bash salt-cloud --list-images my-vmware-config ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_...
python
def avail_images(call=None): ''' Return a list of all the templates present in this VMware environment with basic details CLI Example: .. code-block:: bash salt-cloud --list-images my-vmware-config ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_...
[ "def", "avail_images", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The avail_images function must be called with '", "'-f or --function, or with the --list-images option.'", ")", "templates", "=", "{", "}...
Return a list of all the templates present in this VMware environment with basic details CLI Example: .. code-block:: bash salt-cloud --list-images my-vmware-config
[ "Return", "a", "list", "of", "all", "the", "templates", "present", "in", "this", "VMware", "environment", "with", "basic", "details" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L2013-L2050
train
saltstack/salt
salt/cloud/clouds/vmware.py
list_folders
def list_folders(kwargs=None, call=None): ''' List all the folders for this VMware environment CLI Example: .. code-block:: bash salt-cloud -f list_folders my-vmware-config ''' if call != 'function': raise SaltCloudSystemExit( 'The list_folders function must be cal...
python
def list_folders(kwargs=None, call=None): ''' List all the folders for this VMware environment CLI Example: .. code-block:: bash salt-cloud -f list_folders my-vmware-config ''' if call != 'function': raise SaltCloudSystemExit( 'The list_folders function must be cal...
[ "def", "list_folders", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_folders function must be called with '", "'-f or --function.'", ")", "return", "{", "'Folder...
List all the folders for this VMware environment CLI Example: .. code-block:: bash salt-cloud -f list_folders my-vmware-config
[ "List", "all", "the", "folders", "for", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L2121-L2137
train
saltstack/salt
salt/cloud/clouds/vmware.py
list_snapshots
def list_snapshots(kwargs=None, call=None): ''' List snapshots either for all VMs and templates or for a specific VM/template in this VMware environment To list snapshots for all VMs and templates: CLI Example: .. code-block:: bash salt-cloud -f list_snapshots my-vmware-config T...
python
def list_snapshots(kwargs=None, call=None): ''' List snapshots either for all VMs and templates or for a specific VM/template in this VMware environment To list snapshots for all VMs and templates: CLI Example: .. code-block:: bash salt-cloud -f list_snapshots my-vmware-config T...
[ "def", "list_snapshots", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_snapshots function must be called with '", "'-f or --function.'", ")", "ret", "=", "{", ...
List snapshots either for all VMs and templates or for a specific VM/template in this VMware environment To list snapshots for all VMs and templates: CLI Example: .. code-block:: bash salt-cloud -f list_snapshots my-vmware-config To list snapshots for a specific VM/template: CLI Ex...
[ "List", "snapshots", "either", "for", "all", "VMs", "and", "templates", "or", "for", "a", "specific", "VM", "/", "template", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L2140-L2186
train
saltstack/salt
salt/cloud/clouds/vmware.py
suspend
def suspend(name, call=None): ''' To suspend a VM using its name CLI Example: .. code-block:: bash salt-cloud -a suspend vmname ''' if call != 'action': raise SaltCloudSystemExit( 'The suspend action must be called with ' '-a or --action.' ) ...
python
def suspend(name, call=None): ''' To suspend a VM using its name CLI Example: .. code-block:: bash salt-cloud -a suspend vmname ''' if call != 'action': raise SaltCloudSystemExit( 'The suspend action must be called with ' '-a or --action.' ) ...
[ "def", "suspend", "(", "name", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The suspend action must be called with '", "'-a or --action.'", ")", "vm_properties", "=", "[", "\"name\"", ",", "\"summa...
To suspend a VM using its name CLI Example: .. code-block:: bash salt-cloud -a suspend vmname
[ "To", "suspend", "a", "VM", "using", "its", "name" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L2291-L2337
train
saltstack/salt
salt/cloud/clouds/vmware.py
reset
def reset(name, soft=False, call=None): ''' To reset a VM using its name .. note:: If ``soft=True`` then issues a command to the guest operating system asking it to perform a reboot. Otherwise hypervisor will terminate VM and start it again. Default is soft=False For ``sof...
python
def reset(name, soft=False, call=None): ''' To reset a VM using its name .. note:: If ``soft=True`` then issues a command to the guest operating system asking it to perform a reboot. Otherwise hypervisor will terminate VM and start it again. Default is soft=False For ``sof...
[ "def", "reset", "(", "name", ",", "soft", "=", "False", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The reset action must be called with '", "'-a or --action.'", ")", "vm_properties", "=", "[", ...
To reset a VM using its name .. note:: If ``soft=True`` then issues a command to the guest operating system asking it to perform a reboot. Otherwise hypervisor will terminate VM and start it again. Default is soft=False For ``soft=True`` vmtools should be installed on guest system...
[ "To", "reset", "a", "VM", "using", "its", "name" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L2340-L2394
train
saltstack/salt
salt/cloud/clouds/vmware.py
terminate
def terminate(name, call=None): ''' To do an immediate power off of a VM using its name. A ``SIGKILL`` is issued to the vmx process of the VM CLI Example: .. code-block:: bash salt-cloud -a terminate vmname ''' if call != 'action': raise SaltCloudSystemExit( 'T...
python
def terminate(name, call=None): ''' To do an immediate power off of a VM using its name. A ``SIGKILL`` is issued to the vmx process of the VM CLI Example: .. code-block:: bash salt-cloud -a terminate vmname ''' if call != 'action': raise SaltCloudSystemExit( 'T...
[ "def", "terminate", "(", "name", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The terminate action must be called with '", "'-a or --action.'", ")", "vm_properties", "=", "[", "\"name\"", ",", "\"s...
To do an immediate power off of a VM using its name. A ``SIGKILL`` is issued to the vmx process of the VM CLI Example: .. code-block:: bash salt-cloud -a terminate vmname
[ "To", "do", "an", "immediate", "power", "off", "of", "a", "VM", "using", "its", "name", ".", "A", "SIGKILL", "is", "issued", "to", "the", "vmx", "process", "of", "the", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L2397-L2439
train
saltstack/salt
salt/cloud/clouds/vmware.py
destroy
def destroy(name, call=None): ''' To destroy a VM from the VMware environment CLI Example: .. code-block:: bash salt-cloud -d vmname salt-cloud --destroy vmname salt-cloud -a destroy vmname ''' if call == 'function': raise SaltCloudSystemExit( 'The ...
python
def destroy(name, call=None): ''' To destroy a VM from the VMware environment CLI Example: .. code-block:: bash salt-cloud -d vmname salt-cloud --destroy vmname salt-cloud -a destroy vmname ''' if call == 'function': raise SaltCloudSystemExit( 'The ...
[ "def", "destroy", "(", "name", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The destroy action must be called with -d, --destroy, '", "'-a or --action.'", ")", "__utils__", "[", "'cloud.fire_event'", ...
To destroy a VM from the VMware environment CLI Example: .. code-block:: bash salt-cloud -d vmname salt-cloud --destroy vmname salt-cloud -a destroy vmname
[ "To", "destroy", "a", "VM", "from", "the", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L2442-L2516
train
saltstack/salt
salt/cloud/clouds/vmware.py
create
def create(vm_): ''' To create a single VM in the VMware environment. Sample profile and arguments that can be specified in it can be found :ref:`here. <vmware-cloud-profile>` CLI Example: .. code-block:: bash salt-cloud -p vmware-centos6.5 vmname ''' try: # Check for...
python
def create(vm_): ''' To create a single VM in the VMware environment. Sample profile and arguments that can be specified in it can be found :ref:`here. <vmware-cloud-profile>` CLI Example: .. code-block:: bash salt-cloud -p vmware-centos6.5 vmname ''' try: # Check for...
[ "def", "create", "(", "vm_", ")", ":", "try", ":", "# Check for required profile parameters before sending any API calls.", "if", "(", "vm_", "[", "'profile'", "]", "and", "config", ".", "is_profile_configured", "(", "__opts__", ",", "__active_provider_name__", "or", ...
To create a single VM in the VMware environment. Sample profile and arguments that can be specified in it can be found :ref:`here. <vmware-cloud-profile>` CLI Example: .. code-block:: bash salt-cloud -p vmware-centos6.5 vmname
[ "To", "create", "a", "single", "VM", "in", "the", "VMware", "environment", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L2519-L3080
train
saltstack/salt
salt/cloud/clouds/vmware.py
handle_snapshot
def handle_snapshot(config_spec, object_ref, reloc_spec, template, vm_): ''' Returns a clone spec for cloning from shapshots :rtype vim.vm.CloneSpec ''' if 'snapshot' not in vm_: return None allowed_types = [ FLATTEN_DISK_FULL_CLONE, COPY_ALL_DISKS_FULL_CLONE, CU...
python
def handle_snapshot(config_spec, object_ref, reloc_spec, template, vm_): ''' Returns a clone spec for cloning from shapshots :rtype vim.vm.CloneSpec ''' if 'snapshot' not in vm_: return None allowed_types = [ FLATTEN_DISK_FULL_CLONE, COPY_ALL_DISKS_FULL_CLONE, CU...
[ "def", "handle_snapshot", "(", "config_spec", ",", "object_ref", ",", "reloc_spec", ",", "template", ",", "vm_", ")", ":", "if", "'snapshot'", "not", "in", "vm_", ":", "return", "None", "allowed_types", "=", "[", "FLATTEN_DISK_FULL_CLONE", ",", "COPY_ALL_DISKS_F...
Returns a clone spec for cloning from shapshots :rtype vim.vm.CloneSpec
[ "Returns", "a", "clone", "spec", "for", "cloning", "from", "shapshots", ":", "rtype", "vim", ".", "vm", ".", "CloneSpec" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3083-L3108
train
saltstack/salt
salt/cloud/clouds/vmware.py
get_clonespec_for_valid_snapshot
def get_clonespec_for_valid_snapshot(config_spec, object_ref, reloc_spec, template, vm_): ''' return clonespec only if values are valid ''' moving = True if QUICK_LINKED_CLONE == vm_['snapshot']['disk_move_type']: reloc_spec.diskMoveType = QUICK_LINKED_CLONE elif CURRENT_STATE_LINKED_CLO...
python
def get_clonespec_for_valid_snapshot(config_spec, object_ref, reloc_spec, template, vm_): ''' return clonespec only if values are valid ''' moving = True if QUICK_LINKED_CLONE == vm_['snapshot']['disk_move_type']: reloc_spec.diskMoveType = QUICK_LINKED_CLONE elif CURRENT_STATE_LINKED_CLO...
[ "def", "get_clonespec_for_valid_snapshot", "(", "config_spec", ",", "object_ref", ",", "reloc_spec", ",", "template", ",", "vm_", ")", ":", "moving", "=", "True", "if", "QUICK_LINKED_CLONE", "==", "vm_", "[", "'snapshot'", "]", "[", "'disk_move_type'", "]", ":",...
return clonespec only if values are valid
[ "return", "clonespec", "only", "if", "values", "are", "valid" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3111-L3130
train
saltstack/salt
salt/cloud/clouds/vmware.py
build_clonespec
def build_clonespec(config_spec, object_ref, reloc_spec, template): ''' Returns the clone spec ''' if reloc_spec.diskMoveType == QUICK_LINKED_CLONE: return vim.vm.CloneSpec( template=template, location=reloc_spec, config=config_spec, snapshot=objec...
python
def build_clonespec(config_spec, object_ref, reloc_spec, template): ''' Returns the clone spec ''' if reloc_spec.diskMoveType == QUICK_LINKED_CLONE: return vim.vm.CloneSpec( template=template, location=reloc_spec, config=config_spec, snapshot=objec...
[ "def", "build_clonespec", "(", "config_spec", ",", "object_ref", ",", "reloc_spec", ",", "template", ")", ":", "if", "reloc_spec", ".", "diskMoveType", "==", "QUICK_LINKED_CLONE", ":", "return", "vim", ".", "vm", ".", "CloneSpec", "(", "template", "=", "templa...
Returns the clone spec
[ "Returns", "the", "clone", "spec" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3133-L3149
train
saltstack/salt
salt/cloud/clouds/vmware.py
create_datacenter
def create_datacenter(kwargs=None, call=None): ''' Create a new data center in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f create_datacenter my-vmware-config name="MyNewDatacenter" ''' if call != 'function': raise SaltCloudSystemExit( 'T...
python
def create_datacenter(kwargs=None, call=None): ''' Create a new data center in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f create_datacenter my-vmware-config name="MyNewDatacenter" ''' if call != 'function': raise SaltCloudSystemExit( 'T...
[ "def", "create_datacenter", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The create_datacenter function must be called with '", "'-f or --function.'", ")", "datacenter_name"...
Create a new data center in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f create_datacenter my-vmware-config name="MyNewDatacenter"
[ "Create", "a", "new", "data", "center", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3152-L3206
train
saltstack/salt
salt/cloud/clouds/vmware.py
create_cluster
def create_cluster(kwargs=None, call=None): ''' Create a new cluster under the specified datacenter in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f create_cluster my-vmware-config name="myNewCluster" datacenter="datacenterName" ''' if call != 'function': ...
python
def create_cluster(kwargs=None, call=None): ''' Create a new cluster under the specified datacenter in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f create_cluster my-vmware-config name="myNewCluster" datacenter="datacenterName" ''' if call != 'function': ...
[ "def", "create_cluster", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The create_cluster function must be called with '", "'-f or --function.'", ")", "cluster_name", "=", ...
Create a new cluster under the specified datacenter in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f create_cluster my-vmware-config name="myNewCluster" datacenter="datacenterName"
[ "Create", "a", "new", "cluster", "under", "the", "specified", "datacenter", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3209-L3275
train
saltstack/salt
salt/cloud/clouds/vmware.py
rescan_hba
def rescan_hba(kwargs=None, call=None): ''' To rescan a specified HBA or all the HBAs on the Host System CLI Example: .. code-block:: bash salt-cloud -f rescan_hba my-vmware-config host="hostSystemName" salt-cloud -f rescan_hba my-vmware-config hba="hbaDeviceName" host="hostSystemName...
python
def rescan_hba(kwargs=None, call=None): ''' To rescan a specified HBA or all the HBAs on the Host System CLI Example: .. code-block:: bash salt-cloud -f rescan_hba my-vmware-config host="hostSystemName" salt-cloud -f rescan_hba my-vmware-config hba="hbaDeviceName" host="hostSystemName...
[ "def", "rescan_hba", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The rescan_hba function must be called with '", "'-f or --function.'", ")", "hba", "=", "kwargs", "."...
To rescan a specified HBA or all the HBAs on the Host System CLI Example: .. code-block:: bash salt-cloud -f rescan_hba my-vmware-config host="hostSystemName" salt-cloud -f rescan_hba my-vmware-config hba="hbaDeviceName" host="hostSystemName"
[ "To", "rescan", "a", "specified", "HBA", "or", "all", "the", "HBAs", "on", "the", "Host", "System" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3278-L3323
train
saltstack/salt
salt/cloud/clouds/vmware.py
upgrade_tools_all
def upgrade_tools_all(call=None): ''' To upgrade VMware Tools on all virtual machines present in the specified provider .. note:: If the virtual machine is running Windows OS, this function will attempt to suppress the automatic reboot caused by a VMware Tools upgrade. CLI...
python
def upgrade_tools_all(call=None): ''' To upgrade VMware Tools on all virtual machines present in the specified provider .. note:: If the virtual machine is running Windows OS, this function will attempt to suppress the automatic reboot caused by a VMware Tools upgrade. CLI...
[ "def", "upgrade_tools_all", "(", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The upgrade_tools_all function must be called with '", "'-f or --function.'", ")", "ret", "=", "{", "}", "vm_properties", "=",...
To upgrade VMware Tools on all virtual machines present in the specified provider .. note:: If the virtual machine is running Windows OS, this function will attempt to suppress the automatic reboot caused by a VMware Tools upgrade. CLI Example: .. code-block:: bash s...
[ "To", "upgrade", "VMware", "Tools", "on", "all", "virtual", "machines", "present", "in", "the", "specified", "provider" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3326-L3357
train
saltstack/salt
salt/cloud/clouds/vmware.py
upgrade_tools
def upgrade_tools(name, reboot=False, call=None): ''' To upgrade VMware Tools on a specified virtual machine. .. note:: If the virtual machine is running Windows OS, use ``reboot=True`` to reboot the virtual machine after VMware tools upgrade. Default is ``reboot=False`` CLI E...
python
def upgrade_tools(name, reboot=False, call=None): ''' To upgrade VMware Tools on a specified virtual machine. .. note:: If the virtual machine is running Windows OS, use ``reboot=True`` to reboot the virtual machine after VMware tools upgrade. Default is ``reboot=False`` CLI E...
[ "def", "upgrade_tools", "(", "name", ",", "reboot", "=", "False", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The upgrade_tools action must be called with '", "'-a or --action.'", ")", "vm_ref", "...
To upgrade VMware Tools on a specified virtual machine. .. note:: If the virtual machine is running Windows OS, use ``reboot=True`` to reboot the virtual machine after VMware tools upgrade. Default is ``reboot=False`` CLI Example: .. code-block:: bash salt-cloud -a upgra...
[ "To", "upgrade", "VMware", "Tools", "on", "a", "specified", "virtual", "machine", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3360-L3385
train
saltstack/salt
salt/cloud/clouds/vmware.py
list_hosts_by_cluster
def list_hosts_by_cluster(kwargs=None, call=None): ''' List hosts for each cluster; or hosts for a specified cluster in this VMware environment To list hosts for each cluster: CLI Example: .. code-block:: bash salt-cloud -f list_hosts_by_cluster my-vmware-config To list hosts fo...
python
def list_hosts_by_cluster(kwargs=None, call=None): ''' List hosts for each cluster; or hosts for a specified cluster in this VMware environment To list hosts for each cluster: CLI Example: .. code-block:: bash salt-cloud -f list_hosts_by_cluster my-vmware-config To list hosts fo...
[ "def", "list_hosts_by_cluster", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_hosts_by_cluster function must be called with '", "'-f or --function.'", ")", "ret", ...
List hosts for each cluster; or hosts for a specified cluster in this VMware environment To list hosts for each cluster: CLI Example: .. code-block:: bash salt-cloud -f list_hosts_by_cluster my-vmware-config To list hosts for a specified cluster: CLI Example: .. code-block:: b...
[ "List", "hosts", "for", "each", "cluster", ";", "or", "hosts", "for", "a", "specified", "cluster", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3388-L3431
train
saltstack/salt
salt/cloud/clouds/vmware.py
list_clusters_by_datacenter
def list_clusters_by_datacenter(kwargs=None, call=None): ''' List clusters for each datacenter; or clusters for a specified datacenter in this VMware environment To list clusters for each datacenter: CLI Example: .. code-block:: bash salt-cloud -f list_clusters_by_datacenter my-vmwar...
python
def list_clusters_by_datacenter(kwargs=None, call=None): ''' List clusters for each datacenter; or clusters for a specified datacenter in this VMware environment To list clusters for each datacenter: CLI Example: .. code-block:: bash salt-cloud -f list_clusters_by_datacenter my-vmwar...
[ "def", "list_clusters_by_datacenter", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_clusters_by_datacenter function must be called with '", "'-f or --function.'", ")",...
List clusters for each datacenter; or clusters for a specified datacenter in this VMware environment To list clusters for each datacenter: CLI Example: .. code-block:: bash salt-cloud -f list_clusters_by_datacenter my-vmware-config To list clusters for a specified datacenter: CLI E...
[ "List", "clusters", "for", "each", "datacenter", ";", "or", "clusters", "for", "a", "specified", "datacenter", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3434-L3475
train
saltstack/salt
salt/cloud/clouds/vmware.py
list_hbas
def list_hbas(kwargs=None, call=None): ''' List all HBAs for each host system; or all HBAs for a specified host system; or HBAs of specified type for each host system; or HBAs of specified type for a specified host system in this VMware environment .. note:: You can specify type as either ...
python
def list_hbas(kwargs=None, call=None): ''' List all HBAs for each host system; or all HBAs for a specified host system; or HBAs of specified type for each host system; or HBAs of specified type for a specified host system in this VMware environment .. note:: You can specify type as either ...
[ "def", "list_hbas", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_hbas function must be called with '", "'-f or --function.'", ")", "ret", "=", "{", "}", "hb...
List all HBAs for each host system; or all HBAs for a specified host system; or HBAs of specified type for each host system; or HBAs of specified type for a specified host system in this VMware environment .. note:: You can specify type as either ``parallel``, ``iscsi``, ``block`` or ``fib...
[ "List", "all", "HBAs", "for", "each", "host", "system", ";", "or", "all", "HBAs", "for", "a", "specified", "host", "system", ";", "or", "HBAs", "of", "specified", "type", "for", "each", "host", "system", ";", "or", "HBAs", "of", "specified", "type", "f...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3524-L3610
train
saltstack/salt
salt/cloud/clouds/vmware.py
list_dvs
def list_dvs(kwargs=None, call=None): ''' List all the distributed virtual switches for this VMware environment CLI Example: .. code-block:: bash salt-cloud -f list_dvs my-vmware-config ''' if call != 'function': raise SaltCloudSystemExit( 'The list_dvs function mu...
python
def list_dvs(kwargs=None, call=None): ''' List all the distributed virtual switches for this VMware environment CLI Example: .. code-block:: bash salt-cloud -f list_dvs my-vmware-config ''' if call != 'function': raise SaltCloudSystemExit( 'The list_dvs function mu...
[ "def", "list_dvs", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_dvs function must be called with '", "'-f or --function.'", ")", "return", "{", "'Distributed Vi...
List all the distributed virtual switches for this VMware environment CLI Example: .. code-block:: bash salt-cloud -f list_dvs my-vmware-config
[ "List", "all", "the", "distributed", "virtual", "switches", "for", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3613-L3629
train
saltstack/salt
salt/cloud/clouds/vmware.py
list_vapps
def list_vapps(kwargs=None, call=None): ''' List all the vApps for this VMware environment CLI Example: .. code-block:: bash salt-cloud -f list_vapps my-vmware-config ''' if call != 'function': raise SaltCloudSystemExit( 'The list_vapps function must be called with...
python
def list_vapps(kwargs=None, call=None): ''' List all the vApps for this VMware environment CLI Example: .. code-block:: bash salt-cloud -f list_vapps my-vmware-config ''' if call != 'function': raise SaltCloudSystemExit( 'The list_vapps function must be called with...
[ "def", "list_vapps", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_vapps function must be called with '", "'-f or --function.'", ")", "return", "{", "'vApps'", ...
List all the vApps for this VMware environment CLI Example: .. code-block:: bash salt-cloud -f list_vapps my-vmware-config
[ "List", "all", "the", "vApps", "for", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3632-L3648
train
saltstack/salt
salt/cloud/clouds/vmware.py
enter_maintenance_mode
def enter_maintenance_mode(kwargs=None, call=None): ''' To put the specified host system in maintenance mode in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f enter_maintenance_mode my-vmware-config host="myHostSystemName" ''' if call != 'function': ra...
python
def enter_maintenance_mode(kwargs=None, call=None): ''' To put the specified host system in maintenance mode in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f enter_maintenance_mode my-vmware-config host="myHostSystemName" ''' if call != 'function': ra...
[ "def", "enter_maintenance_mode", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The enter_maintenance_mode function must be called with '", "'-f or --function.'", ")", "host_n...
To put the specified host system in maintenance mode in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f enter_maintenance_mode my-vmware-config host="myHostSystemName"
[ "To", "put", "the", "specified", "host", "system", "in", "maintenance", "mode", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3651-L3691
train
saltstack/salt
salt/cloud/clouds/vmware.py
create_folder
def create_folder(kwargs=None, call=None): ''' Create the specified folder path in this VMware environment .. note:: To create a Host and Cluster Folder under a Datacenter, specify ``path="/yourDatacenterName/host/yourFolderName"`` To create a Network Folder under a Datacenter, sp...
python
def create_folder(kwargs=None, call=None): ''' Create the specified folder path in this VMware environment .. note:: To create a Host and Cluster Folder under a Datacenter, specify ``path="/yourDatacenterName/host/yourFolderName"`` To create a Network Folder under a Datacenter, sp...
[ "def", "create_folder", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The create_folder function must be called with '", "'-f or --function.'", ")", "# Get the service instan...
Create the specified folder path in this VMware environment .. note:: To create a Host and Cluster Folder under a Datacenter, specify ``path="/yourDatacenterName/host/yourFolderName"`` To create a Network Folder under a Datacenter, specify ``path="/yourDatacenterName/network/yourF...
[ "Create", "the", "specified", "folder", "path", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3737-L3811
train
saltstack/salt
salt/cloud/clouds/vmware.py
create_snapshot
def create_snapshot(name, kwargs=None, call=None): ''' Create a snapshot of the specified virtual machine in this VMware environment .. note:: If the VM is powered on, the internal state of the VM (memory dump) is included in the snapshot by default which will also set the powe...
python
def create_snapshot(name, kwargs=None, call=None): ''' Create a snapshot of the specified virtual machine in this VMware environment .. note:: If the VM is powered on, the internal state of the VM (memory dump) is included in the snapshot by default which will also set the powe...
[ "def", "create_snapshot", "(", "name", ",", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The create_snapshot action must be called with '", "'-a or --action.'", ")", "if", "k...
Create a snapshot of the specified virtual machine in this VMware environment .. note:: If the VM is powered on, the internal state of the VM (memory dump) is included in the snapshot by default which will also set the power state of the snapshot to "powered on". You can set ``...
[ "Create", "a", "snapshot", "of", "the", "specified", "virtual", "machine", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3814-L3889
train
saltstack/salt
salt/cloud/clouds/vmware.py
revert_to_snapshot
def revert_to_snapshot(name, kwargs=None, call=None): ''' Revert virtual machine to it's current snapshot. If no snapshot exists, the state of the virtual machine remains unchanged .. note:: The virtual machine will be powered on if the power state of the snapshot when it was created w...
python
def revert_to_snapshot(name, kwargs=None, call=None): ''' Revert virtual machine to it's current snapshot. If no snapshot exists, the state of the virtual machine remains unchanged .. note:: The virtual machine will be powered on if the power state of the snapshot when it was created w...
[ "def", "revert_to_snapshot", "(", "name", ",", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The revert_to_snapshot action must be called with '", "'-a or --action.'", ")", "if"...
Revert virtual machine to it's current snapshot. If no snapshot exists, the state of the virtual machine remains unchanged .. note:: The virtual machine will be powered on if the power state of the snapshot when it was created was set to "Powered On". Set ``power_off=True`` so that the...
[ "Revert", "virtual", "machine", "to", "it", "s", "current", "snapshot", ".", "If", "no", "snapshot", "exists", "the", "state", "of", "the", "virtual", "machine", "remains", "unchanged" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3892-L3960
train
saltstack/salt
salt/cloud/clouds/vmware.py
remove_snapshot
def remove_snapshot(name, kwargs=None, call=None): ''' Remove a snapshot of the specified virtual machine in this VMware environment CLI Example: .. code-block:: bash salt-cloud -a remove_snapshot vmname snapshot_name="mySnapshot" salt-cloud -a remove_snapshot vmname snapshot_name="my...
python
def remove_snapshot(name, kwargs=None, call=None): ''' Remove a snapshot of the specified virtual machine in this VMware environment CLI Example: .. code-block:: bash salt-cloud -a remove_snapshot vmname snapshot_name="mySnapshot" salt-cloud -a remove_snapshot vmname snapshot_name="my...
[ "def", "remove_snapshot", "(", "name", ",", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The create_snapshot action must be called with '", "'-a or --action.'", ")", "if", "k...
Remove a snapshot of the specified virtual machine in this VMware environment CLI Example: .. code-block:: bash salt-cloud -a remove_snapshot vmname snapshot_name="mySnapshot" salt-cloud -a remove_snapshot vmname snapshot_name="mySnapshot" [remove_children="True"]
[ "Remove", "a", "snapshot", "of", "the", "specified", "virtual", "machine", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3963-L4018
train
saltstack/salt
salt/cloud/clouds/vmware.py
remove_all_snapshots
def remove_all_snapshots(name, kwargs=None, call=None): ''' Remove all the snapshots present for the specified virtual machine. .. note:: All the snapshots higher up in the hierarchy of the current snapshot tree are consolidated and their virtual disks are merged. To override this ...
python
def remove_all_snapshots(name, kwargs=None, call=None): ''' Remove all the snapshots present for the specified virtual machine. .. note:: All the snapshots higher up in the hierarchy of the current snapshot tree are consolidated and their virtual disks are merged. To override this ...
[ "def", "remove_all_snapshots", "(", "name", ",", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The remove_all_snapshots action must be called with '", "'-a or --action.'", ")", ...
Remove all the snapshots present for the specified virtual machine. .. note:: All the snapshots higher up in the hierarchy of the current snapshot tree are consolidated and their virtual disks are merged. To override this behavior and only remove all snapshots, set ``merge_snapshots=False`...
[ "Remove", "all", "the", "snapshots", "present", "for", "the", "specified", "virtual", "machine", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4021-L4060
train
saltstack/salt
salt/cloud/clouds/vmware.py
convert_to_template
def convert_to_template(name, kwargs=None, call=None): ''' Convert the specified virtual machine to template. CLI Example: .. code-block:: bash salt-cloud -a convert_to_template vmname ''' if call != 'action': raise SaltCloudSystemExit( 'The convert_to_template act...
python
def convert_to_template(name, kwargs=None, call=None): ''' Convert the specified virtual machine to template. CLI Example: .. code-block:: bash salt-cloud -a convert_to_template vmname ''' if call != 'action': raise SaltCloudSystemExit( 'The convert_to_template act...
[ "def", "convert_to_template", "(", "name", ",", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The convert_to_template action must be called with '", "'-a or --action.'", ")", "v...
Convert the specified virtual machine to template. CLI Example: .. code-block:: bash salt-cloud -a convert_to_template vmname
[ "Convert", "the", "specified", "virtual", "machine", "to", "template", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4063-L4099
train
saltstack/salt
salt/cloud/clouds/vmware.py
add_host
def add_host(kwargs=None, call=None): ''' Add a host system to the specified cluster or datacenter in this VMware environment .. note:: To use this function, you need to specify ``esxi_host_user`` and ``esxi_host_password`` under your provider configuration set up at ``/etc/salt/cl...
python
def add_host(kwargs=None, call=None): ''' Add a host system to the specified cluster or datacenter in this VMware environment .. note:: To use this function, you need to specify ``esxi_host_user`` and ``esxi_host_password`` under your provider configuration set up at ``/etc/salt/cl...
[ "def", "add_host", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The add_host function must be called with '", "'-f or --function.'", ")", "host_name", "=", "kwargs", "...
Add a host system to the specified cluster or datacenter in this VMware environment .. note:: To use this function, you need to specify ``esxi_host_user`` and ``esxi_host_password`` under your provider configuration set up at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/v...
[ "Add", "a", "host", "system", "to", "the", "specified", "cluster", "or", "datacenter", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4102-L4265
train
saltstack/salt
salt/cloud/clouds/vmware.py
remove_host
def remove_host(kwargs=None, call=None): ''' Remove the specified host system from this VMware environment CLI Example: .. code-block:: bash salt-cloud -f remove_host my-vmware-config host="myHostSystemName" ''' if call != 'function': raise SaltCloudSystemExit( 'Th...
python
def remove_host(kwargs=None, call=None): ''' Remove the specified host system from this VMware environment CLI Example: .. code-block:: bash salt-cloud -f remove_host my-vmware-config host="myHostSystemName" ''' if call != 'function': raise SaltCloudSystemExit( 'Th...
[ "def", "remove_host", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The remove_host function must be called with '", "'-f or --function.'", ")", "host_name", "=", "kwargs...
Remove the specified host system from this VMware environment CLI Example: .. code-block:: bash salt-cloud -f remove_host my-vmware-config host="myHostSystemName"
[ "Remove", "the", "specified", "host", "system", "from", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4268-L4317
train
saltstack/salt
salt/cloud/clouds/vmware.py
connect_host
def connect_host(kwargs=None, call=None): ''' Connect the specified host system in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f connect_host my-vmware-config host="myHostSystemName" ''' if call != 'function': raise SaltCloudSystemExit( 'T...
python
def connect_host(kwargs=None, call=None): ''' Connect the specified host system in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f connect_host my-vmware-config host="myHostSystemName" ''' if call != 'function': raise SaltCloudSystemExit( 'T...
[ "def", "connect_host", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The connect_host function must be called with '", "'-f or --function.'", ")", "host_name", "=", "kwar...
Connect the specified host system in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f connect_host my-vmware-config host="myHostSystemName"
[ "Connect", "the", "specified", "host", "system", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4320-L4367
train
saltstack/salt
salt/cloud/clouds/vmware.py
create_datastore_cluster
def create_datastore_cluster(kwargs=None, call=None): ''' Create a new datastore cluster for the specified datacenter in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f create_datastore_cluster my-vmware-config name="datastoreClusterName" datacenter="datacenterName" ...
python
def create_datastore_cluster(kwargs=None, call=None): ''' Create a new datastore cluster for the specified datacenter in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f create_datastore_cluster my-vmware-config name="datastoreClusterName" datacenter="datacenterName" ...
[ "def", "create_datastore_cluster", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The create_datastore_cluster function must be called with '", "'-f or --function.'", ")", "da...
Create a new datastore cluster for the specified datacenter in this VMware environment CLI Example: .. code-block:: bash salt-cloud -f create_datastore_cluster my-vmware-config name="datastoreClusterName" datacenter="datacenterName"
[ "Create", "a", "new", "datastore", "cluster", "for", "the", "specified", "datacenter", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4491-L4550
train
saltstack/salt
salt/cloud/clouds/vmware.py
shutdown_host
def shutdown_host(kwargs=None, call=None): ''' Shut down the specified host system in this VMware environment .. note:: If the host system is not in maintenance mode, it will not be shut down. If you want to shut down the host system regardless of whether it is in maintenance mode, ...
python
def shutdown_host(kwargs=None, call=None): ''' Shut down the specified host system in this VMware environment .. note:: If the host system is not in maintenance mode, it will not be shut down. If you want to shut down the host system regardless of whether it is in maintenance mode, ...
[ "def", "shutdown_host", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The shutdown_host function must be called with '", "'-f or --function.'", ")", "host_name", "=", "kw...
Shut down the specified host system in this VMware environment .. note:: If the host system is not in maintenance mode, it will not be shut down. If you want to shut down the host system regardless of whether it is in maintenance mode, set ``force=True``. Default is ``force=False``. C...
[ "Shut", "down", "the", "specified", "host", "system", "in", "this", "VMware", "environment" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4553-L4620
train
saltstack/salt
salt/states/zabbix_usermacro.py
present
def present(name, value, hostid=None, **kwargs): ''' Creates a new usermacro. :param name: name of the usermacro :param value: value of the usermacro :param hostid: id's of the hosts to apply the usermacro on, if missing a global usermacro is assumed. :param _connection_user: Optional - zabbix...
python
def present(name, value, hostid=None, **kwargs): ''' Creates a new usermacro. :param name: name of the usermacro :param value: value of the usermacro :param hostid: id's of the hosts to apply the usermacro on, if missing a global usermacro is assumed. :param _connection_user: Optional - zabbix...
[ "def", "present", "(", "name", ",", "value", ",", "hostid", "=", "None", ",", "*", "*", "kwargs", ")", ":", "connection_args", "=", "{", "}", "if", "'_connection_user'", "in", "kwargs", ":", "connection_args", "[", "'_connection_user'", "]", "=", "kwargs",...
Creates a new usermacro. :param name: name of the usermacro :param value: value of the usermacro :param hostid: id's of the hosts to apply the usermacro on, if missing a global usermacro is assumed. :param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstr...
[ "Creates", "a", "new", "usermacro", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_usermacro.py#L22-L152
train
saltstack/salt
salt/states/zabbix_usermacro.py
absent
def absent(name, hostid=None, **kwargs): ''' Ensures that the mediatype does not exist, eventually deletes the mediatype. :param name: name of the usermacro :param hostid: id's of the hosts to apply the usermacro on, if missing a global usermacro is assumed. :param _connection_user: Optional - zab...
python
def absent(name, hostid=None, **kwargs): ''' Ensures that the mediatype does not exist, eventually deletes the mediatype. :param name: name of the usermacro :param hostid: id's of the hosts to apply the usermacro on, if missing a global usermacro is assumed. :param _connection_user: Optional - zab...
[ "def", "absent", "(", "name", ",", "hostid", "=", "None", ",", "*", "*", "kwargs", ")", ":", "connection_args", "=", "{", "}", "if", "'_connection_user'", "in", "kwargs", ":", "connection_args", "[", "'_connection_user'", "]", "=", "kwargs", "[", "'_connec...
Ensures that the mediatype does not exist, eventually deletes the mediatype. :param name: name of the usermacro :param hostid: id's of the hosts to apply the usermacro on, if missing a global usermacro is assumed. :param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see modu...
[ "Ensures", "that", "the", "mediatype", "does", "not", "exist", "eventually", "deletes", "the", "mediatype", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_usermacro.py#L155-L237
train
saltstack/salt
salt/runners/survey.py
diff
def diff(*args, **kwargs): ''' Return the DIFFERENCE of the result sets returned by each matching minion pool .. versionadded:: 2014.7.0 These pools are determined from the aggregated and sorted results of a salt command. This command displays the "diffs" as a series of 2-way differences ...
python
def diff(*args, **kwargs): ''' Return the DIFFERENCE of the result sets returned by each matching minion pool .. versionadded:: 2014.7.0 These pools are determined from the aggregated and sorted results of a salt command. This command displays the "diffs" as a series of 2-way differences ...
[ "def", "diff", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# TODO: The salt execution module \"cp.get_file_str file:///...\" is a", "# non-obvious way to display the differences between files using", "# survey.diff . A more obvious method needs to be found or developed.", "imp...
Return the DIFFERENCE of the result sets returned by each matching minion pool .. versionadded:: 2014.7.0 These pools are determined from the aggregated and sorted results of a salt command. This command displays the "diffs" as a series of 2-way differences -- namely the difference between th...
[ "Return", "the", "DIFFERENCE", "of", "the", "result", "sets", "returned", "by", "each", "matching", "minion", "pool" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/survey.py#L58-L132
train
saltstack/salt
salt/runners/survey.py
_get_pool_results
def _get_pool_results(*args, **kwargs): ''' A helper function which returns a dictionary of minion pools along with their matching result sets. Useful for developing other "survey style" functions. Optionally accepts a "survey_sort=up" or "survey_sort=down" kwargs for specifying sort order. ...
python
def _get_pool_results(*args, **kwargs): ''' A helper function which returns a dictionary of minion pools along with their matching result sets. Useful for developing other "survey style" functions. Optionally accepts a "survey_sort=up" or "survey_sort=down" kwargs for specifying sort order. ...
[ "def", "_get_pool_results", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# TODO: the option \"survey.sort=\" would be preferred for namespace", "# separation but the kwargs parser for the salt-run command seems to", "# improperly pass the options containing a \".\" in them for lat...
A helper function which returns a dictionary of minion pools along with their matching result sets. Useful for developing other "survey style" functions. Optionally accepts a "survey_sort=up" or "survey_sort=down" kwargs for specifying sort order. Because the kwargs namespace of the "salt" and "surv...
[ "A", "helper", "function", "which", "returns", "a", "dictionary", "of", "minion", "pools", "along", "with", "their", "matching", "result", "sets", ".", "Useful", "for", "developing", "other", "survey", "style", "functions", ".", "Optionally", "accepts", "a", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/survey.py#L135-L188
train
saltstack/salt
salt/states/artifactory.py
downloaded
def downloaded(name, artifact, target_dir='/tmp', target_file=None, use_literal_group_id=False): ''' Ensures that the artifact from artifactory exists at given location. If it doesn't exist, then it will be downloaded. If it already exists then the checksum of existing file is checked against checksum i...
python
def downloaded(name, artifact, target_dir='/tmp', target_file=None, use_literal_group_id=False): ''' Ensures that the artifact from artifactory exists at given location. If it doesn't exist, then it will be downloaded. If it already exists then the checksum of existing file is checked against checksum i...
[ "def", "downloaded", "(", "name", ",", "artifact", ",", "target_dir", "=", "'/tmp'", ",", "target_file", "=", "None", ",", "use_literal_group_id", "=", "False", ")", ":", "log", ".", "debug", "(", "\" ======================== STATE: artifactory.downloaded (name: %s) \...
Ensures that the artifact from artifactory exists at given location. If it doesn't exist, then it will be downloaded. If it already exists then the checksum of existing file is checked against checksum in artifactory. If it is different then the step will fail. artifact Details of the artifact to b...
[ "Ensures", "that", "the", "artifact", "from", "artifactory", "exists", "at", "given", "location", ".", "If", "it", "doesn", "t", "exist", "then", "it", "will", "be", "downloaded", ".", "If", "it", "already", "exists", "then", "the", "checksum", "of", "exis...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/artifactory.py#L15-L107
train
saltstack/salt
salt/states/saltutil.py
sync_all
def sync_all(name, **kwargs): ''' Performs the same task as saltutil.sync_all module See :mod:`saltutil module for full list of options <salt.modules.saltutil>` .. code-block:: yaml sync_everything: saltutil.sync_all: - refresh: True ''' ret = {'name': name, 'chan...
python
def sync_all(name, **kwargs): ''' Performs the same task as saltutil.sync_all module See :mod:`saltutil module for full list of options <salt.modules.saltutil>` .. code-block:: yaml sync_everything: saltutil.sync_all: - refresh: True ''' ret = {'name': name, 'chan...
[ "def", "sync_all", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "if", "__opts__", "[", "'test'", "]", ":",...
Performs the same task as saltutil.sync_all module See :mod:`saltutil module for full list of options <salt.modules.saltutil>` .. code-block:: yaml sync_everything: saltutil.sync_all: - refresh: True
[ "Performs", "the", "same", "task", "as", "saltutil", ".", "sync_all", "module", "See", ":", "mod", ":", "saltutil", "module", "for", "full", "list", "of", "options", "<salt", ".", "modules", ".", "saltutil", ">" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltutil.py#L54-L87
train
saltstack/salt
salt/modules/random_org.py
_query
def _query(api_version=None, data=None): ''' Slack object method function to construct and execute on the API URL. :param api_key: The Random.org api key. :param api_version: The version of Random.org api. :param data: The data to be sent for POST method. :return: The json...
python
def _query(api_version=None, data=None): ''' Slack object method function to construct and execute on the API URL. :param api_key: The Random.org api key. :param api_version: The version of Random.org api. :param data: The data to be sent for POST method. :return: The json...
[ "def", "_query", "(", "api_version", "=", "None", ",", "data", "=", "None", ")", ":", "if", "data", "is", "None", ":", "data", "=", "{", "}", "ret", "=", "{", "'res'", ":", "True", "}", "api_url", "=", "'https://api.random.org/'", "base_url", "=", "_...
Slack object method function to construct and execute on the API URL. :param api_key: The Random.org api key. :param api_version: The version of Random.org api. :param data: The data to be sent for POST method. :return: The json response from the API call or False.
[ "Slack", "object", "method", "function", "to", "construct", "and", "execute", "on", "the", "API", "URL", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/random_org.py#L81-L123
train
saltstack/salt
salt/modules/random_org.py
getUsage
def getUsage(api_key=None, api_version=None): ''' Show current usages statistics :param api_key: The Random.org api key. :param api_version: The Random.org api version. :return: The current usage statistics. CLI Example: .. code-block:: bash salt '*' random_org.getUsage ...
python
def getUsage(api_key=None, api_version=None): ''' Show current usages statistics :param api_key: The Random.org api key. :param api_version: The Random.org api version. :return: The current usage statistics. CLI Example: .. code-block:: bash salt '*' random_org.getUsage ...
[ "def", "getUsage", "(", "api_key", "=", "None", ",", "api_version", "=", "None", ")", ":", "ret", "=", "{", "'res'", ":", "True", "}", "if", "not", "api_key", "or", "not", "api_version", ":", "try", ":", "options", "=", "__salt__", "[", "'config.option...
Show current usages statistics :param api_key: The Random.org api key. :param api_version: The Random.org api version. :return: The current usage statistics. CLI Example: .. code-block:: bash salt '*' random_org.getUsage salt '*' random_org.getUsage api_key=peWcBiMOS9HrZG15peWcB...
[ "Show", "current", "usages", "statistics" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/random_org.py#L126-L177
train
saltstack/salt
salt/modules/random_org.py
generateIntegers
def generateIntegers(api_key=None, api_version=None, **kwargs): ''' Generate random integers :param api_key: The Random.org api key. :param api_version: The Random.org api version. :param number: The number of integers to generate :param minimum: The lo...
python
def generateIntegers(api_key=None, api_version=None, **kwargs): ''' Generate random integers :param api_key: The Random.org api key. :param api_version: The Random.org api version. :param number: The number of integers to generate :param minimum: The lo...
[ "def", "generateIntegers", "(", "api_key", "=", "None", ",", "api_version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'res'", ":", "True", "}", "if", "not", "api_key", "or", "not", "api_version", ":", "try", ":", "options", "=...
Generate random integers :param api_key: The Random.org api key. :param api_version: The Random.org api version. :param number: The number of integers to generate :param minimum: The lower boundary for the range from which the random numbers will be picked. Must be within ...
[ "Generate", "random", "integers" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/random_org.py#L180-L294
train
saltstack/salt
salt/utils/oset.py
OrderedSet.add
def add(self, key): """ Add `key` as an item to this OrderedSet, then return its index. If `key` is already in the OrderedSet, return the index it already had. """ if key not in self.map: self.map[key] = len(self.items) self.items.append(key) ...
python
def add(self, key): """ Add `key` as an item to this OrderedSet, then return its index. If `key` is already in the OrderedSet, return the index it already had. """ if key not in self.map: self.map[key] = len(self.items) self.items.append(key) ...
[ "def", "add", "(", "self", ",", "key", ")", ":", "if", "key", "not", "in", "self", ".", "map", ":", "self", ".", "map", "[", "key", "]", "=", "len", "(", "self", ".", "items", ")", "self", ".", "items", ".", "append", "(", "key", ")", "return...
Add `key` as an item to this OrderedSet, then return its index. If `key` is already in the OrderedSet, return the index it already had.
[ "Add", "key", "as", "an", "item", "to", "this", "OrderedSet", "then", "return", "its", "index", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/oset.py#L110-L120
train
saltstack/salt
salt/utils/oset.py
OrderedSet.index
def index(self, key): """ Get the index of a given entry, raising an IndexError if it's not present. `key` can be an iterable of entries that is not a string, in which case this returns a list of indices. """ if is_iterable(key): return [self.index(su...
python
def index(self, key): """ Get the index of a given entry, raising an IndexError if it's not present. `key` can be an iterable of entries that is not a string, in which case this returns a list of indices. """ if is_iterable(key): return [self.index(su...
[ "def", "index", "(", "self", ",", "key", ")", ":", "if", "is_iterable", "(", "key", ")", ":", "return", "[", "self", ".", "index", "(", "subkey", ")", "for", "subkey", "in", "key", "]", "return", "self", ".", "map", "[", "key", "]" ]
Get the index of a given entry, raising an IndexError if it's not present. `key` can be an iterable of entries that is not a string, in which case this returns a list of indices.
[ "Get", "the", "index", "of", "a", "given", "entry", "raising", "an", "IndexError", "if", "it", "s", "not", "present", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/oset.py#L136-L146
train
saltstack/salt
salt/utils/oset.py
OrderedSet.discard
def discard(self, key): """ Remove an element. Do not raise an exception if absent. The MutableSet mixin uses this to implement the .remove() method, which *does* raise an error when asked to remove a non-existent item. """ if key in self: i = self.map[key] ...
python
def discard(self, key): """ Remove an element. Do not raise an exception if absent. The MutableSet mixin uses this to implement the .remove() method, which *does* raise an error when asked to remove a non-existent item. """ if key in self: i = self.map[key] ...
[ "def", "discard", "(", "self", ",", "key", ")", ":", "if", "key", "in", "self", ":", "i", "=", "self", ".", "map", "[", "key", "]", "del", "self", ".", "items", "[", "i", "]", "del", "self", ".", "map", "[", "key", "]", "for", "k", ",", "v"...
Remove an element. Do not raise an exception if absent. The MutableSet mixin uses this to implement the .remove() method, which *does* raise an error when asked to remove a non-existent item.
[ "Remove", "an", "element", ".", "Do", "not", "raise", "an", "exception", "if", "absent", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/oset.py#L162-L175
train
saltstack/salt
salt/runners/git_pillar.py
update
def update(branch=None, repo=None): ''' .. versionadded:: 2014.1.0 .. versionchanged:: 2015.8.4 This runner function now supports the :ref:`git_pillar configuration schema <git-pillar-configuration>` introduced in 2015.8.0. Additionally, the branch and repo can now be omitted to ...
python
def update(branch=None, repo=None): ''' .. versionadded:: 2014.1.0 .. versionchanged:: 2015.8.4 This runner function now supports the :ref:`git_pillar configuration schema <git-pillar-configuration>` introduced in 2015.8.0. Additionally, the branch and repo can now be omitted to ...
[ "def", "update", "(", "branch", "=", "None", ",", "repo", "=", "None", ")", ":", "ret", "=", "{", "}", "for", "ext_pillar", "in", "__opts__", ".", "get", "(", "'ext_pillar'", ",", "[", "]", ")", ":", "pillar_type", "=", "next", "(", "iter", "(", ...
.. versionadded:: 2014.1.0 .. versionchanged:: 2015.8.4 This runner function now supports the :ref:`git_pillar configuration schema <git-pillar-configuration>` introduced in 2015.8.0. Additionally, the branch and repo can now be omitted to update all git_pillar remotes. The return d...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/git_pillar.py#L18-L104
train
saltstack/salt
salt/states/aptpkg.py
held
def held(name): ''' Set package in 'hold' state, meaning it will not be upgraded. name The name of the package, e.g., 'tmux' ''' ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} state = __salt__['pkg.get_selections']( pattern=name, ) if not state: ...
python
def held(name): ''' Set package in 'hold' state, meaning it will not be upgraded. name The name of the package, e.g., 'tmux' ''' ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''} state = __salt__['pkg.get_selections']( pattern=name, ) if not state: ...
[ "def", "held", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", "}", "state", "=", "__salt__", "[", "'pkg.get_selections'", "]", "(", "pattern"...
Set package in 'hold' state, meaning it will not be upgraded. name The name of the package, e.g., 'tmux'
[ "Set", "package", "in", "hold", "state", "meaning", "it", "will", "not", "be", "upgraded", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/aptpkg.py#L30-L58
train
saltstack/salt
salt/modules/openbsdservice.py
_get_rc
def _get_rc(): ''' Returns a dict where the key is the daemon's name and the value a boolean indicating its status (True: enabled or False: disabled). Check the daemons started by the system in /etc/rc and configured in /etc/rc.conf and /etc/rc.conf.local. Also add to the dict all the localy ena...
python
def _get_rc(): ''' Returns a dict where the key is the daemon's name and the value a boolean indicating its status (True: enabled or False: disabled). Check the daemons started by the system in /etc/rc and configured in /etc/rc.conf and /etc/rc.conf.local. Also add to the dict all the localy ena...
[ "def", "_get_rc", "(", ")", ":", "daemons_flags", "=", "{", "}", "try", ":", "# now read the system startup script /etc/rc", "# to know what are the system enabled daemons", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "'/etc/rc'", ",", "'r'", ")",...
Returns a dict where the key is the daemon's name and the value a boolean indicating its status (True: enabled or False: disabled). Check the daemons started by the system in /etc/rc and configured in /etc/rc.conf and /etc/rc.conf.local. Also add to the dict all the localy enabled daemons via $pkg_scrip...
[ "Returns", "a", "dict", "where", "the", "key", "is", "the", "daemon", "s", "name", "and", "the", "value", "a", "boolean", "indicating", "its", "status", "(", "True", ":", "enabled", "or", "False", ":", "disabled", ")", ".", "Check", "the", "daemons", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdservice.py#L159-L211
train
saltstack/salt
salt/modules/openbsdservice.py
available
def available(name): ''' .. versionadded:: 2014.7.0 Returns ``True`` if the specified service is available, otherwise returns ``False``. CLI Example: .. code-block:: bash salt '*' service.available sshd ''' path = '/etc/rc.d/{0}'.format(name) return os.path.isfile(path) a...
python
def available(name): ''' .. versionadded:: 2014.7.0 Returns ``True`` if the specified service is available, otherwise returns ``False``. CLI Example: .. code-block:: bash salt '*' service.available sshd ''' path = '/etc/rc.d/{0}'.format(name) return os.path.isfile(path) a...
[ "def", "available", "(", "name", ")", ":", "path", "=", "'/etc/rc.d/{0}'", ".", "format", "(", "name", ")", "return", "os", ".", "path", ".", "isfile", "(", "path", ")", "and", "os", ".", "access", "(", "path", ",", "os", ".", "X_OK", ")" ]
.. versionadded:: 2014.7.0 Returns ``True`` if the specified service is available, otherwise returns ``False``. CLI Example: .. code-block:: bash salt '*' service.available sshd
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdservice.py#L214-L228
train
saltstack/salt
salt/modules/openbsdservice.py
get_all
def get_all(): ''' .. versionadded:: 2014.7.0 Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all ''' services = [] if not os.path.isdir('/etc/rc.d'): return services for service in os.listdir('/etc/rc.d'): # this ...
python
def get_all(): ''' .. versionadded:: 2014.7.0 Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all ''' services = [] if not os.path.isdir('/etc/rc.d'): return services for service in os.listdir('/etc/rc.d'): # this ...
[ "def", "get_all", "(", ")", ":", "services", "=", "[", "]", "if", "not", "os", ".", "path", ".", "isdir", "(", "'/etc/rc.d'", ")", ":", "return", "services", "for", "service", "in", "os", ".", "listdir", "(", "'/etc/rc.d'", ")", ":", "# this will remov...
.. versionadded:: 2014.7.0 Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdservice.py#L248-L267
train
saltstack/salt
salt/modules/openbsdservice.py
get_disabled
def get_disabled(): ''' .. versionadded:: 2014.7.0 Return a set of services that are installed but disabled CLI Example: .. code-block:: bash salt '*' service.get_disabled ''' services = [] for daemon, is_enabled in six.iteritems(_get_rc()): if not is_enabled: ...
python
def get_disabled(): ''' .. versionadded:: 2014.7.0 Return a set of services that are installed but disabled CLI Example: .. code-block:: bash salt '*' service.get_disabled ''' services = [] for daemon, is_enabled in six.iteritems(_get_rc()): if not is_enabled: ...
[ "def", "get_disabled", "(", ")", ":", "services", "=", "[", "]", "for", "daemon", ",", "is_enabled", "in", "six", ".", "iteritems", "(", "_get_rc", "(", ")", ")", ":", "if", "not", "is_enabled", ":", "services", ".", "append", "(", "daemon", ")", "re...
.. versionadded:: 2014.7.0 Return a set of services that are installed but disabled CLI Example: .. code-block:: bash salt '*' service.get_disabled
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdservice.py#L304-L320
train
saltstack/salt
salt/states/mysql_user.py
present
def present(name, host='localhost', password=None, password_hash=None, allow_passwordless=False, unix_socket=False, password_column=None, **connection_args): ''' Ensure that the named user is present with the specified propertie...
python
def present(name, host='localhost', password=None, password_hash=None, allow_passwordless=False, unix_socket=False, password_column=None, **connection_args): ''' Ensure that the named user is present with the specified propertie...
[ "def", "present", "(", "name", ",", "host", "=", "'localhost'", ",", "password", "=", "None", ",", "password_hash", "=", "None", ",", "allow_passwordless", "=", "False", ",", "unix_socket", "=", "False", ",", "password_column", "=", "None", ",", "*", "*", ...
Ensure that the named user is present with the specified properties. A passwordless user can be configured by omitting ``password`` and ``password_hash``, and setting ``allow_passwordless`` to ``True``. name The name of the user to manage host Host for which this user/password combo ap...
[ "Ensure", "that", "the", "named", "user", "is", "present", "with", "the", "specified", "properties", ".", "A", "passwordless", "user", "can", "be", "configured", "by", "omitting", "password", "and", "password_hash", "and", "setting", "allow_passwordless", "to", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mysql_user.py#L69-L228
train
saltstack/salt
salt/modules/ini_manage.py
set_option
def set_option(file_name, sections=None, separator='='): ''' Edit an ini file, replacing one or more sections. Returns a dictionary containing the changes made. file_name path of ini_file sections : None A dictionary representing the sections to be edited ini file The keys ...
python
def set_option(file_name, sections=None, separator='='): ''' Edit an ini file, replacing one or more sections. Returns a dictionary containing the changes made. file_name path of ini_file sections : None A dictionary representing the sections to be edited ini file The keys ...
[ "def", "set_option", "(", "file_name", ",", "sections", "=", "None", ",", "separator", "=", "'='", ")", ":", "sections", "=", "sections", "or", "{", "}", "changes", "=", "{", "}", "inifile", "=", "_Ini", ".", "get_ini_file", "(", "file_name", ",", "sep...
Edit an ini file, replacing one or more sections. Returns a dictionary containing the changes made. file_name path of ini_file sections : None A dictionary representing the sections to be edited ini file The keys are the section names and the values are the dictionary conta...
[ "Edit", "an", "ini", "file", "replacing", "one", "or", "more", "sections", ".", "Returns", "a", "dictionary", "containing", "the", "changes", "made", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L46-L88
train
saltstack/salt
salt/modules/ini_manage.py
get_option
def get_option(file_name, section, option, separator='='): ''' Get value of a key from a section in an ini file. Returns ``None`` if no matching key was found. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', 'ini.get_opt...
python
def get_option(file_name, section, option, separator='='): ''' Get value of a key from a section in an ini file. Returns ``None`` if no matching key was found. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', 'ini.get_opt...
[ "def", "get_option", "(", "file_name", ",", "section", ",", "option", ",", "separator", "=", "'='", ")", ":", "inifile", "=", "_Ini", ".", "get_ini_file", "(", "file_name", ",", "separator", "=", "separator", ")", "if", "section", ":", "try", ":", "retur...
Get value of a key from a section in an ini file. Returns ``None`` if no matching key was found. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', 'ini.get_option', [path_to_ini_file, section_name, option]) CLI...
[ "Get", "value", "of", "a", "key", "from", "a", "section", "in", "an", "ini", "file", ".", "Returns", "None", "if", "no", "matching", "key", "was", "found", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L91-L118
train
saltstack/salt
salt/modules/ini_manage.py
remove_option
def remove_option(file_name, section, option, separator='='): ''' Remove a key/value pair from a section in an ini file. Returns the value of the removed key, or ``None`` if nothing was removed. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() ...
python
def remove_option(file_name, section, option, separator='='): ''' Remove a key/value pair from a section in an ini file. Returns the value of the removed key, or ``None`` if nothing was removed. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() ...
[ "def", "remove_option", "(", "file_name", ",", "section", ",", "option", ",", "separator", "=", "'='", ")", ":", "inifile", "=", "_Ini", ".", "get_ini_file", "(", "file_name", ",", "separator", "=", "separator", ")", "if", "isinstance", "(", "inifile", "."...
Remove a key/value pair from a section in an ini file. Returns the value of the removed key, or ``None`` if nothing was removed. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', 'ini.remove_option', [path_to_ini_fi...
[ "Remove", "a", "key", "/", "value", "pair", "from", "a", "section", "in", "an", "ini", "file", ".", "Returns", "the", "value", "of", "the", "removed", "key", "or", "None", "if", "nothing", "was", "removed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L121-L148
train
saltstack/salt
salt/modules/ini_manage.py
get_section
def get_section(file_name, section, separator='='): ''' Retrieve a section from an ini file. Returns the section as dictionary. If the section is not found, an empty dictionary is returned. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() ...
python
def get_section(file_name, section, separator='='): ''' Retrieve a section from an ini file. Returns the section as dictionary. If the section is not found, an empty dictionary is returned. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() ...
[ "def", "get_section", "(", "file_name", ",", "section", ",", "separator", "=", "'='", ")", ":", "inifile", "=", "_Ini", ".", "get_ini_file", "(", "file_name", ",", "separator", "=", "separator", ")", "ret", "=", "{", "}", "for", "key", ",", "value", "i...
Retrieve a section from an ini file. Returns the section as dictionary. If the section is not found, an empty dictionary is returned. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', 'ini.get_section', [path_to_ini...
[ "Retrieve", "a", "section", "from", "an", "ini", "file", ".", "Returns", "the", "section", "as", "dictionary", ".", "If", "the", "section", "is", "not", "found", "an", "empty", "dictionary", "is", "returned", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L151-L176
train
saltstack/salt
salt/modules/ini_manage.py
remove_section
def remove_section(file_name, section, separator='='): ''' Remove a section in an ini file. Returns the removed section as dictionary, or ``None`` if nothing was removed. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', '...
python
def remove_section(file_name, section, separator='='): ''' Remove a section in an ini file. Returns the removed section as dictionary, or ``None`` if nothing was removed. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', '...
[ "def", "remove_section", "(", "file_name", ",", "section", ",", "separator", "=", "'='", ")", ":", "inifile", "=", "_Ini", ".", "get_ini_file", "(", "file_name", ",", "separator", "=", "separator", ")", "if", "section", "in", "inifile", ":", "section", "="...
Remove a section in an ini file. Returns the removed section as dictionary, or ``None`` if nothing was removed. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', 'ini.remove_section', [path_to_ini_file, section_name...
[ "Remove", "a", "section", "in", "an", "ini", "file", ".", "Returns", "the", "removed", "section", "as", "dictionary", "or", "None", "if", "nothing", "was", "removed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L179-L207
train
saltstack/salt
salt/modules/ini_manage.py
get_ini
def get_ini(file_name, separator='='): ''' Retrieve whole structure from an ini file and return it as dictionary. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', 'ini.get_ini', [path_to_ini_file]) CLI Exa...
python
def get_ini(file_name, separator='='): ''' Retrieve whole structure from an ini file and return it as dictionary. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', 'ini.get_ini', [path_to_ini_file]) CLI Exa...
[ "def", "get_ini", "(", "file_name", ",", "separator", "=", "'='", ")", ":", "def", "ini_odict2dict", "(", "odict", ")", ":", "'''\n Transform OrderedDict to regular dict recursively\n :param odict: OrderedDict\n :return: regular dict\n '''", "ret", "="...
Retrieve whole structure from an ini file and return it as dictionary. API Example: .. code-block:: python import salt sc = salt.client.get_local_client() sc.cmd('target', 'ini.get_ini', [path_to_ini_file]) CLI Example: .. code-block:: bash salt '*' i...
[ "Retrieve", "whole", "structure", "from", "an", "ini", "file", "and", "return", "it", "as", "dictionary", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L210-L245
train
saltstack/salt
salt/renderers/py.py
render
def render(template, saltenv='base', sls='', tmplpath=None, **kws): ''' Render the python module's components :rtype: string ''' template = tmplpath if not os.path.isfile(template): raise SaltRenderError('Template {0} is not a file!'.format(template)) tmp_data = salt.utils.template...
python
def render(template, saltenv='base', sls='', tmplpath=None, **kws): ''' Render the python module's components :rtype: string ''' template = tmplpath if not os.path.isfile(template): raise SaltRenderError('Template {0} is not a file!'.format(template)) tmp_data = salt.utils.template...
[ "def", "render", "(", "template", ",", "saltenv", "=", "'base'", ",", "sls", "=", "''", ",", "tmplpath", "=", "None", ",", "*", "*", "kws", ")", ":", "template", "=", "tmplpath", "if", "not", "os", ".", "path", ".", "isfile", "(", "template", ")", ...
Render the python module's components :rtype: string
[ "Render", "the", "python", "module", "s", "components" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/py.py#L123-L153
train
saltstack/salt
salt/states/rabbitmq_vhost.py
present
def present(name): ''' Ensure the RabbitMQ VHost exists. name VHost name user Initial user permission to set on the VHost, if present .. deprecated:: 2015.8.0 owner Initial owner permission to set on the VHost, if present .. deprecated:: 2015.8.0 conf ...
python
def present(name): ''' Ensure the RabbitMQ VHost exists. name VHost name user Initial user permission to set on the VHost, if present .. deprecated:: 2015.8.0 owner Initial owner permission to set on the VHost, if present .. deprecated:: 2015.8.0 conf ...
[ "def", "present", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "vhost_exists", "=", "__salt__", "[", "'rabbitmq.vhost_exists'", "]", "(",...
Ensure the RabbitMQ VHost exists. name VHost name user Initial user permission to set on the VHost, if present .. deprecated:: 2015.8.0 owner Initial owner permission to set on the VHost, if present .. deprecated:: 2015.8.0 conf Initial conf string to ...
[ "Ensure", "the", "RabbitMQ", "VHost", "exists", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rabbitmq_vhost.py#L35-L93
train
saltstack/salt
salt/states/dracr.py
property_present
def property_present(properties, admin_username='root', admin_password='calvin', host=None, **kwargs): ''' properties = {} ''' ret = {'name': host, 'context': {'Host': host}, 'result': True, 'changes': {}, 'comment': ''} if host is None: output =...
python
def property_present(properties, admin_username='root', admin_password='calvin', host=None, **kwargs): ''' properties = {} ''' ret = {'name': host, 'context': {'Host': host}, 'result': True, 'changes': {}, 'comment': ''} if host is None: output =...
[ "def", "property_present", "(", "properties", ",", "admin_username", "=", "'root'", ",", "admin_password", "=", "'calvin'", ",", "host", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "host", ",", "'context'", ":", "{", ...
properties = {}
[ "properties", "=", "{}" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/dracr.py#L41-L96
train
saltstack/salt
salt/modules/svn.py
_run_svn
def _run_svn(cmd, cwd, user, username, password, opts, **kwargs): ''' Execute svn return the output of the command cmd The command to run. cwd The path to the Subversion repository user Run svn as a user other than what the minion runs as username Connect ...
python
def _run_svn(cmd, cwd, user, username, password, opts, **kwargs): ''' Execute svn return the output of the command cmd The command to run. cwd The path to the Subversion repository user Run svn as a user other than what the minion runs as username Connect ...
[ "def", "_run_svn", "(", "cmd", ",", "cwd", ",", "user", ",", "username", ",", "password", ",", "opts", ",", "*", "*", "kwargs", ")", ":", "cmd", "=", "[", "'svn'", ",", "'--non-interactive'", ",", "cmd", "]", "options", "=", "list", "(", "opts", ")...
Execute svn return the output of the command cmd The command to run. cwd The path to the Subversion repository user Run svn as a user other than what the minion runs as username Connect to the Subversion server as another user password Connect to the ...
[ "Execute", "svn", "return", "the", "output", "of", "the", "command" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/svn.py#L30-L73
train
saltstack/salt
salt/modules/svn.py
info
def info(cwd, targets=None, user=None, username=None, password=None, fmt='str'): ''' Display the Subversion information from the checkout. cwd The path to the Subversion repository targets : None files, directories, and URLs to pass to the c...
python
def info(cwd, targets=None, user=None, username=None, password=None, fmt='str'): ''' Display the Subversion information from the checkout. cwd The path to the Subversion repository targets : None files, directories, and URLs to pass to the c...
[ "def", "info", "(", "cwd", ",", "targets", "=", "None", ",", "user", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ",", "fmt", "=", "'str'", ")", ":", "opts", "=", "list", "(", ")", "if", "fmt", "==", "'xml'", ":", "o...
Display the Subversion information from the checkout. cwd The path to the Subversion repository targets : None files, directories, and URLs to pass to the command as arguments svn uses '.' by default user : None Run svn as a user other than what the minion runs as use...
[ "Display", "the", "Subversion", "information", "from", "the", "checkout", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/svn.py#L76-L130
train
saltstack/salt
salt/modules/svn.py
checkout
def checkout(cwd, remote, target=None, user=None, username=None, password=None, *opts): ''' Download a working copy of the remote Subversion repository directory or file cwd The path to the Subversion repository ...
python
def checkout(cwd, remote, target=None, user=None, username=None, password=None, *opts): ''' Download a working copy of the remote Subversion repository directory or file cwd The path to the Subversion repository ...
[ "def", "checkout", "(", "cwd", ",", "remote", ",", "target", "=", "None", ",", "user", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ",", "*", "opts", ")", ":", "opts", "+=", "(", "remote", ",", ")", "if", "target", ":"...
Download a working copy of the remote Subversion repository directory or file cwd The path to the Subversion repository remote : None URL to checkout target : None The name to give the file or directory working copy Default: svn uses the remote basename user : Non...
[ "Download", "a", "working", "copy", "of", "the", "remote", "Subversion", "repository", "directory", "or", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/svn.py#L133-L174
train
saltstack/salt
salt/modules/svn.py
update
def update(cwd, targets=None, user=None, username=None, password=None, *opts): ''' Update the current directory, files, or directories from the remote Subversion repository cwd The path to the Subversion repository targets : None files and directories to pass to the command as argu...
python
def update(cwd, targets=None, user=None, username=None, password=None, *opts): ''' Update the current directory, files, or directories from the remote Subversion repository cwd The path to the Subversion repository targets : None files and directories to pass to the command as argu...
[ "def", "update", "(", "cwd", ",", "targets", "=", "None", ",", "user", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ",", "*", "opts", ")", ":", "if", "targets", ":", "opts", "+=", "tuple", "(", "salt", ".", "utils", "....
Update the current directory, files, or directories from the remote Subversion repository cwd The path to the Subversion repository targets : None files and directories to pass to the command as arguments Default: svn uses '.' user : None Run svn as a user other than w...
[ "Update", "the", "current", "directory", "files", "or", "directories", "from", "the", "remote", "Subversion", "repository" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/svn.py#L216-L247
train
saltstack/salt
salt/modules/svn.py
export
def export(cwd, remote, target=None, user=None, username=None, password=None, revision='HEAD', *opts): ''' Create an unversioned copy of a tree. cwd The path to the Subversion repository remote : None URL and ...
python
def export(cwd, remote, target=None, user=None, username=None, password=None, revision='HEAD', *opts): ''' Create an unversioned copy of a tree. cwd The path to the Subversion repository remote : None URL and ...
[ "def", "export", "(", "cwd", ",", "remote", ",", "target", "=", "None", ",", "user", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ",", "revision", "=", "'HEAD'", ",", "*", "opts", ")", ":", "opts", "+=", "(", "remote", ...
Create an unversioned copy of a tree. cwd The path to the Subversion repository remote : None URL and path to file or directory checkout target : None The name to give the file or directory working copy Default: svn uses the remote basename user : None Run svn...
[ "Create", "an", "unversioned", "copy", "of", "a", "tree", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/svn.py#L438-L481
train
saltstack/salt
salt/utils/stringutils.py
to_bytes
def to_bytes(s, encoding=None, errors='strict'): ''' Given bytes, bytearray, str, or unicode (python 2), return bytes (str for python 2) ''' if encoding is None: # Try utf-8 first, and fall back to detected encoding encoding = ('utf-8', __salt_system_encoding__) if not isinstance...
python
def to_bytes(s, encoding=None, errors='strict'): ''' Given bytes, bytearray, str, or unicode (python 2), return bytes (str for python 2) ''' if encoding is None: # Try utf-8 first, and fall back to detected encoding encoding = ('utf-8', __salt_system_encoding__) if not isinstance...
[ "def", "to_bytes", "(", "s", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ")", ":", "if", "encoding", "is", "None", ":", "# Try utf-8 first, and fall back to detected encoding", "encoding", "=", "(", "'utf-8'", ",", "__salt_system_encoding__", ")"...
Given bytes, bytearray, str, or unicode (python 2), return bytes (str for python 2)
[ "Given", "bytes", "bytearray", "str", "or", "unicode", "(", "python", "2", ")", "return", "bytes", "(", "str", "for", "python", "2", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L30-L63
train
saltstack/salt
salt/utils/stringutils.py
to_str
def to_str(s, encoding=None, errors='strict', normalize=False): ''' Given str, bytes, bytearray, or unicode (py2), return str ''' def _normalize(s): try: return unicodedata.normalize('NFC', s) if normalize else s except TypeError: return s if encoding is None...
python
def to_str(s, encoding=None, errors='strict', normalize=False): ''' Given str, bytes, bytearray, or unicode (py2), return str ''' def _normalize(s): try: return unicodedata.normalize('NFC', s) if normalize else s except TypeError: return s if encoding is None...
[ "def", "to_str", "(", "s", ",", "encoding", "=", "None", ",", "errors", "=", "'strict'", ",", "normalize", "=", "False", ")", ":", "def", "_normalize", "(", "s", ")", ":", "try", ":", "return", "unicodedata", ".", "normalize", "(", "'NFC'", ",", "s",...
Given str, bytes, bytearray, or unicode (py2), return str
[ "Given", "str", "bytes", "bytearray", "or", "unicode", "(", "py2", ")", "return", "str" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L66-L118
train
saltstack/salt
salt/utils/stringutils.py
to_bool
def to_bool(text): ''' Convert the string name of a boolean to that boolean value. ''' downcased_text = six.text_type(text).strip().lower() if downcased_text == 'false': return False elif downcased_text == 'true': return True return text
python
def to_bool(text): ''' Convert the string name of a boolean to that boolean value. ''' downcased_text = six.text_type(text).strip().lower() if downcased_text == 'false': return False elif downcased_text == 'true': return True return text
[ "def", "to_bool", "(", "text", ")", ":", "downcased_text", "=", "six", ".", "text_type", "(", "text", ")", ".", "strip", "(", ")", ".", "lower", "(", ")", "if", "downcased_text", "==", "'false'", ":", "return", "False", "elif", "downcased_text", "==", ...
Convert the string name of a boolean to that boolean value.
[ "Convert", "the", "string", "name", "of", "a", "boolean", "to", "that", "boolean", "value", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L182-L192
train
saltstack/salt
salt/utils/stringutils.py
is_quoted
def is_quoted(value): ''' Return a single or double quote, if a string is wrapped in extra quotes. Otherwise return an empty string. ''' ret = '' if isinstance(value, six.string_types) \ and value[0] == value[-1] \ and value.startswith(('\'', '"')): ret = value[0]...
python
def is_quoted(value): ''' Return a single or double quote, if a string is wrapped in extra quotes. Otherwise return an empty string. ''' ret = '' if isinstance(value, six.string_types) \ and value[0] == value[-1] \ and value.startswith(('\'', '"')): ret = value[0]...
[ "def", "is_quoted", "(", "value", ")", ":", "ret", "=", "''", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", "and", "value", "[", "0", "]", "==", "value", "[", "-", "1", "]", "and", "value", ".", "startswith", "(", "(", "...
Return a single or double quote, if a string is wrapped in extra quotes. Otherwise return an empty string.
[ "Return", "a", "single", "or", "double", "quote", "if", "a", "string", "is", "wrapped", "in", "extra", "quotes", ".", "Otherwise", "return", "an", "empty", "string", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L204-L214
train
saltstack/salt
salt/utils/stringutils.py
is_binary
def is_binary(data): ''' Detects if the passed string of data is binary or text ''' if not data or not isinstance(data, (six.string_types, six.binary_type)): return False if isinstance(data, six.binary_type): if b'\0' in data: return True elif str('\0') in data: ...
python
def is_binary(data): ''' Detects if the passed string of data is binary or text ''' if not data or not isinstance(data, (six.string_types, six.binary_type)): return False if isinstance(data, six.binary_type): if b'\0' in data: return True elif str('\0') in data: ...
[ "def", "is_binary", "(", "data", ")", ":", "if", "not", "data", "or", "not", "isinstance", "(", "data", ",", "(", "six", ".", "string_types", ",", "six", ".", "binary_type", ")", ")", ":", "return", "False", "if", "isinstance", "(", "data", ",", "six...
Detects if the passed string of data is binary or text
[ "Detects", "if", "the", "passed", "string", "of", "data", "is", "binary", "or", "text" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L238-L272
train
saltstack/salt
salt/utils/stringutils.py
human_to_bytes
def human_to_bytes(size): ''' Given a human-readable byte string (e.g. 2G, 30M), return the number of bytes. Will return 0 if the argument has unexpected form. .. versionadded:: 2018.3.0 ''' sbytes = size[:-1] unit = size[-1] if sbytes.isdigit(): sbytes = int(sbytes) ...
python
def human_to_bytes(size): ''' Given a human-readable byte string (e.g. 2G, 30M), return the number of bytes. Will return 0 if the argument has unexpected form. .. versionadded:: 2018.3.0 ''' sbytes = size[:-1] unit = size[-1] if sbytes.isdigit(): sbytes = int(sbytes) ...
[ "def", "human_to_bytes", "(", "size", ")", ":", "sbytes", "=", "size", "[", ":", "-", "1", "]", "unit", "=", "size", "[", "-", "1", "]", "if", "sbytes", ".", "isdigit", "(", ")", ":", "sbytes", "=", "int", "(", "sbytes", ")", "if", "unit", "=="...
Given a human-readable byte string (e.g. 2G, 30M), return the number of bytes. Will return 0 if the argument has unexpected form. .. versionadded:: 2018.3.0
[ "Given", "a", "human", "-", "readable", "byte", "string", "(", "e", ".", "g", ".", "2G", "30M", ")", "return", "the", "number", "of", "bytes", ".", "Will", "return", "0", "if", "the", "argument", "has", "unexpected", "form", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L289-L313
train
saltstack/salt
salt/utils/stringutils.py
build_whitespace_split_regex
def build_whitespace_split_regex(text): ''' Create a regular expression at runtime which should match ignoring the addition or deletion of white space or line breaks, unless between commas Example: .. code-block:: python >>> import re >>> import salt.utils.stringutils >>> ...
python
def build_whitespace_split_regex(text): ''' Create a regular expression at runtime which should match ignoring the addition or deletion of white space or line breaks, unless between commas Example: .. code-block:: python >>> import re >>> import salt.utils.stringutils >>> ...
[ "def", "build_whitespace_split_regex", "(", "text", ")", ":", "def", "__build_parts", "(", "text", ")", ":", "lexer", "=", "shlex", ".", "shlex", "(", "text", ")", "lexer", ".", "whitespace_split", "=", "True", "lexer", ".", "commenters", "=", "''", "if", ...
Create a regular expression at runtime which should match ignoring the addition or deletion of white space or line breaks, unless between commas Example: .. code-block:: python >>> import re >>> import salt.utils.stringutils >>> regex = salt.utils.stringutils.build_whitespace_spli...
[ "Create", "a", "regular", "expression", "at", "runtime", "which", "should", "match", "ignoring", "the", "addition", "or", "deletion", "of", "white", "space", "or", "line", "breaks", "unless", "between", "commas" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L316-L361
train
saltstack/salt
salt/utils/stringutils.py
expr_match
def expr_match(line, expr): ''' Checks whether or not the passed value matches the specified expression. Tries to match expr first as a glob using fnmatch.fnmatch(), and then tries to match expr as a regular expression. Originally designed to match minion IDs for whitelists/blacklists. Note tha...
python
def expr_match(line, expr): ''' Checks whether or not the passed value matches the specified expression. Tries to match expr first as a glob using fnmatch.fnmatch(), and then tries to match expr as a regular expression. Originally designed to match minion IDs for whitelists/blacklists. Note tha...
[ "def", "expr_match", "(", "line", ",", "expr", ")", ":", "try", ":", "if", "fnmatch", ".", "fnmatch", "(", "line", ",", "expr", ")", ":", "return", "True", "try", ":", "if", "re", ".", "match", "(", "r'\\A{0}\\Z'", ".", "format", "(", "expr", ")", ...
Checks whether or not the passed value matches the specified expression. Tries to match expr first as a glob using fnmatch.fnmatch(), and then tries to match expr as a regular expression. Originally designed to match minion IDs for whitelists/blacklists. Note that this also does exact matches, as fnmat...
[ "Checks", "whether", "or", "not", "the", "passed", "value", "matches", "the", "specified", "expression", ".", "Tries", "to", "match", "expr", "first", "as", "a", "glob", "using", "fnmatch", ".", "fnmatch", "()", "and", "then", "tries", "to", "match", "expr...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L364-L389
train
saltstack/salt
salt/utils/stringutils.py
check_whitelist_blacklist
def check_whitelist_blacklist(value, whitelist=None, blacklist=None): ''' Check a whitelist and/or blacklist to see if the value matches it. value The item to check the whitelist and/or blacklist against. whitelist The list of items that are white-listed. If ``value`` is found ...
python
def check_whitelist_blacklist(value, whitelist=None, blacklist=None): ''' Check a whitelist and/or blacklist to see if the value matches it. value The item to check the whitelist and/or blacklist against. whitelist The list of items that are white-listed. If ``value`` is found ...
[ "def", "check_whitelist_blacklist", "(", "value", ",", "whitelist", "=", "None", ",", "blacklist", "=", "None", ")", ":", "# Normalize the input so that we have a list", "if", "blacklist", ":", "if", "isinstance", "(", "blacklist", ",", "six", ".", "string_types", ...
Check a whitelist and/or blacklist to see if the value matches it. value The item to check the whitelist and/or blacklist against. whitelist The list of items that are white-listed. If ``value`` is found in the whitelist, then the function returns ``True``. Otherwise, it return...
[ "Check", "a", "whitelist", "and", "/", "or", "blacklist", "to", "see", "if", "the", "value", "matches", "it", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L393-L454
train
saltstack/salt
salt/utils/stringutils.py
check_include_exclude
def check_include_exclude(path_str, include_pat=None, exclude_pat=None): ''' Check for glob or regexp patterns for include_pat and exclude_pat in the 'path_str' string and return True/False conditions as follows. - Default: return 'True' if no include_pat or exclude_pat patterns are supplied ...
python
def check_include_exclude(path_str, include_pat=None, exclude_pat=None): ''' Check for glob or regexp patterns for include_pat and exclude_pat in the 'path_str' string and return True/False conditions as follows. - Default: return 'True' if no include_pat or exclude_pat patterns are supplied ...
[ "def", "check_include_exclude", "(", "path_str", ",", "include_pat", "=", "None", ",", "exclude_pat", "=", "None", ")", ":", "def", "_pat_check", "(", "path_str", ",", "check_pat", ")", ":", "if", "re", ".", "match", "(", "'E@'", ",", "check_pat", ")", "...
Check for glob or regexp patterns for include_pat and exclude_pat in the 'path_str' string and return True/False conditions as follows. - Default: return 'True' if no include_pat or exclude_pat patterns are supplied - If only include_pat or exclude_pat is supplied: return 'True' if string ...
[ "Check", "for", "glob", "or", "regexp", "patterns", "for", "include_pat", "and", "exclude_pat", "in", "the", "path_str", "string", "and", "return", "True", "/", "False", "conditions", "as", "follows", ".", "-", "Default", ":", "return", "True", "if", "no", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L457-L510
train
saltstack/salt
salt/utils/stringutils.py
print_cli
def print_cli(msg, retries=10, step=0.01): ''' Wrapper around print() that suppresses tracebacks on broken pipes (i.e. when salt output is piped to less and less is stopped prematurely). ''' while retries: try: try: print(msg) except UnicodeEncodeError...
python
def print_cli(msg, retries=10, step=0.01): ''' Wrapper around print() that suppresses tracebacks on broken pipes (i.e. when salt output is piped to less and less is stopped prematurely). ''' while retries: try: try: print(msg) except UnicodeEncodeError...
[ "def", "print_cli", "(", "msg", ",", "retries", "=", "10", ",", "step", "=", "0.01", ")", ":", "while", "retries", ":", "try", ":", "try", ":", "print", "(", "msg", ")", "except", "UnicodeEncodeError", ":", "print", "(", "msg", ".", "encode", "(", ...
Wrapper around print() that suppresses tracebacks on broken pipes (i.e. when salt output is piped to less and less is stopped prematurely).
[ "Wrapper", "around", "print", "()", "that", "suppresses", "tracebacks", "on", "broken", "pipes", "(", "i", ".", "e", ".", "when", "salt", "output", "is", "piped", "to", "less", "and", "less", "is", "stopped", "prematurely", ")", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L513-L537
train
saltstack/salt
salt/utils/stringutils.py
get_context
def get_context(template, line, num_lines=5, marker=None): ''' Returns debugging context around a line in a given string Returns:: string ''' template_lines = template.splitlines() num_template_lines = len(template_lines) # In test mode, a single line template would return a crazy line num...
python
def get_context(template, line, num_lines=5, marker=None): ''' Returns debugging context around a line in a given string Returns:: string ''' template_lines = template.splitlines() num_template_lines = len(template_lines) # In test mode, a single line template would return a crazy line num...
[ "def", "get_context", "(", "template", ",", "line", ",", "num_lines", "=", "5", ",", "marker", "=", "None", ")", ":", "template_lines", "=", "template", ".", "splitlines", "(", ")", "num_template_lines", "=", "len", "(", "template_lines", ")", "# In test mod...
Returns debugging context around a line in a given string Returns:: string
[ "Returns", "debugging", "context", "around", "a", "line", "in", "a", "given", "string" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L540-L572
train
saltstack/salt
salt/utils/stringutils.py
get_diff
def get_diff(a, b, *args, **kwargs): ''' Perform diff on two iterables containing lines from two files, and return the diff as as string. Lines are normalized to str types to avoid issues with unicode on PY2. ''' encoding = ('utf-8', 'latin-1', __salt_system_encoding__) # Late import to avoi...
python
def get_diff(a, b, *args, **kwargs): ''' Perform diff on two iterables containing lines from two files, and return the diff as as string. Lines are normalized to str types to avoid issues with unicode on PY2. ''' encoding = ('utf-8', 'latin-1', __salt_system_encoding__) # Late import to avoi...
[ "def", "get_diff", "(", "a", ",", "b", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "encoding", "=", "(", "'utf-8'", ",", "'latin-1'", ",", "__salt_system_encoding__", ")", "# Late import to avoid circular import", "import", "salt", ".", "utils", "."...
Perform diff on two iterables containing lines from two files, and return the diff as as string. Lines are normalized to str types to avoid issues with unicode on PY2.
[ "Perform", "diff", "on", "two", "iterables", "containing", "lines", "from", "two", "files", "and", "return", "the", "diff", "as", "as", "string", ".", "Lines", "are", "normalized", "to", "str", "types", "to", "avoid", "issues", "with", "unicode", "on", "PY...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L575-L590
train
saltstack/salt
salt/utils/stringutils.py
camel_to_snake_case
def camel_to_snake_case(camel_input): ''' Converts camelCase (or CamelCase) to snake_case. From https://codereview.stackexchange.com/questions/185966/functions-to-convert-camelcase-strings-to-snake-case :param str camel_input: The camelcase or CamelCase string to convert to snake_case :return str ...
python
def camel_to_snake_case(camel_input): ''' Converts camelCase (or CamelCase) to snake_case. From https://codereview.stackexchange.com/questions/185966/functions-to-convert-camelcase-strings-to-snake-case :param str camel_input: The camelcase or CamelCase string to convert to snake_case :return str ...
[ "def", "camel_to_snake_case", "(", "camel_input", ")", ":", "res", "=", "camel_input", "[", "0", "]", ".", "lower", "(", ")", "for", "i", ",", "letter", "in", "enumerate", "(", "camel_input", "[", "1", ":", "]", ",", "1", ")", ":", "if", "letter", ...
Converts camelCase (or CamelCase) to snake_case. From https://codereview.stackexchange.com/questions/185966/functions-to-convert-camelcase-strings-to-snake-case :param str camel_input: The camelcase or CamelCase string to convert to snake_case :return str
[ "Converts", "camelCase", "(", "or", "CamelCase", ")", "to", "snake_case", ".", "From", "https", ":", "//", "codereview", ".", "stackexchange", ".", "com", "/", "questions", "/", "185966", "/", "functions", "-", "to", "-", "convert", "-", "camelcase", "-", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L594-L609
train
saltstack/salt
salt/utils/stringutils.py
snake_to_camel_case
def snake_to_camel_case(snake_input, uppercamel=False): ''' Converts snake_case to camelCase (or CamelCase if uppercamel is ``True``). Inspired by https://codereview.stackexchange.com/questions/85311/transform-snake-case-to-camelcase :param str snake_input: The input snake_case string to convert to cam...
python
def snake_to_camel_case(snake_input, uppercamel=False): ''' Converts snake_case to camelCase (or CamelCase if uppercamel is ``True``). Inspired by https://codereview.stackexchange.com/questions/85311/transform-snake-case-to-camelcase :param str snake_input: The input snake_case string to convert to cam...
[ "def", "snake_to_camel_case", "(", "snake_input", ",", "uppercamel", "=", "False", ")", ":", "words", "=", "snake_input", ".", "split", "(", "'_'", ")", "if", "uppercamel", ":", "words", "[", "0", "]", "=", "words", "[", "0", "]", ".", "capitalize", "(...
Converts snake_case to camelCase (or CamelCase if uppercamel is ``True``). Inspired by https://codereview.stackexchange.com/questions/85311/transform-snake-case-to-camelcase :param str snake_input: The input snake_case string to convert to camelCase :param bool uppercamel: Whether or not to convert to Came...
[ "Converts", "snake_case", "to", "camelCase", "(", "or", "CamelCase", "if", "uppercamel", "is", "True", ")", ".", "Inspired", "by", "https", ":", "//", "codereview", ".", "stackexchange", ".", "com", "/", "questions", "/", "85311", "/", "transform", "-", "s...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L613-L626
train
saltstack/salt
salt/modules/ethtool.py
show_ring
def show_ring(devname): ''' Queries the specified network device for rx/tx ring parameter information CLI Example: .. code-block:: bash salt '*' ethtool.show_ring <devname> ''' try: ring = ethtool.get_ringparam(devname) except IOError: log.error('Ring parameters n...
python
def show_ring(devname): ''' Queries the specified network device for rx/tx ring parameter information CLI Example: .. code-block:: bash salt '*' ethtool.show_ring <devname> ''' try: ring = ethtool.get_ringparam(devname) except IOError: log.error('Ring parameters n...
[ "def", "show_ring", "(", "devname", ")", ":", "try", ":", "ring", "=", "ethtool", ".", "get_ringparam", "(", "devname", ")", "except", "IOError", ":", "log", ".", "error", "(", "'Ring parameters not supported on %s'", ",", "devname", ")", "return", "'Not suppo...
Queries the specified network device for rx/tx ring parameter information CLI Example: .. code-block:: bash salt '*' ethtool.show_ring <devname>
[ "Queries", "the", "specified", "network", "device", "for", "rx", "/", "tx", "ring", "parameter", "information" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L85-L106
train
saltstack/salt
salt/modules/ethtool.py
show_coalesce
def show_coalesce(devname): ''' Queries the specified network device for coalescing information CLI Example: .. code-block:: bash salt '*' ethtool.show_coalesce <devname> ''' try: coalesce = ethtool.get_coalesce(devname) except IOError: log.error('Interrupt coales...
python
def show_coalesce(devname): ''' Queries the specified network device for coalescing information CLI Example: .. code-block:: bash salt '*' ethtool.show_coalesce <devname> ''' try: coalesce = ethtool.get_coalesce(devname) except IOError: log.error('Interrupt coales...
[ "def", "show_coalesce", "(", "devname", ")", ":", "try", ":", "coalesce", "=", "ethtool", ".", "get_coalesce", "(", "devname", ")", "except", "IOError", ":", "log", ".", "error", "(", "'Interrupt coalescing not supported on %s'", ",", "devname", ")", "return", ...
Queries the specified network device for coalescing information CLI Example: .. code-block:: bash salt '*' ethtool.show_coalesce <devname>
[ "Queries", "the", "specified", "network", "device", "for", "coalescing", "information" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L109-L130
train
saltstack/salt
salt/modules/ethtool.py
show_driver
def show_driver(devname): ''' Queries the specified network device for associated driver information CLI Example: .. code-block:: bash salt '*' ethtool.show_driver <devname> ''' try: module = ethtool.get_module(devname) except IOError: log.error('Driver informatio...
python
def show_driver(devname): ''' Queries the specified network device for associated driver information CLI Example: .. code-block:: bash salt '*' ethtool.show_driver <devname> ''' try: module = ethtool.get_module(devname) except IOError: log.error('Driver informatio...
[ "def", "show_driver", "(", "devname", ")", ":", "try", ":", "module", "=", "ethtool", ".", "get_module", "(", "devname", ")", "except", "IOError", ":", "log", ".", "error", "(", "'Driver information not implemented on %s'", ",", "devname", ")", "return", "'Not...
Queries the specified network device for associated driver information CLI Example: .. code-block:: bash salt '*' ethtool.show_driver <devname>
[ "Queries", "the", "specified", "network", "device", "for", "associated", "driver", "information" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L133-L161
train
saltstack/salt
salt/modules/ethtool.py
set_ring
def set_ring(devname, **kwargs): ''' Changes the rx/tx ring parameters of the specified network device CLI Example: .. code-block:: bash salt '*' ethtool.set_ring <devname> [rx=N] [rx_mini=N] [rx_jumbo=N] [tx=N] ''' try: ring = ethtool.get_ringparam(devname) except IOErro...
python
def set_ring(devname, **kwargs): ''' Changes the rx/tx ring parameters of the specified network device CLI Example: .. code-block:: bash salt '*' ethtool.set_ring <devname> [rx=N] [rx_mini=N] [rx_jumbo=N] [tx=N] ''' try: ring = ethtool.get_ringparam(devname) except IOErro...
[ "def", "set_ring", "(", "devname", ",", "*", "*", "kwargs", ")", ":", "try", ":", "ring", "=", "ethtool", ".", "get_ringparam", "(", "devname", ")", "except", "IOError", ":", "log", ".", "error", "(", "'Ring parameters not supported on %s'", ",", "devname", ...
Changes the rx/tx ring parameters of the specified network device CLI Example: .. code-block:: bash salt '*' ethtool.set_ring <devname> [rx=N] [rx_mini=N] [rx_jumbo=N] [tx=N]
[ "Changes", "the", "rx", "/", "tx", "ring", "parameters", "of", "the", "specified", "network", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L164-L196
train
saltstack/salt
salt/modules/ethtool.py
set_coalesce
def set_coalesce(devname, **kwargs): ''' Changes the coalescing settings of the specified network device CLI Example: .. code-block:: bash salt '*' ethtool.set_coalesce <devname> [adaptive_rx=on|off] [adaptive_tx=on|off] [rx_usecs=N] [rx_frames=N] [rx_usecs_irq=N] [rx_frames_irq=N...
python
def set_coalesce(devname, **kwargs): ''' Changes the coalescing settings of the specified network device CLI Example: .. code-block:: bash salt '*' ethtool.set_coalesce <devname> [adaptive_rx=on|off] [adaptive_tx=on|off] [rx_usecs=N] [rx_frames=N] [rx_usecs_irq=N] [rx_frames_irq=N...
[ "def", "set_coalesce", "(", "devname", ",", "*", "*", "kwargs", ")", ":", "try", ":", "coalesce", "=", "ethtool", ".", "get_coalesce", "(", "devname", ")", "except", "IOError", ":", "log", ".", "error", "(", "'Interrupt coalescing not supported on %s'", ",", ...
Changes the coalescing settings of the specified network device CLI Example: .. code-block:: bash salt '*' ethtool.set_coalesce <devname> [adaptive_rx=on|off] [adaptive_tx=on|off] [rx_usecs=N] [rx_frames=N] [rx_usecs_irq=N] [rx_frames_irq=N] [tx_usecs=N] [tx_frames=N] [tx_usecs_irq=N] [tx...
[ "Changes", "the", "coalescing", "settings", "of", "the", "specified", "network", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L199-L235
train
saltstack/salt
salt/modules/ethtool.py
show_offload
def show_offload(devname): ''' Queries the specified network device for the state of protocol offload and other features CLI Example: .. code-block:: bash salt '*' ethtool.show_offload <devname> ''' try: sg = ethtool.get_sg(devname) and "on" or "off" except IOError: ...
python
def show_offload(devname): ''' Queries the specified network device for the state of protocol offload and other features CLI Example: .. code-block:: bash salt '*' ethtool.show_offload <devname> ''' try: sg = ethtool.get_sg(devname) and "on" or "off" except IOError: ...
[ "def", "show_offload", "(", "devname", ")", ":", "try", ":", "sg", "=", "ethtool", ".", "get_sg", "(", "devname", ")", "and", "\"on\"", "or", "\"off\"", "except", "IOError", ":", "sg", "=", "\"not supported\"", "try", ":", "tso", "=", "ethtool", ".", "...
Queries the specified network device for the state of protocol offload and other features CLI Example: .. code-block:: bash salt '*' ethtool.show_offload <devname>
[ "Queries", "the", "specified", "network", "device", "for", "the", "state", "of", "protocol", "offload", "and", "other", "features" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L238-L276
train
saltstack/salt
salt/modules/ethtool.py
set_offload
def set_offload(devname, **kwargs): ''' Changes the offload parameters and other features of the specified network device CLI Example: .. code-block:: bash salt '*' ethtool.set_offload <devname> tcp_segmentation_offload=on ''' for param, value in kwargs.items(): if param == '...
python
def set_offload(devname, **kwargs): ''' Changes the offload parameters and other features of the specified network device CLI Example: .. code-block:: bash salt '*' ethtool.set_offload <devname> tcp_segmentation_offload=on ''' for param, value in kwargs.items(): if param == '...
[ "def", "set_offload", "(", "devname", ",", "*", "*", "kwargs", ")", ":", "for", "param", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "if", "param", "==", "'tcp_segmentation_offload'", ":", "value", "=", "value", "==", "\"on\"", "and", "1...
Changes the offload parameters and other features of the specified network device CLI Example: .. code-block:: bash salt '*' ethtool.set_offload <devname> tcp_segmentation_offload=on
[ "Changes", "the", "offload", "parameters", "and", "other", "features", "of", "the", "specified", "network", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L279-L298
train
saltstack/salt
salt/modules/tls.py
_microtime
def _microtime(): ''' Return a Unix timestamp as a string of digits :return: ''' val1, val2 = math.modf(time.time()) val2 = int(val2) return '{0:f}{1}'.format(val1, val2)
python
def _microtime(): ''' Return a Unix timestamp as a string of digits :return: ''' val1, val2 = math.modf(time.time()) val2 = int(val2) return '{0:f}{1}'.format(val1, val2)
[ "def", "_microtime", "(", ")", ":", "val1", ",", "val2", "=", "math", ".", "modf", "(", "time", ".", "time", "(", ")", ")", "val2", "=", "int", "(", "val2", ")", "return", "'{0:f}{1}'", ".", "format", "(", "val1", ",", "val2", ")" ]
Return a Unix timestamp as a string of digits :return:
[ "Return", "a", "Unix", "timestamp", "as", "a", "string", "of", "digits", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L164-L171
train
saltstack/salt
salt/modules/tls.py
cert_base_path
def cert_base_path(cacert_path=None): ''' Return the base path for certs from CLI or from options cacert_path absolute path to ca certificates root directory CLI Example: .. code-block:: bash salt '*' tls.cert_base_path ''' if not cacert_path: cacert_path = __cont...
python
def cert_base_path(cacert_path=None): ''' Return the base path for certs from CLI or from options cacert_path absolute path to ca certificates root directory CLI Example: .. code-block:: bash salt '*' tls.cert_base_path ''' if not cacert_path: cacert_path = __cont...
[ "def", "cert_base_path", "(", "cacert_path", "=", "None", ")", ":", "if", "not", "cacert_path", ":", "cacert_path", "=", "__context__", ".", "get", "(", "'ca.contextual_cert_base_path'", ",", "__salt__", "[", "'config.option'", "]", "(", "'ca.contextual_cert_base_pa...
Return the base path for certs from CLI or from options cacert_path absolute path to ca certificates root directory CLI Example: .. code-block:: bash salt '*' tls.cert_base_path
[ "Return", "the", "base", "path", "for", "certs", "from", "CLI", "or", "from", "options" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L174-L195
train
saltstack/salt
salt/modules/tls.py
_new_serial
def _new_serial(ca_name): ''' Return a serial number in hex using os.urandom() and a Unix timestamp in microseconds. ca_name name of the CA CN common name in the request ''' hashnum = int( binascii.hexlify( b'_'.join(( salt.utils.stringuti...
python
def _new_serial(ca_name): ''' Return a serial number in hex using os.urandom() and a Unix timestamp in microseconds. ca_name name of the CA CN common name in the request ''' hashnum = int( binascii.hexlify( b'_'.join(( salt.utils.stringuti...
[ "def", "_new_serial", "(", "ca_name", ")", ":", "hashnum", "=", "int", "(", "binascii", ".", "hexlify", "(", "b'_'", ".", "join", "(", "(", "salt", ".", "utils", ".", "stringutils", ".", "to_bytes", "(", "_microtime", "(", ")", ")", ",", "os", ".", ...
Return a serial number in hex using os.urandom() and a Unix timestamp in microseconds. ca_name name of the CA CN common name in the request
[ "Return", "a", "serial", "number", "in", "hex", "using", "os", ".", "urandom", "()", "and", "a", "Unix", "timestamp", "in", "microseconds", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L221-L255
train
saltstack/salt
salt/modules/tls.py
_get_basic_info
def _get_basic_info(ca_name, cert, ca_dir=None): ''' Get basic info to write out to the index.txt ''' if ca_dir is None: ca_dir = '{0}/{1}'.format(_cert_base_path(), ca_name) index_file = "{0}/index.txt".format(ca_dir) cert = _read_cert(cert) expire_date = _four_digit_year_to_two_d...
python
def _get_basic_info(ca_name, cert, ca_dir=None): ''' Get basic info to write out to the index.txt ''' if ca_dir is None: ca_dir = '{0}/{1}'.format(_cert_base_path(), ca_name) index_file = "{0}/index.txt".format(ca_dir) cert = _read_cert(cert) expire_date = _four_digit_year_to_two_d...
[ "def", "_get_basic_info", "(", "ca_name", ",", "cert", ",", "ca_dir", "=", "None", ")", ":", "if", "ca_dir", "is", "None", ":", "ca_dir", "=", "'{0}/{1}'", ".", "format", "(", "_cert_base_path", "(", ")", ",", "ca_name", ")", "index_file", "=", "\"{0}/in...
Get basic info to write out to the index.txt
[ "Get", "basic", "info", "to", "write", "out", "to", "the", "index", ".", "txt" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L262-L286
train
saltstack/salt
salt/modules/tls.py
_write_cert_to_database
def _write_cert_to_database(ca_name, cert, cacert_path=None, status='V'): ''' write out the index.txt database file in the appropriate directory to track certificates ca_name name of the CA cert certificate to be recorded ''' set_ca_path(cacert_path) ca_dir = '{0}/{1}'.f...
python
def _write_cert_to_database(ca_name, cert, cacert_path=None, status='V'): ''' write out the index.txt database file in the appropriate directory to track certificates ca_name name of the CA cert certificate to be recorded ''' set_ca_path(cacert_path) ca_dir = '{0}/{1}'.f...
[ "def", "_write_cert_to_database", "(", "ca_name", ",", "cert", ",", "cacert_path", "=", "None", ",", "status", "=", "'V'", ")", ":", "set_ca_path", "(", "cacert_path", ")", "ca_dir", "=", "'{0}/{1}'", ".", "format", "(", "cert_base_path", "(", ")", ",", "c...
write out the index.txt database file in the appropriate directory to track certificates ca_name name of the CA cert certificate to be recorded
[ "write", "out", "the", "index", ".", "txt", "database", "file", "in", "the", "appropriate", "directory", "to", "track", "certificates" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L289-L314
train
saltstack/salt
salt/modules/tls.py
maybe_fix_ssl_version
def maybe_fix_ssl_version(ca_name, cacert_path=None, ca_filename=None): ''' Check that the X509 version is correct (was incorrectly set in previous salt versions). This will fix the version if needed. ca_name ca authority name cacert_path absolute path to ca certificates root di...
python
def maybe_fix_ssl_version(ca_name, cacert_path=None, ca_filename=None): ''' Check that the X509 version is correct (was incorrectly set in previous salt versions). This will fix the version if needed. ca_name ca authority name cacert_path absolute path to ca certificates root di...
[ "def", "maybe_fix_ssl_version", "(", "ca_name", ",", "cacert_path", "=", "None", ",", "ca_filename", "=", "None", ")", ":", "set_ca_path", "(", "cacert_path", ")", "if", "not", "ca_filename", ":", "ca_filename", "=", "'{0}_ca_cert'", ".", "format", "(", "ca_na...
Check that the X509 version is correct (was incorrectly set in previous salt versions). This will fix the version if needed. ca_name ca authority name cacert_path absolute path to ca certificates root directory ca_filename alternative filename for the CA .. versiona...
[ "Check", "that", "the", "X509", "version", "is", "correct", "(", "was", "incorrectly", "set", "in", "previous", "salt", "versions", ")", ".", "This", "will", "fix", "the", "version", "if", "needed", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L317-L382
train
saltstack/salt
salt/modules/tls.py
ca_exists
def ca_exists(ca_name, cacert_path=None, ca_filename=None): ''' Verify whether a Certificate Authority (CA) already exists ca_name name of the CA cacert_path absolute path to ca certificates root directory ca_filename alternative filename for the CA .. versionadded:...
python
def ca_exists(ca_name, cacert_path=None, ca_filename=None): ''' Verify whether a Certificate Authority (CA) already exists ca_name name of the CA cacert_path absolute path to ca certificates root directory ca_filename alternative filename for the CA .. versionadded:...
[ "def", "ca_exists", "(", "ca_name", ",", "cacert_path", "=", "None", ",", "ca_filename", "=", "None", ")", ":", "set_ca_path", "(", "cacert_path", ")", "if", "not", "ca_filename", ":", "ca_filename", "=", "'{0}_ca_cert'", ".", "format", "(", "ca_name", ")", ...
Verify whether a Certificate Authority (CA) already exists ca_name name of the CA cacert_path absolute path to ca certificates root directory ca_filename alternative filename for the CA .. versionadded:: 2015.5.3 CLI Example: .. code-block:: bash salt '*...
[ "Verify", "whether", "a", "Certificate", "Authority", "(", "CA", ")", "already", "exists" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L385-L417
train
saltstack/salt
salt/modules/tls.py
get_ca
def get_ca(ca_name, as_text=False, cacert_path=None): ''' Get the certificate path or content ca_name name of the CA as_text if true, return the certificate content instead of the path cacert_path absolute path to ca certificates root directory CLI Example: .. code...
python
def get_ca(ca_name, as_text=False, cacert_path=None): ''' Get the certificate path or content ca_name name of the CA as_text if true, return the certificate content instead of the path cacert_path absolute path to ca certificates root directory CLI Example: .. code...
[ "def", "get_ca", "(", "ca_name", ",", "as_text", "=", "False", ",", "cacert_path", "=", "None", ")", ":", "set_ca_path", "(", "cacert_path", ")", "certp", "=", "'{0}/{1}/{1}_ca_cert.crt'", ".", "format", "(", "cert_base_path", "(", ")", ",", "ca_name", ")", ...
Get the certificate path or content ca_name name of the CA as_text if true, return the certificate content instead of the path cacert_path absolute path to ca certificates root directory CLI Example: .. code-block:: bash salt '*' tls.get_ca test_ca as_text=False c...
[ "Get", "the", "certificate", "path", "or", "content" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L425-L450
train
saltstack/salt
salt/modules/tls.py
get_ca_signed_key
def get_ca_signed_key(ca_name, CN='localhost', as_text=False, cacert_path=None, key_filename=None): ''' Get the certificate path or content ca_name name of the CA CN common name of the certificate ...
python
def get_ca_signed_key(ca_name, CN='localhost', as_text=False, cacert_path=None, key_filename=None): ''' Get the certificate path or content ca_name name of the CA CN common name of the certificate ...
[ "def", "get_ca_signed_key", "(", "ca_name", ",", "CN", "=", "'localhost'", ",", "as_text", "=", "False", ",", "cacert_path", "=", "None", ",", "key_filename", "=", "None", ")", ":", "set_ca_path", "(", "cacert_path", ")", "if", "not", "key_filename", ":", ...
Get the certificate path or content ca_name name of the CA CN common name of the certificate as_text if true, return the certificate content instead of the path cacert_path absolute path to certificates root directory key_filename alternative filename for the...
[ "Get", "the", "certificate", "path", "or", "content" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L498-L544
train