partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | enter_maintenance_mode | 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" | salt/cloud/clouds/vmware.py | 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):
'''
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... | [
"To",
"put",
"the",
"specified",
"host",
"system",
"in",
"maintenance",
"mode",
"in",
"this",
"VMware",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3651-L3691 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_folder | 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... | salt/cloud/clouds/vmware.py | 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):
'''
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... | [
"Create",
"the",
"specified",
"folder",
"path",
"in",
"this",
"VMware",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3737-L3811 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_snapshot | 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
``... | salt/cloud/clouds/vmware.py | 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):
'''
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... | [
"Create",
"a",
"snapshot",
"of",
"the",
"specified",
"virtual",
"machine",
"in",
"this",
"VMware",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3814-L3889 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | revert_to_snapshot | 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... | salt/cloud/clouds/vmware.py | 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):
'''
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... | [
"Revert",
"virtual",
"machine",
"to",
"it",
"s",
"current",
"snapshot",
".",
"If",
"no",
"snapshot",
"exists",
"the",
"state",
"of",
"the",
"virtual",
"machine",
"remains",
"unchanged"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3892-L3960 | [
"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"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_snapshot | 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"] | salt/cloud/clouds/vmware.py | 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):
'''
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... | [
"Remove",
"a",
"snapshot",
"of",
"the",
"specified",
"virtual",
"machine",
"in",
"this",
"VMware",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3963-L4018 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_all_snapshots | 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`... | salt/cloud/clouds/vmware.py | 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):
'''
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
... | [
"Remove",
"all",
"the",
"snapshots",
"present",
"for",
"the",
"specified",
"virtual",
"machine",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4021-L4060 | [
"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.'",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | convert_to_template | Convert the specified virtual machine to template.
CLI Example:
.. code-block:: bash
salt-cloud -a convert_to_template vmname | salt/cloud/clouds/vmware.py | 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):
'''
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... | [
"Convert",
"the",
"specified",
"virtual",
"machine",
"to",
"template",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4063-L4099 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | add_host | 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... | salt/cloud/clouds/vmware.py | 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):
'''
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... | [
"Add",
"a",
"host",
"system",
"to",
"the",
"specified",
"cluster",
"or",
"datacenter",
"in",
"this",
"VMware",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4102-L4265 | [
"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",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_host | Remove the specified host system from this VMware environment
CLI Example:
.. code-block:: bash
salt-cloud -f remove_host my-vmware-config host="myHostSystemName" | salt/cloud/clouds/vmware.py | 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):
'''
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... | [
"Remove",
"the",
"specified",
"host",
"system",
"from",
"this",
"VMware",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4268-L4317 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | connect_host | Connect the specified host system in this VMware environment
CLI Example:
.. code-block:: bash
salt-cloud -f connect_host my-vmware-config host="myHostSystemName" | salt/cloud/clouds/vmware.py | 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):
'''
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... | [
"Connect",
"the",
"specified",
"host",
"system",
"in",
"this",
"VMware",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4320-L4367 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_datastore_cluster | 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" | salt/cloud/clouds/vmware.py | 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):
'''
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"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4491-L4550 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | shutdown_host | 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... | salt/cloud/clouds/vmware.py | 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):
'''
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,
... | [
"Shut",
"down",
"the",
"specified",
"host",
"system",
"in",
"this",
"VMware",
"environment"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L4553-L4620 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | 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... | salt/states/zabbix_usermacro.py | 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):
'''
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... | [
"Creates",
"a",
"new",
"usermacro",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_usermacro.py#L22-L152 | [
"def",
"present",
"(",
"name",
",",
"value",
",",
"hostid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"connection_args",
"=",
"{",
"}",
"if",
"'_connection_user'",
"in",
"kwargs",
":",
"connection_args",
"[",
"'_connection_user'",
"]",
"=",
"kwargs",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | absent | 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... | salt/states/zabbix_usermacro.py | 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):
'''
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... | [
"Ensures",
"that",
"the",
"mediatype",
"does",
"not",
"exist",
"eventually",
"deletes",
"the",
"mediatype",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zabbix_usermacro.py#L155-L237 | [
"def",
"absent",
"(",
"name",
",",
"hostid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"connection_args",
"=",
"{",
"}",
"if",
"'_connection_user'",
"in",
"kwargs",
":",
"connection_args",
"[",
"'_connection_user'",
"]",
"=",
"kwargs",
"[",
"'_connec... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | diff | 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... | salt/runners/survey.py | 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):
'''
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 ... | [
"Return",
"the",
"DIFFERENCE",
"of",
"the",
"result",
"sets",
"returned",
"by",
"each",
"matching",
"minion",
"pool"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/survey.py#L58-L132 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_pool_results | 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... | salt/runners/survey.py | 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):
'''
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.
... | [
"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",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/survey.py#L135-L188 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | downloaded | 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... | salt/states/artifactory.py | 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):
'''
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... | [
"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... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/artifactory.py#L15-L107 | [
"def",
"downloaded",
"(",
"name",
",",
"artifact",
",",
"target_dir",
"=",
"'/tmp'",
",",
"target_file",
"=",
"None",
",",
"use_literal_group_id",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"\" ======================== STATE: artifactory.downloaded (name: %s) \... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sync_all | 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 | salt/states/saltutil.py | 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):
'''
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... | [
"Performs",
"the",
"same",
"task",
"as",
"saltutil",
".",
"sync_all",
"module",
"See",
":",
"mod",
":",
"saltutil",
"module",
"for",
"full",
"list",
"of",
"options",
"<salt",
".",
"modules",
".",
"saltutil",
">"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/saltutil.py#L54-L87 | [
"def",
"sync_all",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"if",
"__opts__",
"[",
"'test'",
"]",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _query | 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. | salt/modules/random_org.py | 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):
'''
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... | [
"Slack",
"object",
"method",
"function",
"to",
"construct",
"and",
"execute",
"on",
"the",
"API",
"URL",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/random_org.py#L81-L123 | [
"def",
"_query",
"(",
"api_version",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"{",
"}",
"ret",
"=",
"{",
"'res'",
":",
"True",
"}",
"api_url",
"=",
"'https://api.random.org/'",
"base_url",
"=",
"_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | getUsage | 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... | salt/modules/random_org.py | 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):
'''
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
... | [
"Show",
"current",
"usages",
"statistics"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/random_org.py#L126-L177 | [
"def",
"getUsage",
"(",
"api_key",
"=",
"None",
",",
"api_version",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'res'",
":",
"True",
"}",
"if",
"not",
"api_key",
"or",
"not",
"api_version",
":",
"try",
":",
"options",
"=",
"__salt__",
"[",
"'config.option... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | generateIntegers | 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
... | salt/modules/random_org.py | 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):
'''
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... | [
"Generate",
"random",
"integers"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/random_org.py#L180-L294 | [
"def",
"generateIntegers",
"(",
"api_key",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'res'",
":",
"True",
"}",
"if",
"not",
"api_key",
"or",
"not",
"api_version",
":",
"try",
":",
"options",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | OrderedSet.add | 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. | salt/utils/oset.py | 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):
"""
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)
... | [
"Add",
"key",
"as",
"an",
"item",
"to",
"this",
"OrderedSet",
"then",
"return",
"its",
"index",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/oset.py#L110-L120 | [
"def",
"add",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"not",
"in",
"self",
".",
"map",
":",
"self",
".",
"map",
"[",
"key",
"]",
"=",
"len",
"(",
"self",
".",
"items",
")",
"self",
".",
"items",
".",
"append",
"(",
"key",
")",
"return... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | OrderedSet.index | 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. | salt/utils/oset.py | 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):
"""
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... | [
"Get",
"the",
"index",
"of",
"a",
"given",
"entry",
"raising",
"an",
"IndexError",
"if",
"it",
"s",
"not",
"present",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/oset.py#L136-L146 | [
"def",
"index",
"(",
"self",
",",
"key",
")",
":",
"if",
"is_iterable",
"(",
"key",
")",
":",
"return",
"[",
"self",
".",
"index",
"(",
"subkey",
")",
"for",
"subkey",
"in",
"key",
"]",
"return",
"self",
".",
"map",
"[",
"key",
"]"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | OrderedSet.discard | 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. | salt/utils/oset.py | 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):
"""
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]
... | [
"Remove",
"an",
"element",
".",
"Do",
"not",
"raise",
"an",
"exception",
"if",
"absent",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/oset.py#L162-L175 | [
"def",
"discard",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
":",
"i",
"=",
"self",
".",
"map",
"[",
"key",
"]",
"del",
"self",
".",
"items",
"[",
"i",
"]",
"del",
"self",
".",
"map",
"[",
"key",
"]",
"for",
"k",
",",
"v"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | .. 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... | salt/runners/git_pillar.py | 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):
'''
.. 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
... | [
"..",
"versionadded",
"::",
"2014",
".",
"1",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/git_pillar.py#L18-L104 | [
"def",
"update",
"(",
"branch",
"=",
"None",
",",
"repo",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"ext_pillar",
"in",
"__opts__",
".",
"get",
"(",
"'ext_pillar'",
",",
"[",
"]",
")",
":",
"pillar_type",
"=",
"next",
"(",
"iter",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | held | Set package in 'hold' state, meaning it will not be upgraded.
name
The name of the package, e.g., 'tmux' | salt/states/aptpkg.py | 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):
'''
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:
... | [
"Set",
"package",
"in",
"hold",
"state",
"meaning",
"it",
"will",
"not",
"be",
"upgraded",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/aptpkg.py#L30-L58 | [
"def",
"held",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
"}",
"state",
"=",
"__salt__",
"[",
"'pkg.get_selections'",
"]",
"(",
"pattern"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _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 enabled daemons via $pkg_scrip... | salt/modules/openbsdservice.py | 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():
'''
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... | [
"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",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdservice.py#L159-L211 | [
"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'",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | available | .. versionadded:: 2014.7.0
Returns ``True`` if the specified service is available, otherwise returns
``False``.
CLI Example:
.. code-block:: bash
salt '*' service.available sshd | salt/modules/openbsdservice.py | 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):
'''
.. 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... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdservice.py#L214-L228 | [
"def",
"available",
"(",
"name",
")",
":",
"path",
"=",
"'/etc/rc.d/{0}'",
".",
"format",
"(",
"name",
")",
"return",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
"and",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"X_OK",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_all | .. versionadded:: 2014.7.0
Return all available boot services
CLI Example:
.. code-block:: bash
salt '*' service.get_all | salt/modules/openbsdservice.py | 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():
'''
.. 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 ... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdservice.py#L248-L267 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | 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 | salt/modules/openbsdservice.py | 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():
'''
.. 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:
... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openbsdservice.py#L304-L320 | [
"def",
"get_disabled",
"(",
")",
":",
"services",
"=",
"[",
"]",
"for",
"daemon",
",",
"is_enabled",
"in",
"six",
".",
"iteritems",
"(",
"_get_rc",
"(",
")",
")",
":",
"if",
"not",
"is_enabled",
":",
"services",
".",
"append",
"(",
"daemon",
")",
"re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | 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... | salt/states/mysql_user.py | 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,
**connection_args):
'''
Ensure that the named user is present with the specified propertie... | [
"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",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mysql_user.py#L69-L228 | [
"def",
"present",
"(",
"name",
",",
"host",
"=",
"'localhost'",
",",
"password",
"=",
"None",
",",
"password_hash",
"=",
"None",
",",
"allow_passwordless",
"=",
"False",
",",
"unix_socket",
"=",
"False",
",",
"password_column",
"=",
"None",
",",
"*",
"*",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_option | 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... | salt/modules/ini_manage.py | 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='='):
'''
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 ... | [
"Edit",
"an",
"ini",
"file",
"replacing",
"one",
"or",
"more",
"sections",
".",
"Returns",
"a",
"dictionary",
"containing",
"the",
"changes",
"made",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L46-L88 | [
"def",
"set_option",
"(",
"file_name",
",",
"sections",
"=",
"None",
",",
"separator",
"=",
"'='",
")",
":",
"sections",
"=",
"sections",
"or",
"{",
"}",
"changes",
"=",
"{",
"}",
"inifile",
"=",
"_Ini",
".",
"get_ini_file",
"(",
"file_name",
",",
"sep... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_option | 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... | salt/modules/ini_manage.py | 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='='):
'''
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... | [
"Get",
"value",
"of",
"a",
"key",
"from",
"a",
"section",
"in",
"an",
"ini",
"file",
".",
"Returns",
"None",
"if",
"no",
"matching",
"key",
"was",
"found",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L91-L118 | [
"def",
"get_option",
"(",
"file_name",
",",
"section",
",",
"option",
",",
"separator",
"=",
"'='",
")",
":",
"inifile",
"=",
"_Ini",
".",
"get_ini_file",
"(",
"file_name",
",",
"separator",
"=",
"separator",
")",
"if",
"section",
":",
"try",
":",
"retur... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_option | 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... | salt/modules/ini_manage.py | 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='='):
'''
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()
... | [
"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",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L121-L148 | [
"def",
"remove_option",
"(",
"file_name",
",",
"section",
",",
"option",
",",
"separator",
"=",
"'='",
")",
":",
"inifile",
"=",
"_Ini",
".",
"get_ini_file",
"(",
"file_name",
",",
"separator",
"=",
"separator",
")",
"if",
"isinstance",
"(",
"inifile",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_section | 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... | salt/modules/ini_manage.py | 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='='):
'''
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()
... | [
"Retrieve",
"a",
"section",
"from",
"an",
"ini",
"file",
".",
"Returns",
"the",
"section",
"as",
"dictionary",
".",
"If",
"the",
"section",
"is",
"not",
"found",
"an",
"empty",
"dictionary",
"is",
"returned",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L151-L176 | [
"def",
"get_section",
"(",
"file_name",
",",
"section",
",",
"separator",
"=",
"'='",
")",
":",
"inifile",
"=",
"_Ini",
".",
"get_ini_file",
"(",
"file_name",
",",
"separator",
"=",
"separator",
")",
"ret",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"i... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_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... | salt/modules/ini_manage.py | 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='='):
'''
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', '... | [
"Remove",
"a",
"section",
"in",
"an",
"ini",
"file",
".",
"Returns",
"the",
"removed",
"section",
"as",
"dictionary",
"or",
"None",
"if",
"nothing",
"was",
"removed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L179-L207 | [
"def",
"remove_section",
"(",
"file_name",
",",
"section",
",",
"separator",
"=",
"'='",
")",
":",
"inifile",
"=",
"_Ini",
".",
"get_ini_file",
"(",
"file_name",
",",
"separator",
"=",
"separator",
")",
"if",
"section",
"in",
"inifile",
":",
"section",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_ini | 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... | salt/modules/ini_manage.py | 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='='):
'''
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... | [
"Retrieve",
"whole",
"structure",
"from",
"an",
"ini",
"file",
"and",
"return",
"it",
"as",
"dictionary",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ini_manage.py#L210-L245 | [
"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",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | render | Render the python module's components
:rtype: string | salt/renderers/py.py | 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):
'''
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... | [
"Render",
"the",
"python",
"module",
"s",
"components"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/py.py#L123-L153 | [
"def",
"render",
"(",
"template",
",",
"saltenv",
"=",
"'base'",
",",
"sls",
"=",
"''",
",",
"tmplpath",
"=",
"None",
",",
"*",
"*",
"kws",
")",
":",
"template",
"=",
"tmplpath",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"template",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | 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 ... | salt/states/rabbitmq_vhost.py | 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):
'''
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
... | [
"Ensure",
"the",
"RabbitMQ",
"VHost",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/rabbitmq_vhost.py#L35-L93 | [
"def",
"present",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"'changes'",
":",
"{",
"}",
"}",
"vhost_exists",
"=",
"__salt__",
"[",
"'rabbitmq.vhost_exists'",
"]",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | property_present | properties = {} | salt/states/dracr.py | 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):
'''
properties = {}
'''
ret = {'name': host,
'context': {'Host': host},
'result': True,
'changes': {},
'comment': ''}
if host is None:
output =... | [
"properties",
"=",
"{}"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/dracr.py#L41-L96 | [
"def",
"property_present",
"(",
"properties",
",",
"admin_username",
"=",
"'root'",
",",
"admin_password",
"=",
"'calvin'",
",",
"host",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"host",
",",
"'context'",
":",
"{",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _run_svn | 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 ... | salt/modules/svn.py | 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):
'''
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 ... | [
"Execute",
"svn",
"return",
"the",
"output",
"of",
"the",
"command"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/svn.py#L30-L73 | [
"def",
"_run_svn",
"(",
"cmd",
",",
"cwd",
",",
"user",
",",
"username",
",",
"password",
",",
"opts",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"[",
"'svn'",
",",
"'--non-interactive'",
",",
"cmd",
"]",
"options",
"=",
"list",
"(",
"opts",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | info | 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... | salt/modules/svn.py | 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'):
'''
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... | [
"Display",
"the",
"Subversion",
"information",
"from",
"the",
"checkout",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/svn.py#L76-L130 | [
"def",
"info",
"(",
"cwd",
",",
"targets",
"=",
"None",
",",
"user",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"fmt",
"=",
"'str'",
")",
":",
"opts",
"=",
"list",
"(",
")",
"if",
"fmt",
"==",
"'xml'",
":",
"o... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | checkout | 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... | salt/modules/svn.py | 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):
'''
Download a working copy of the remote Subversion repository
directory or file
cwd
The path to the Subversion repository
... | [
"Download",
"a",
"working",
"copy",
"of",
"the",
"remote",
"Subversion",
"repository",
"directory",
"or",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/svn.py#L133-L174 | [
"def",
"checkout",
"(",
"cwd",
",",
"remote",
",",
"target",
"=",
"None",
",",
"user",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"*",
"opts",
")",
":",
"opts",
"+=",
"(",
"remote",
",",
")",
"if",
"target",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | 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... | salt/modules/svn.py | 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):
'''
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... | [
"Update",
"the",
"current",
"directory",
"files",
"or",
"directories",
"from",
"the",
"remote",
"Subversion",
"repository"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/svn.py#L216-L247 | [
"def",
"update",
"(",
"cwd",
",",
"targets",
"=",
"None",
",",
"user",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"*",
"opts",
")",
":",
"if",
"targets",
":",
"opts",
"+=",
"tuple",
"(",
"salt",
".",
"utils",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | export | 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... | salt/modules/svn.py | 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):
'''
Create an unversioned copy of a tree.
cwd
The path to the Subversion repository
remote : None
URL and ... | [
"Create",
"an",
"unversioned",
"copy",
"of",
"a",
"tree",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/svn.py#L438-L481 | [
"def",
"export",
"(",
"cwd",
",",
"remote",
",",
"target",
"=",
"None",
",",
"user",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"revision",
"=",
"'HEAD'",
",",
"*",
"opts",
")",
":",
"opts",
"+=",
"(",
"remote",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | to_bytes | Given bytes, bytearray, str, or unicode (python 2), return bytes (str for
python 2) | salt/utils/stringutils.py | 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'):
'''
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... | [
"Given",
"bytes",
"bytearray",
"str",
"or",
"unicode",
"(",
"python",
"2",
")",
"return",
"bytes",
"(",
"str",
"for",
"python",
"2",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L30-L63 | [
"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__",
")"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | to_str | Given str, bytes, bytearray, or unicode (py2), return str | salt/utils/stringutils.py | 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):
'''
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... | [
"Given",
"str",
"bytes",
"bytearray",
"or",
"unicode",
"(",
"py2",
")",
"return",
"str"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L66-L118 | [
"def",
"to_str",
"(",
"s",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"'strict'",
",",
"normalize",
"=",
"False",
")",
":",
"def",
"_normalize",
"(",
"s",
")",
":",
"try",
":",
"return",
"unicodedata",
".",
"normalize",
"(",
"'NFC'",
",",
"s",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | to_bool | Convert the string name of a boolean to that boolean value. | salt/utils/stringutils.py | 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):
'''
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 | [
"Convert",
"the",
"string",
"name",
"of",
"a",
"boolean",
"to",
"that",
"boolean",
"value",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L182-L192 | [
"def",
"to_bool",
"(",
"text",
")",
":",
"downcased_text",
"=",
"six",
".",
"text_type",
"(",
"text",
")",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"downcased_text",
"==",
"'false'",
":",
"return",
"False",
"elif",
"downcased_text",
"==",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_quoted | Return a single or double quote, if a string is wrapped in extra quotes.
Otherwise return an empty string. | salt/utils/stringutils.py | 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):
'''
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]... | [
"Return",
"a",
"single",
"or",
"double",
"quote",
"if",
"a",
"string",
"is",
"wrapped",
"in",
"extra",
"quotes",
".",
"Otherwise",
"return",
"an",
"empty",
"string",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L204-L214 | [
"def",
"is_quoted",
"(",
"value",
")",
":",
"ret",
"=",
"''",
"if",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
"and",
"value",
"[",
"0",
"]",
"==",
"value",
"[",
"-",
"1",
"]",
"and",
"value",
".",
"startswith",
"(",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | is_binary | Detects if the passed string of data is binary or text | salt/utils/stringutils.py | 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):
'''
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:
... | [
"Detects",
"if",
"the",
"passed",
"string",
"of",
"data",
"is",
"binary",
"or",
"text"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L238-L272 | [
"def",
"is_binary",
"(",
"data",
")",
":",
"if",
"not",
"data",
"or",
"not",
"isinstance",
"(",
"data",
",",
"(",
"six",
".",
"string_types",
",",
"six",
".",
"binary_type",
")",
")",
":",
"return",
"False",
"if",
"isinstance",
"(",
"data",
",",
"six... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | human_to_bytes | 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 | salt/utils/stringutils.py | 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):
'''
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)
... | [
"Given",
"a",
"human",
"-",
"readable",
"byte",
"string",
"(",
"e",
".",
"g",
".",
"2G",
"30M",
")",
"return",
"the",
"number",
"of",
"bytes",
".",
"Will",
"return",
"0",
"if",
"the",
"argument",
"has",
"unexpected",
"form",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L289-L313 | [
"def",
"human_to_bytes",
"(",
"size",
")",
":",
"sbytes",
"=",
"size",
"[",
":",
"-",
"1",
"]",
"unit",
"=",
"size",
"[",
"-",
"1",
"]",
"if",
"sbytes",
".",
"isdigit",
"(",
")",
":",
"sbytes",
"=",
"int",
"(",
"sbytes",
")",
"if",
"unit",
"=="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | build_whitespace_split_regex | 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... | salt/utils/stringutils.py | 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):
'''
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
>>> ... | [
"Create",
"a",
"regular",
"expression",
"at",
"runtime",
"which",
"should",
"match",
"ignoring",
"the",
"addition",
"or",
"deletion",
"of",
"white",
"space",
"or",
"line",
"breaks",
"unless",
"between",
"commas"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L316-L361 | [
"def",
"build_whitespace_split_regex",
"(",
"text",
")",
":",
"def",
"__build_parts",
"(",
"text",
")",
":",
"lexer",
"=",
"shlex",
".",
"shlex",
"(",
"text",
")",
"lexer",
".",
"whitespace_split",
"=",
"True",
"lexer",
".",
"commenters",
"=",
"''",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | expr_match | 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... | salt/utils/stringutils.py | 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):
'''
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... | [
"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... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L364-L389 | [
"def",
"expr_match",
"(",
"line",
",",
"expr",
")",
":",
"try",
":",
"if",
"fnmatch",
".",
"fnmatch",
"(",
"line",
",",
"expr",
")",
":",
"return",
"True",
"try",
":",
"if",
"re",
".",
"match",
"(",
"r'\\A{0}\\Z'",
".",
"format",
"(",
"expr",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_whitelist_blacklist | 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... | salt/utils/stringutils.py | 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):
'''
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
... | [
"Check",
"a",
"whitelist",
"and",
"/",
"or",
"blacklist",
"to",
"see",
"if",
"the",
"value",
"matches",
"it",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L393-L454 | [
"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",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_include_exclude | 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
... | salt/utils/stringutils.py | 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):
'''
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
... | [
"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",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L457-L510 | [
"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",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | print_cli | Wrapper around print() that suppresses tracebacks on broken pipes (i.e.
when salt output is piped to less and less is stopped prematurely). | salt/utils/stringutils.py | 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):
'''
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... | [
"Wrapper",
"around",
"print",
"()",
"that",
"suppresses",
"tracebacks",
"on",
"broken",
"pipes",
"(",
"i",
".",
"e",
".",
"when",
"salt",
"output",
"is",
"piped",
"to",
"less",
"and",
"less",
"is",
"stopped",
"prematurely",
")",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L513-L537 | [
"def",
"print_cli",
"(",
"msg",
",",
"retries",
"=",
"10",
",",
"step",
"=",
"0.01",
")",
":",
"while",
"retries",
":",
"try",
":",
"try",
":",
"print",
"(",
"msg",
")",
"except",
"UnicodeEncodeError",
":",
"print",
"(",
"msg",
".",
"encode",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_context | Returns debugging context around a line in a given string
Returns:: string | salt/utils/stringutils.py | 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):
'''
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... | [
"Returns",
"debugging",
"context",
"around",
"a",
"line",
"in",
"a",
"given",
"string"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L540-L572 | [
"def",
"get_context",
"(",
"template",
",",
"line",
",",
"num_lines",
"=",
"5",
",",
"marker",
"=",
"None",
")",
":",
"template_lines",
"=",
"template",
".",
"splitlines",
"(",
")",
"num_template_lines",
"=",
"len",
"(",
"template_lines",
")",
"# In test mod... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_diff | 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. | salt/utils/stringutils.py | 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):
'''
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... | [
"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... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L575-L590 | [
"def",
"get_diff",
"(",
"a",
",",
"b",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"encoding",
"=",
"(",
"'utf-8'",
",",
"'latin-1'",
",",
"__salt_system_encoding__",
")",
"# Late import to avoid circular import",
"import",
"salt",
".",
"utils",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | camel_to_snake_case | 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 | salt/utils/stringutils.py | 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):
'''
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",
"-",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L594-L609 | [
"def",
"camel_to_snake_case",
"(",
"camel_input",
")",
":",
"res",
"=",
"camel_input",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"for",
"i",
",",
"letter",
"in",
"enumerate",
"(",
"camel_input",
"[",
"1",
":",
"]",
",",
"1",
")",
":",
"if",
"letter",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | snake_to_camel_case | 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... | salt/utils/stringutils.py | 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):
'''
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... | [
"Converts",
"snake_case",
"to",
"camelCase",
"(",
"or",
"CamelCase",
"if",
"uppercamel",
"is",
"True",
")",
".",
"Inspired",
"by",
"https",
":",
"//",
"codereview",
".",
"stackexchange",
".",
"com",
"/",
"questions",
"/",
"85311",
"/",
"transform",
"-",
"s... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/stringutils.py#L613-L626 | [
"def",
"snake_to_camel_case",
"(",
"snake_input",
",",
"uppercamel",
"=",
"False",
")",
":",
"words",
"=",
"snake_input",
".",
"split",
"(",
"'_'",
")",
"if",
"uppercamel",
":",
"words",
"[",
"0",
"]",
"=",
"words",
"[",
"0",
"]",
".",
"capitalize",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_ring | Queries the specified network device for rx/tx ring parameter information
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_ring <devname> | salt/modules/ethtool.py | 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):
'''
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... | [
"Queries",
"the",
"specified",
"network",
"device",
"for",
"rx",
"/",
"tx",
"ring",
"parameter",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L85-L106 | [
"def",
"show_ring",
"(",
"devname",
")",
":",
"try",
":",
"ring",
"=",
"ethtool",
".",
"get_ringparam",
"(",
"devname",
")",
"except",
"IOError",
":",
"log",
".",
"error",
"(",
"'Ring parameters not supported on %s'",
",",
"devname",
")",
"return",
"'Not suppo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_coalesce | Queries the specified network device for coalescing information
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_coalesce <devname> | salt/modules/ethtool.py | 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):
'''
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... | [
"Queries",
"the",
"specified",
"network",
"device",
"for",
"coalescing",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L109-L130 | [
"def",
"show_coalesce",
"(",
"devname",
")",
":",
"try",
":",
"coalesce",
"=",
"ethtool",
".",
"get_coalesce",
"(",
"devname",
")",
"except",
"IOError",
":",
"log",
".",
"error",
"(",
"'Interrupt coalescing not supported on %s'",
",",
"devname",
")",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_driver | Queries the specified network device for associated driver information
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_driver <devname> | salt/modules/ethtool.py | 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):
'''
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... | [
"Queries",
"the",
"specified",
"network",
"device",
"for",
"associated",
"driver",
"information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L133-L161 | [
"def",
"show_driver",
"(",
"devname",
")",
":",
"try",
":",
"module",
"=",
"ethtool",
".",
"get_module",
"(",
"devname",
")",
"except",
"IOError",
":",
"log",
".",
"error",
"(",
"'Driver information not implemented on %s'",
",",
"devname",
")",
"return",
"'Not... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_ring | 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] | salt/modules/ethtool.py | 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):
'''
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... | [
"Changes",
"the",
"rx",
"/",
"tx",
"ring",
"parameters",
"of",
"the",
"specified",
"network",
"device"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L164-L196 | [
"def",
"set_ring",
"(",
"devname",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"ring",
"=",
"ethtool",
".",
"get_ringparam",
"(",
"devname",
")",
"except",
"IOError",
":",
"log",
".",
"error",
"(",
"'Ring parameters not supported on %s'",
",",
"devname",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_coalesce | 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... | salt/modules/ethtool.py | 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):
'''
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... | [
"Changes",
"the",
"coalescing",
"settings",
"of",
"the",
"specified",
"network",
"device"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L199-L235 | [
"def",
"set_coalesce",
"(",
"devname",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"coalesce",
"=",
"ethtool",
".",
"get_coalesce",
"(",
"devname",
")",
"except",
"IOError",
":",
"log",
".",
"error",
"(",
"'Interrupt coalescing not supported on %s'",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_offload | Queries the specified network device for the state of protocol offload and other features
CLI Example:
.. code-block:: bash
salt '*' ethtool.show_offload <devname> | salt/modules/ethtool.py | 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):
'''
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:
... | [
"Queries",
"the",
"specified",
"network",
"device",
"for",
"the",
"state",
"of",
"protocol",
"offload",
"and",
"other",
"features"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L238-L276 | [
"def",
"show_offload",
"(",
"devname",
")",
":",
"try",
":",
"sg",
"=",
"ethtool",
".",
"get_sg",
"(",
"devname",
")",
"and",
"\"on\"",
"or",
"\"off\"",
"except",
"IOError",
":",
"sg",
"=",
"\"not supported\"",
"try",
":",
"tso",
"=",
"ethtool",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_offload | 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 | salt/modules/ethtool.py | 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):
'''
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 == '... | [
"Changes",
"the",
"offload",
"parameters",
"and",
"other",
"features",
"of",
"the",
"specified",
"network",
"device"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ethtool.py#L279-L298 | [
"def",
"set_offload",
"(",
"devname",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"param",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"param",
"==",
"'tcp_segmentation_offload'",
":",
"value",
"=",
"value",
"==",
"\"on\"",
"and",
"1... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _microtime | Return a Unix timestamp as a string of digits
:return: | salt/modules/tls.py | 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():
'''
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) | [
"Return",
"a",
"Unix",
"timestamp",
"as",
"a",
"string",
"of",
"digits",
":",
"return",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L164-L171 | [
"def",
"_microtime",
"(",
")",
":",
"val1",
",",
"val2",
"=",
"math",
".",
"modf",
"(",
"time",
".",
"time",
"(",
")",
")",
"val2",
"=",
"int",
"(",
"val2",
")",
"return",
"'{0:f}{1}'",
".",
"format",
"(",
"val1",
",",
"val2",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cert_base_path | 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 | salt/modules/tls.py | 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):
'''
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... | [
"Return",
"the",
"base",
"path",
"for",
"certs",
"from",
"CLI",
"or",
"from",
"options"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L174-L195 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _new_serial | 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 | salt/modules/tls.py | 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):
'''
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... | [
"Return",
"a",
"serial",
"number",
"in",
"hex",
"using",
"os",
".",
"urandom",
"()",
"and",
"a",
"Unix",
"timestamp",
"in",
"microseconds",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L221-L255 | [
"def",
"_new_serial",
"(",
"ca_name",
")",
":",
"hashnum",
"=",
"int",
"(",
"binascii",
".",
"hexlify",
"(",
"b'_'",
".",
"join",
"(",
"(",
"salt",
".",
"utils",
".",
"stringutils",
".",
"to_bytes",
"(",
"_microtime",
"(",
")",
")",
",",
"os",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_basic_info | Get basic info to write out to the index.txt | salt/modules/tls.py | 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):
'''
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... | [
"Get",
"basic",
"info",
"to",
"write",
"out",
"to",
"the",
"index",
".",
"txt"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L262-L286 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _write_cert_to_database | 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 | salt/modules/tls.py | 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'):
'''
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... | [
"write",
"out",
"the",
"index",
".",
"txt",
"database",
"file",
"in",
"the",
"appropriate",
"directory",
"to",
"track",
"certificates"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L289-L314 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | maybe_fix_ssl_version | 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... | salt/modules/tls.py | 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):
'''
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... | [
"Check",
"that",
"the",
"X509",
"version",
"is",
"correct",
"(",
"was",
"incorrectly",
"set",
"in",
"previous",
"salt",
"versions",
")",
".",
"This",
"will",
"fix",
"the",
"version",
"if",
"needed",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L317-L382 | [
"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... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ca_exists | 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 '*... | salt/modules/tls.py | 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):
'''
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:... | [
"Verify",
"whether",
"a",
"Certificate",
"Authority",
"(",
"CA",
")",
"already",
"exists"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L385-L417 | [
"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",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_ca | 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... | salt/modules/tls.py | 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):
'''
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... | [
"Get",
"the",
"certificate",
"path",
"or",
"content"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L425-L450 | [
"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",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_ca_signed_key | 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... | salt/modules/tls.py | 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):
'''
Get the certificate path or content
ca_name
name of the CA
CN
common name of the certificate
... | [
"Get",
"the",
"certificate",
"path",
"or",
"content"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L498-L544 | [
"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",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | validate | .. versionadded:: Neon
Validate a certificate against a given CA/CRL.
cert
path to the certifiate PEM file or string
ca_name
name of the CA
crl_file
full path to the CRL file | salt/modules/tls.py | def validate(cert, ca_name, crl_file):
'''
.. versionadded:: Neon
Validate a certificate against a given CA/CRL.
cert
path to the certifiate PEM file or string
ca_name
name of the CA
crl_file
full path to the CRL file
'''
store = OpenSSL.crypto.X509Store()
... | def validate(cert, ca_name, crl_file):
'''
.. versionadded:: Neon
Validate a certificate against a given CA/CRL.
cert
path to the certifiate PEM file or string
ca_name
name of the CA
crl_file
full path to the CRL file
'''
store = OpenSSL.crypto.X509Store()
... | [
"..",
"versionadded",
"::",
"Neon"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L566-L609 | [
"def",
"validate",
"(",
"cert",
",",
"ca_name",
",",
"crl_file",
")",
":",
"store",
"=",
"OpenSSL",
".",
"crypto",
".",
"X509Store",
"(",
")",
"cert_obj",
"=",
"_read_cert",
"(",
"cert",
")",
"if",
"cert_obj",
"is",
"None",
":",
"raise",
"CommandExecutio... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_expiration_date | Returns a datetime.datetime object | salt/modules/tls.py | def _get_expiration_date(cert):
'''
Returns a datetime.datetime object
'''
cert_obj = _read_cert(cert)
if cert_obj is None:
raise CommandExecutionError(
'Failed to read cert from {0}, see log for details'.format(cert)
)
return datetime.strptime(
salt.utils.s... | def _get_expiration_date(cert):
'''
Returns a datetime.datetime object
'''
cert_obj = _read_cert(cert)
if cert_obj is None:
raise CommandExecutionError(
'Failed to read cert from {0}, see log for details'.format(cert)
)
return datetime.strptime(
salt.utils.s... | [
"Returns",
"a",
"datetime",
".",
"datetime",
"object"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L612-L626 | [
"def",
"_get_expiration_date",
"(",
"cert",
")",
":",
"cert_obj",
"=",
"_read_cert",
"(",
"cert",
")",
"if",
"cert_obj",
"is",
"None",
":",
"raise",
"CommandExecutionError",
"(",
"'Failed to read cert from {0}, see log for details'",
".",
"format",
"(",
"cert",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_ca | Create a Certificate Authority (CA)
ca_name
name of the CA
bits
number of RSA key bits, default is 2048
days
number of days the CA will be valid, default is 365
CN
common name in the request, default is "localhost"
C
country, default is "US"
ST
st... | salt/modules/tls.py | def create_ca(ca_name,
bits=2048,
days=365,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='SaltStack',
OU=None,
emailAddress=None,
fixmode=False,
cacert_pa... | def create_ca(ca_name,
bits=2048,
days=365,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='SaltStack',
OU=None,
emailAddress=None,
fixmode=False,
cacert_pa... | [
"Create",
"a",
"Certificate",
"Authority",
"(",
"CA",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L675-L870 | [
"def",
"create_ca",
"(",
"ca_name",
",",
"bits",
"=",
"2048",
",",
"days",
"=",
"365",
",",
"CN",
"=",
"'localhost'",
",",
"C",
"=",
"'US'",
",",
"ST",
"=",
"'Utah'",
",",
"L",
"=",
"'Salt Lake City'",
",",
"O",
"=",
"'SaltStack'",
",",
"OU",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_extensions | Fetch X509 and CSR extension definitions from tls:extensions:
(common|server|client) or set them to standard defaults.
.. versionadded:: 2015.8.0
cert_type:
The type of certificate such as ``server`` or ``client``.
CLI Example:
.. code-block:: bash
salt '*' tls.get_extensions cl... | salt/modules/tls.py | def get_extensions(cert_type):
'''
Fetch X509 and CSR extension definitions from tls:extensions:
(common|server|client) or set them to standard defaults.
.. versionadded:: 2015.8.0
cert_type:
The type of certificate such as ``server`` or ``client``.
CLI Example:
.. code-block:: b... | def get_extensions(cert_type):
'''
Fetch X509 and CSR extension definitions from tls:extensions:
(common|server|client) or set them to standard defaults.
.. versionadded:: 2015.8.0
cert_type:
The type of certificate such as ``server`` or ``client``.
CLI Example:
.. code-block:: b... | [
"Fetch",
"X509",
"and",
"CSR",
"extension",
"definitions",
"from",
"tls",
":",
"extensions",
":",
"(",
"common|server|client",
")",
"or",
"set",
"them",
"to",
"standard",
"defaults",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L873-L961 | [
"def",
"get_extensions",
"(",
"cert_type",
")",
":",
"assert",
"X509_EXT_ENABLED",
",",
"(",
"'X509 extensions are not supported in '",
"'pyOpenSSL prior to version 0.15.1. Your '",
"'version: {0}'",
".",
"format",
"(",
"OpenSSL_version",
")",
")",
"ext",
"=",
"{",
"}",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_csr | Create a Certificate Signing Request (CSR) for a
particular Certificate Authority (CA)
ca_name
name of the CA
bits
number of RSA key bits, default is 2048
CN
common name in the request, default is "localhost"
C
country, default is "US"
ST
state, default i... | salt/modules/tls.py | def create_csr(ca_name,
bits=2048,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='SaltStack',
OU=None,
emailAddress=None,
subjectAltName=None,
cacert_path=None... | def create_csr(ca_name,
bits=2048,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='SaltStack',
OU=None,
emailAddress=None,
subjectAltName=None,
cacert_path=None... | [
"Create",
"a",
"Certificate",
"Signing",
"Request",
"(",
"CSR",
")",
"for",
"a",
"particular",
"Certificate",
"Authority",
"(",
"CA",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L964-L1193 | [
"def",
"create_csr",
"(",
"ca_name",
",",
"bits",
"=",
"2048",
",",
"CN",
"=",
"'localhost'",
",",
"C",
"=",
"'US'",
",",
"ST",
"=",
"'Utah'",
",",
"L",
"=",
"'Salt Lake City'",
",",
"O",
"=",
"'SaltStack'",
",",
"OU",
"=",
"None",
",",
"emailAddress... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_self_signed_cert | Create a Self-Signed Certificate (CERT)
tls_dir
location appended to the ca.cert_base_path, default is 'tls'
bits
number of RSA key bits, default is 2048
CN
common name in the request, default is "localhost"
C
country, default is "US"
ST
state, default is "Ut... | salt/modules/tls.py | def create_self_signed_cert(tls_dir='tls',
bits=2048,
days=365,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='Sa... | def create_self_signed_cert(tls_dir='tls',
bits=2048,
days=365,
CN='localhost',
C='US',
ST='Utah',
L='Salt Lake City',
O='Sa... | [
"Create",
"a",
"Self",
"-",
"Signed",
"Certificate",
"(",
"CERT",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1196-L1348 | [
"def",
"create_self_signed_cert",
"(",
"tls_dir",
"=",
"'tls'",
",",
"bits",
"=",
"2048",
",",
"days",
"=",
"365",
",",
"CN",
"=",
"'localhost'",
",",
"C",
"=",
"'US'",
",",
"ST",
"=",
"'Utah'",
",",
"L",
"=",
"'Salt Lake City'",
",",
"O",
"=",
"'Sal... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_ca_signed_cert | Create a Certificate (CERT) signed by a named Certificate Authority (CA)
If the certificate file already exists, the function just returns assuming
the CERT already exists.
The CN *must* match an existing CSR generated by create_csr. If it
does not, this method does nothing.
ca_name
name ... | salt/modules/tls.py | def create_ca_signed_cert(ca_name,
CN,
days=365,
cacert_path=None,
ca_filename=None,
cert_path=None,
cert_filename=None,
digest='sha256',
... | def create_ca_signed_cert(ca_name,
CN,
days=365,
cacert_path=None,
ca_filename=None,
cert_path=None,
cert_filename=None,
digest='sha256',
... | [
"Create",
"a",
"Certificate",
"(",
"CERT",
")",
"signed",
"by",
"a",
"named",
"Certificate",
"Authority",
"(",
"CA",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1351-L1579 | [
"def",
"create_ca_signed_cert",
"(",
"ca_name",
",",
"CN",
",",
"days",
"=",
"365",
",",
"cacert_path",
"=",
"None",
",",
"ca_filename",
"=",
"None",
",",
"cert_path",
"=",
"None",
",",
"cert_filename",
"=",
"None",
",",
"digest",
"=",
"'sha256'",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_pkcs12 | Create a PKCS#12 browser certificate for a particular Certificate (CN)
ca_name
name of the CA
CN
common name matching the certificate signing request
passphrase
used to unlock the PKCS#12 certificate when loaded into the browser
cacert_path
absolute path to ca certificat... | salt/modules/tls.py | def create_pkcs12(ca_name, CN, passphrase='', cacert_path=None, replace=False):
'''
Create a PKCS#12 browser certificate for a particular Certificate (CN)
ca_name
name of the CA
CN
common name matching the certificate signing request
passphrase
used to unlock the PKCS#12 cer... | def create_pkcs12(ca_name, CN, passphrase='', cacert_path=None, replace=False):
'''
Create a PKCS#12 browser certificate for a particular Certificate (CN)
ca_name
name of the CA
CN
common name matching the certificate signing request
passphrase
used to unlock the PKCS#12 cer... | [
"Create",
"a",
"PKCS#12",
"browser",
"certificate",
"for",
"a",
"particular",
"Certificate",
"(",
"CN",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1582-L1673 | [
"def",
"create_pkcs12",
"(",
"ca_name",
",",
"CN",
",",
"passphrase",
"=",
"''",
",",
"cacert_path",
"=",
"None",
",",
"replace",
"=",
"False",
")",
":",
"set_ca_path",
"(",
"cacert_path",
")",
"if",
"not",
"replace",
"and",
"os",
".",
"path",
".",
"ex... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cert_info | Return information for a particular certificate
cert
path to the certifiate PEM file or string
.. versionchanged:: 2018.3.4
digest
what digest to use for fingerprinting
CLI Example:
.. code-block:: bash
salt '*' tls.cert_info /dir/for/certs/cert.pem | salt/modules/tls.py | def cert_info(cert, digest='sha256'):
'''
Return information for a particular certificate
cert
path to the certifiate PEM file or string
.. versionchanged:: 2018.3.4
digest
what digest to use for fingerprinting
CLI Example:
.. code-block:: bash
salt '*' tls.... | def cert_info(cert, digest='sha256'):
'''
Return information for a particular certificate
cert
path to the certifiate PEM file or string
.. versionchanged:: 2018.3.4
digest
what digest to use for fingerprinting
CLI Example:
.. code-block:: bash
salt '*' tls.... | [
"Return",
"information",
"for",
"a",
"particular",
"certificate"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1676-L1770 | [
"def",
"cert_info",
"(",
"cert",
",",
"digest",
"=",
"'sha256'",
")",
":",
"# format that OpenSSL returns dates in",
"date_fmt",
"=",
"'%Y%m%d%H%M%SZ'",
"if",
"'-----BEGIN'",
"not",
"in",
"cert",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_empty_crl | Create an empty Certificate Revocation List.
.. versionadded:: 2015.8.0
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
crl_file
full path to the CRL ... | salt/modules/tls.py | def create_empty_crl(
ca_name,
cacert_path=None,
ca_filename=None,
crl_file=None,
digest='sha256'):
'''
Create an empty Certificate Revocation List.
.. versionadded:: 2015.8.0
ca_name
name of the CA
cacert_path
absolute path to ca certificate... | def create_empty_crl(
ca_name,
cacert_path=None,
ca_filename=None,
crl_file=None,
digest='sha256'):
'''
Create an empty Certificate Revocation List.
.. versionadded:: 2015.8.0
ca_name
name of the CA
cacert_path
absolute path to ca certificate... | [
"Create",
"an",
"empty",
"Certificate",
"Revocation",
"List",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1773-L1854 | [
"def",
"create_empty_crl",
"(",
"ca_name",
",",
"cacert_path",
"=",
"None",
",",
"ca_filename",
"=",
"None",
",",
"crl_file",
"=",
"None",
",",
"digest",
"=",
"'sha256'",
")",
":",
"set_ca_path",
"(",
"cacert_path",
")",
"if",
"not",
"ca_filename",
":",
"c... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | revoke_cert | Revoke a certificate.
.. versionadded:: 2015.8.0
ca_name
Name of the CA.
CN
Common name matching the certificate signing request.
cacert_path
Absolute path to ca certificates root directory.
ca_filename
Alternative filename for the CA.
cert_path
Path... | salt/modules/tls.py | def revoke_cert(
ca_name,
CN,
cacert_path=None,
ca_filename=None,
cert_path=None,
cert_filename=None,
crl_file=None,
digest='sha256',
):
'''
Revoke a certificate.
.. versionadded:: 2015.8.0
ca_name
Name of the CA.
CN
... | def revoke_cert(
ca_name,
CN,
cacert_path=None,
ca_filename=None,
cert_path=None,
cert_filename=None,
crl_file=None,
digest='sha256',
):
'''
Revoke a certificate.
.. versionadded:: 2015.8.0
ca_name
Name of the CA.
CN
... | [
"Revoke",
"a",
"certificate",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tls.py#L1857-L2035 | [
"def",
"revoke_cert",
"(",
"ca_name",
",",
"CN",
",",
"cacert_path",
"=",
"None",
",",
"ca_filename",
"=",
"None",
",",
"cert_path",
"=",
"None",
",",
"cert_filename",
"=",
"None",
",",
"crl_file",
"=",
"None",
",",
"digest",
"=",
"'sha256'",
",",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _convert_range_to_list | convert a seco.range range into a list target | salt/utils/roster_matcher.py | def _convert_range_to_list(tgt, range_server):
'''
convert a seco.range range into a list target
'''
r = seco.range.Range(range_server)
try:
return r.expand(tgt)
except seco.range.RangeException as err:
log.error('Range server exception: %s', err)
return [] | def _convert_range_to_list(tgt, range_server):
'''
convert a seco.range range into a list target
'''
r = seco.range.Range(range_server)
try:
return r.expand(tgt)
except seco.range.RangeException as err:
log.error('Range server exception: %s', err)
return [] | [
"convert",
"a",
"seco",
".",
"range",
"range",
"into",
"a",
"list",
"target"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L133-L142 | [
"def",
"_convert_range_to_list",
"(",
"tgt",
",",
"range_server",
")",
":",
"r",
"=",
"seco",
".",
"range",
".",
"Range",
"(",
"range_server",
")",
"try",
":",
"return",
"r",
".",
"expand",
"(",
"tgt",
")",
"except",
"seco",
".",
"range",
".",
"RangeEx... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RosterMatcher._ret_minions | Filter minions by a generic filter. | salt/utils/roster_matcher.py | def _ret_minions(self, filter_):
'''
Filter minions by a generic filter.
'''
minions = {}
for minion in filter_(self.raw):
data = self.get_data(minion)
if data:
minions[minion] = data.copy()
return minions | def _ret_minions(self, filter_):
'''
Filter minions by a generic filter.
'''
minions = {}
for minion in filter_(self.raw):
data = self.get_data(minion)
if data:
minions[minion] = data.copy()
return minions | [
"Filter",
"minions",
"by",
"a",
"generic",
"filter",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L66-L75 | [
"def",
"_ret_minions",
"(",
"self",
",",
"filter_",
")",
":",
"minions",
"=",
"{",
"}",
"for",
"minion",
"in",
"filter_",
"(",
"self",
".",
"raw",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"(",
"minion",
")",
"if",
"data",
":",
"minions",
"["... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RosterMatcher.ret_glob_minions | Return minions that match via glob | salt/utils/roster_matcher.py | def ret_glob_minions(self):
'''
Return minions that match via glob
'''
fnfilter = functools.partial(fnmatch.filter, pat=self.tgt)
return self._ret_minions(fnfilter) | def ret_glob_minions(self):
'''
Return minions that match via glob
'''
fnfilter = functools.partial(fnmatch.filter, pat=self.tgt)
return self._ret_minions(fnfilter) | [
"Return",
"minions",
"that",
"match",
"via",
"glob"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L77-L82 | [
"def",
"ret_glob_minions",
"(",
"self",
")",
":",
"fnfilter",
"=",
"functools",
".",
"partial",
"(",
"fnmatch",
".",
"filter",
",",
"pat",
"=",
"self",
".",
"tgt",
")",
"return",
"self",
".",
"_ret_minions",
"(",
"fnfilter",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RosterMatcher.ret_pcre_minions | Return minions that match via pcre | salt/utils/roster_matcher.py | def ret_pcre_minions(self):
'''
Return minions that match via pcre
'''
tgt = re.compile(self.tgt)
refilter = functools.partial(filter, tgt.match)
return self._ret_minions(refilter) | def ret_pcre_minions(self):
'''
Return minions that match via pcre
'''
tgt = re.compile(self.tgt)
refilter = functools.partial(filter, tgt.match)
return self._ret_minions(refilter) | [
"Return",
"minions",
"that",
"match",
"via",
"pcre"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L84-L90 | [
"def",
"ret_pcre_minions",
"(",
"self",
")",
":",
"tgt",
"=",
"re",
".",
"compile",
"(",
"self",
".",
"tgt",
")",
"refilter",
"=",
"functools",
".",
"partial",
"(",
"filter",
",",
"tgt",
".",
"match",
")",
"return",
"self",
".",
"_ret_minions",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RosterMatcher.ret_list_minions | Return minions that match via list | salt/utils/roster_matcher.py | def ret_list_minions(self):
'''
Return minions that match via list
'''
tgt = _tgt_set(self.tgt)
return self._ret_minions(tgt.intersection) | def ret_list_minions(self):
'''
Return minions that match via list
'''
tgt = _tgt_set(self.tgt)
return self._ret_minions(tgt.intersection) | [
"Return",
"minions",
"that",
"match",
"via",
"list"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L92-L97 | [
"def",
"ret_list_minions",
"(",
"self",
")",
":",
"tgt",
"=",
"_tgt_set",
"(",
"self",
".",
"tgt",
")",
"return",
"self",
".",
"_ret_minions",
"(",
"tgt",
".",
"intersection",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RosterMatcher.ret_nodegroup_minions | Return minions which match the special list-only groups defined by
ssh_list_nodegroups | salt/utils/roster_matcher.py | def ret_nodegroup_minions(self):
'''
Return minions which match the special list-only groups defined by
ssh_list_nodegroups
'''
nodegroup = __opts__.get('ssh_list_nodegroups', {}).get(self.tgt, [])
nodegroup = _tgt_set(nodegroup)
return self._ret_minions(nodegroup... | def ret_nodegroup_minions(self):
'''
Return minions which match the special list-only groups defined by
ssh_list_nodegroups
'''
nodegroup = __opts__.get('ssh_list_nodegroups', {}).get(self.tgt, [])
nodegroup = _tgt_set(nodegroup)
return self._ret_minions(nodegroup... | [
"Return",
"minions",
"which",
"match",
"the",
"special",
"list",
"-",
"only",
"groups",
"defined",
"by",
"ssh_list_nodegroups"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L99-L106 | [
"def",
"ret_nodegroup_minions",
"(",
"self",
")",
":",
"nodegroup",
"=",
"__opts__",
".",
"get",
"(",
"'ssh_list_nodegroups'",
",",
"{",
"}",
")",
".",
"get",
"(",
"self",
".",
"tgt",
",",
"[",
"]",
")",
"nodegroup",
"=",
"_tgt_set",
"(",
"nodegroup",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RosterMatcher.ret_range_minions | Return minions that are returned by a range query | salt/utils/roster_matcher.py | def ret_range_minions(self):
'''
Return minions that are returned by a range query
'''
if HAS_RANGE is False:
raise RuntimeError("Python lib 'seco.range' is not available")
minions = {}
range_hosts = _convert_range_to_list(self.tgt, __opts__['range_server'])
... | def ret_range_minions(self):
'''
Return minions that are returned by a range query
'''
if HAS_RANGE is False:
raise RuntimeError("Python lib 'seco.range' is not available")
minions = {}
range_hosts = _convert_range_to_list(self.tgt, __opts__['range_server'])
... | [
"Return",
"minions",
"that",
"are",
"returned",
"by",
"a",
"range",
"query"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L108-L117 | [
"def",
"ret_range_minions",
"(",
"self",
")",
":",
"if",
"HAS_RANGE",
"is",
"False",
":",
"raise",
"RuntimeError",
"(",
"\"Python lib 'seco.range' is not available\"",
")",
"minions",
"=",
"{",
"}",
"range_hosts",
"=",
"_convert_range_to_list",
"(",
"self",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RosterMatcher.get_data | Return the configured ip | salt/utils/roster_matcher.py | def get_data(self, minion):
'''
Return the configured ip
'''
ret = copy.deepcopy(__opts__.get('roster_defaults', {}))
if isinstance(self.raw[minion], six.string_types):
ret.update({'host': self.raw[minion]})
return ret
elif isinstance(self.raw[mini... | def get_data(self, minion):
'''
Return the configured ip
'''
ret = copy.deepcopy(__opts__.get('roster_defaults', {}))
if isinstance(self.raw[minion], six.string_types):
ret.update({'host': self.raw[minion]})
return ret
elif isinstance(self.raw[mini... | [
"Return",
"the",
"configured",
"ip"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/roster_matcher.py#L119-L130 | [
"def",
"get_data",
"(",
"self",
",",
"minion",
")",
":",
"ret",
"=",
"copy",
".",
"deepcopy",
"(",
"__opts__",
".",
"get",
"(",
"'roster_defaults'",
",",
"{",
"}",
")",
")",
"if",
"isinstance",
"(",
"self",
".",
"raw",
"[",
"minion",
"]",
",",
"six... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | output | Rather basic.... | salt/output/raw.py | def output(data, **kwargs): # pylint: disable=unused-argument
'''
Rather basic....
'''
if not isinstance(data, six.string_types):
data = six.text_type(data)
return salt.utils.stringutils.to_unicode(data) | def output(data, **kwargs): # pylint: disable=unused-argument
'''
Rather basic....
'''
if not isinstance(data, six.string_types):
data = six.text_type(data)
return salt.utils.stringutils.to_unicode(data) | [
"Rather",
"basic",
"...."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/output/raw.py#L29-L35 | [
"def",
"output",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"isinstance",
"(",
"data",
",",
"six",
".",
"string_types",
")",
":",
"data",
"=",
"six",
".",
"text_type",
"(",
"data",
")",
"return",
"sa... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | avail_images | Return a list of the images that are on the provider | salt/cloud/clouds/parallels.py | def avail_images(call=None):
'''
Return a list of the images that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
items = query(act... | def avail_images(call=None):
'''
Return a list of the images that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_images function must be called with '
'-f or --function, or with the --list-images option'
)
items = query(act... | [
"Return",
"a",
"list",
"of",
"the",
"images",
"that",
"are",
"on",
"the",
"provider"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L84-L99 | [
"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'",
")",
"items",
"=",
"query",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_nodes | Return a list of the VMs that are on the provider | salt/cloud/clouds/parallels.py | def list_nodes(call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
items = query(action='ve')
for item in items:
... | def list_nodes(call=None):
'''
Return a list of the VMs that are on the provider
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
items = query(action='ve')
for item in items:
... | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"are",
"on",
"the",
"provider"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L102-L128 | [
"def",
"list_nodes",
"(",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes function must be called with -f or --function.'",
")",
"ret",
"=",
"{",
"}",
"items",
"=",
"query",
"(",
"action",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_node | Build and submit the XML to create a node | salt/cloud/clouds/parallels.py | def create_node(vm_):
'''
Build and submit the XML to create a node
'''
# Start the tree
content = ET.Element('ve')
# Name of the instance
name = ET.SubElement(content, 'name')
name.text = vm_['name']
# Description, defaults to name
desc = ET.SubElement(content, 'description')
... | def create_node(vm_):
'''
Build and submit the XML to create a node
'''
# Start the tree
content = ET.Element('ve')
# Name of the instance
name = ET.SubElement(content, 'name')
name.text = vm_['name']
# Description, defaults to name
desc = ET.SubElement(content, 'description')
... | [
"Build",
"and",
"submit",
"the",
"XML",
"to",
"create",
"a",
"node"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L184-L270 | [
"def",
"create_node",
"(",
"vm_",
")",
":",
"# Start the tree",
"content",
"=",
"ET",
".",
"Element",
"(",
"'ve'",
")",
"# Name of the instance",
"name",
"=",
"ET",
".",
"SubElement",
"(",
"content",
",",
"'name'",
")",
"name",
".",
"text",
"=",
"vm_",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Create a single VM from a data dict | salt/cloud/clouds/parallels.py | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'par... | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'par... | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/parallels.py#L273-L365 | [
"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",
"'paral... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.