INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
Get the configuration of the device tree at the given path
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`DatastoreType` (``str`` enum).
:param path: The device path to set the value at,
a list of element names in o... | def get_data(datastore, path):
'''
Get the configuration of the device tree at the given path
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`DatastoreType` (``str`` enum).
:param path: The device path to set the val... |
Set a data entry in a datastore
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`DatastoreType` (``str`` enum).
:param path: The device path to set the value at,
a list of element names in order, / separated
:type... | def set_data_value(datastore, path, data):
'''
Set a data entry in a datastore
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`DatastoreType` (``str`` enum).
:param path: The device path to set the value at,
... |
Initialize the PostgreSQL data directory
name
The name of the directory to initialize
user
The database superuser name
password
The password to set for the postgres user
auth
The default authentication method for local connections
encoding
The default enc... | def present(name,
user=None,
password=None,
auth='password',
encoding='UTF8',
locale=None,
runas=None,
waldir=None,
checksums=False):
'''
Initialize the PostgreSQL data directory
name
The name of the directory to initialize
user
... |
List plugins in an installed wordpress path
path
path to wordpress install location
user
user to run the command as
CLI Example:
.. code-block:: bash
salt '*' wordpress.list_plugins /var/www/html apache | def list_plugins(path, user):
'''
List plugins in an installed wordpress path
path
path to wordpress install location
user
user to run the command as
CLI Example:
.. code-block:: bash
salt '*' wordpress.list_plugins /var/www/html apache
'''
ret = []
resp ... |
Show a plugin in a wordpress install and check if it is installed
name
Wordpress plugin name
path
path to wordpress install location
user
user to run the command as
CLI Example:
.. code-block:: bash
salt '*' wordpress.show_plugin HyperDB /var/www/html apache | def show_plugin(name, path, user):
'''
Show a plugin in a wordpress install and check if it is installed
name
Wordpress plugin name
path
path to wordpress install location
user
user to run the command as
CLI Example:
.. code-block:: bash
salt '*' wordpre... |
Activate a wordpress plugin
name
Wordpress plugin name
path
path to wordpress install location
user
user to run the command as
CLI Example:
.. code-block:: bash
salt '*' wordpress.activate HyperDB /var/www/html apache | def activate(name, path, user):
'''
Activate a wordpress plugin
name
Wordpress plugin name
path
path to wordpress install location
user
user to run the command as
CLI Example:
.. code-block:: bash
salt '*' wordpress.activate HyperDB /var/www/html apache
... |
Check if wordpress is installed and setup
path
path to wordpress install location
user
user to run the command as
CLI Example:
.. code-block:: bash
salt '*' wordpress.is_installed /var/www/html apache | def is_installed(path, user=None):
'''
Check if wordpress is installed and setup
path
path to wordpress install location
user
user to run the command as
CLI Example:
.. code-block:: bash
salt '*' wordpress.is_installed /var/www/html apache
'''
retcode = __sal... |
Run the initial setup functions for a wordpress install
path
path to wordpress install location
user
user to run the command as
admin_user
Username for the Administrative user for the wordpress install
admin_password
Initial Password for the Administrative user for th... | def install(path, user, admin_user, admin_password, admin_email, title, url):
'''
Run the initial setup functions for a wordpress install
path
path to wordpress install location
user
user to run the command as
admin_user
Username for the Administrative user for the wordpre... |
Matches a grain based on regex | def match(tgt, delimiter=DEFAULT_TARGET_DELIM, opts=None):
'''
Matches a grain based on regex
'''
if not opts:
opts = __opts__
log.debug('grains pcre target: %s', tgt)
if delimiter not in tgt:
log.error('Got insufficient arguments for grains pcre match '
'statem... |
.. versionadded:: 2018.3.0
Helper that wraps yaml.dump and ensures that we encode unicode strings
unless explicitly told not to. | def dump(data, stream=None, **kwargs):
'''
.. versionadded:: 2018.3.0
Helper that wraps yaml.dump and ensures that we encode unicode strings
unless explicitly told not to.
'''
if 'allow_unicode' not in kwargs:
kwargs['allow_unicode'] = True
return yaml.dump(data, stream, **kwargs) |
Use a custom dumper to ensure that defaultdict and OrderedDict are
represented properly. Ensure that unicode strings are encoded unless
explicitly told not to. | def safe_dump(data, stream=None, **kwargs):
'''
Use a custom dumper to ensure that defaultdict and OrderedDict are
represented properly. Ensure that unicode strings are encoded unless
explicitly told not to.
'''
if 'allow_unicode' not in kwargs:
kwargs['allow_unicode'] = True
return ... |
Return available OpenNebula images.
CLI Example:
.. code-block:: bash
salt-cloud --list-images opennebula
salt-cloud --function avail_images opennebula
salt-cloud -f avail_images opennebula | def avail_images(call=None):
'''
Return available OpenNebula images.
CLI Example:
.. code-block:: bash
salt-cloud --list-images opennebula
salt-cloud --function avail_images opennebula
salt-cloud -f avail_images opennebula
'''
if call == 'action':
raise SaltCl... |
Return available OpenNebula locations.
CLI Example:
.. code-block:: bash
salt-cloud --list-locations opennebula
salt-cloud --function avail_locations opennebula
salt-cloud -f avail_locations opennebula | def avail_locations(call=None):
'''
Return available OpenNebula locations.
CLI Example:
.. code-block:: bash
salt-cloud --list-locations opennebula
salt-cloud --function avail_locations opennebula
salt-cloud -f avail_locations opennebula
'''
if call == 'action':
... |
Returns a list of clusters in OpenNebula.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f list_clusters opennebula | def list_clusters(call=None):
'''
Returns a list of clusters in OpenNebula.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f list_clusters opennebula
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_clusters function must... |
Returns a list of data stores on OpenNebula.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f list_datastores opennebula | def list_datastores(call=None):
'''
Returns a list of data stores on OpenNebula.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f list_datastores opennebula
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_datastores func... |
Lists all security groups available to the user and the user's groups.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f list_security_groups opennebula | def list_security_groups(call=None):
'''
Lists all security groups available to the user and the user's groups.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f list_security_groups opennebula
'''
if call == 'action':
raise SaltCloudSystemExit(
... |
Lists all templates available to the user and the user's groups.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f list_templates opennebula | def list_templates(call=None):
'''
Lists all templates available to the user and the user's groups.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f list_templates opennebula
'''
if call == 'action':
raise SaltCloudSystemExit(
'The li... |
Lists all virtual networks available to the user and the user's groups.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f list_vns opennebula | def list_vns(call=None):
'''
Lists all virtual networks available to the user and the user's groups.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f list_vns opennebula
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_vn... |
Reboot a VM.
.. versionadded:: 2016.3.0
name
The name of the VM to reboot.
CLI Example:
.. code-block:: bash
salt-cloud -a reboot my-vm | def reboot(name, call=None):
'''
Reboot a VM.
.. versionadded:: 2016.3.0
name
The name of the VM to reboot.
CLI Example:
.. code-block:: bash
salt-cloud -a reboot my-vm
'''
if call != 'action':
raise SaltCloudSystemExit(
'The start action must be ... |
Start a VM.
.. versionadded:: 2016.3.0
name
The name of the VM to start.
CLI Example:
.. code-block:: bash
salt-cloud -a start my-vm | def start(name, call=None):
'''
Start a VM.
.. versionadded:: 2016.3.0
name
The name of the VM to start.
CLI Example:
.. code-block:: bash
salt-cloud -a start my-vm
'''
if call != 'action':
raise SaltCloudSystemExit(
'The start action must be call... |
Stop a VM.
.. versionadded:: 2016.3.0
name
The name of the VM to stop.
CLI Example:
.. code-block:: bash
salt-cloud -a stop my-vm | def stop(name, call=None):
'''
Stop a VM.
.. versionadded:: 2016.3.0
name
The name of the VM to stop.
CLI Example:
.. code-block:: bash
salt-cloud -a stop my-vm
'''
if call != 'action':
raise SaltCloudSystemExit(
'The start action must be called w... |
Returns the OpenNebula version.
.. versionadded:: 2016.3.5
CLI Example:
.. code-block:: bash
salt-cloud -f get_one_version one_provider_name | def get_one_version(kwargs=None, call=None):
'''
Returns the OpenNebula version.
.. versionadded:: 2016.3.5
CLI Example:
.. code-block:: bash
salt-cloud -f get_one_version one_provider_name
'''
if call == 'action':
raise SaltCloudSystemExit(
'The get_cluster_... |
Returns a cluster's ID from the given cluster name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_cluster_id opennebula name=my-cluster-name | def get_cluster_id(kwargs=None, call=None):
'''
Returns a cluster's ID from the given cluster name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_cluster_id opennebula name=my-cluster-name
'''
if call == 'action':
raise SaltCloudSystemExit... |
Returns a data store's ID from the given data store name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_datastore_id opennebula name=my-datastore-name | def get_datastore_id(kwargs=None, call=None):
'''
Returns a data store's ID from the given data store name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_datastore_id opennebula name=my-datastore-name
'''
if call == 'action':
raise SaltClo... |
Returns a host's ID from the given host name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_host_id opennebula name=my-host-name | def get_host_id(kwargs=None, call=None):
'''
Returns a host's ID from the given host name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_host_id opennebula name=my-host-name
'''
if call == 'action':
raise SaltCloudSystemExit(
'... |
r'''
Return the image object to use.
vm\_
The VM dictionary for which to obtain an image. | def get_image(vm_):
r'''
Return the image object to use.
vm\_
The VM dictionary for which to obtain an image.
'''
images = avail_images()
vm_image = six.text_type(config.get_cloud_config_value(
'image', vm_, __opts__, search_global=False
))
for image in images:
i... |
Returns an image's ID from the given image name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_image_id opennebula name=my-image-name | def get_image_id(kwargs=None, call=None):
'''
Returns an image's ID from the given image name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_image_id opennebula name=my-image-name
'''
if call == 'action':
raise SaltCloudSystemExit(
... |
Returns a security group's ID from the given security group name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_secgroup_id opennebula name=my-secgroup-name | def get_secgroup_id(kwargs=None, call=None):
'''
Returns a security group's ID from the given security group name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_secgroup_id opennebula name=my-secgroup-name
'''
if call == 'action':
raise Sa... |
Returns a template's image from the given template name.
.. versionadded:: 2018.3.0
.. code-block:: bash
salt-cloud -f get_template_image opennebula name=my-template-name | def get_template_image(kwargs=None, call=None):
'''
Returns a template's image from the given template name.
.. versionadded:: 2018.3.0
.. code-block:: bash
salt-cloud -f get_template_image opennebula name=my-template-name
'''
if call == 'action':
raise SaltCloudSystemExit(
... |
r'''
Return the template id for a VM.
.. versionadded:: 2016.11.0
vm\_
The VM dictionary for which to obtain a template. | def get_template(vm_):
r'''
Return the template id for a VM.
.. versionadded:: 2016.11.0
vm\_
The VM dictionary for which to obtain a template.
'''
vm_template = six.text_type(config.get_cloud_config_value(
'template', vm_, __opts__, search_global=False
))
try:
... |
Returns a virtual machine's ID from the given virtual machine's name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_vm_id opennebula name=my-vm | def get_vm_id(kwargs=None, call=None):
'''
Returns a virtual machine's ID from the given virtual machine's name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_vm_id opennebula name=my-vm
'''
if call == 'action':
raise SaltCloudSystemExit(
... |
Returns a virtual network's ID from the given virtual network's name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_vn_id opennebula name=my-vn-name | def get_vn_id(kwargs=None, call=None):
'''
Returns a virtual network's ID from the given virtual network's name.
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt-cloud -f get_vn_id opennebula name=my-vn-name
'''
if call == 'action':
raise SaltCloudSystemE... |
Returns the template format to create a disk in open nebula
.. versionadded:: 2018.3.0 | def _get_device_template(disk, disk_info, template=None):
'''
Returns the template format to create a disk in open nebula
.. versionadded:: 2018.3.0
'''
def _require_disk_opts(*args):
for arg in args:
if arg not in disk_info:
raise SaltCloudSystemExit(
... |
r'''
Create a single VM from a data dict.
vm\_
The dictionary use to create a VM.
Optional vm\_ dict options for overwriting template:
region_id
Optional - OpenNebula Zone ID
memory
Optional - In MB
cpu
Optional - Percent of host CPU to allocate
vcpu
... | def create(vm_):
r'''
Create a single VM from a data dict.
vm\_
The dictionary use to create a VM.
Optional vm\_ dict options for overwriting template:
region_id
Optional - OpenNebula Zone ID
memory
Optional - In MB
cpu
Optional - Percent of host CPU to a... |
Destroy a node. Will check termination protection and warn if enabled.
name
The name of the vm to be destroyed.
CLI Example:
.. code-block:: bash
salt-cloud --destroy vm_name
salt-cloud -d vm_name
salt-cloud --action destroy vm_name
salt-cloud -a destroy vm_name | def destroy(name, call=None):
'''
Destroy a node. Will check termination protection and warn if enabled.
name
The name of the vm to be destroyed.
CLI Example:
.. code-block:: bash
salt-cloud --destroy vm_name
salt-cloud -d vm_name
salt-cloud --action destroy vm_na... |
Allocates a new image in OpenNebula.
.. versionadded:: 2016.3.0
path
The path to a file containing the template of the image to allocate.
Syntax within the file can be the usual attribute=value or XML. Can be
used instead of ``data``.
data
The data containing the template ... | def image_allocate(call=None, kwargs=None):
'''
Allocates a new image in OpenNebula.
.. versionadded:: 2016.3.0
path
The path to a file containing the template of the image to allocate.
Syntax within the file can be the usual attribute=value or XML. Can be
used instead of ``dat... |
Retrieves information for a given image. Either a name or an image_id must be
supplied.
.. versionadded:: 2016.3.0
name
The name of the image for which to gather information. Can be used instead
of ``image_id``.
image_id
The ID of the image for which to gather information. Can... | def image_info(call=None, kwargs=None):
'''
Retrieves information for a given image. Either a name or an image_id must be
supplied.
.. versionadded:: 2016.3.0
name
The name of the image for which to gather information. Can be used instead
of ``image_id``.
image_id
The ... |
Sets the Image as persistent or not persistent.
.. versionadded:: 2016.3.0
name
The name of the image to set. Can be used instead of ``image_id``.
image_id
The ID of the image to set. Can be used instead of ``name``.
persist
A boolean value to set the image as persistent or n... | def image_persistent(call=None, kwargs=None):
'''
Sets the Image as persistent or not persistent.
.. versionadded:: 2016.3.0
name
The name of the image to set. Can be used instead of ``image_id``.
image_id
The ID of the image to set. Can be used instead of ``name``.
persist
... |
Clones an existing image.
.. versionadded:: 2016.3.0
name
The name of the new image.
image_id
The ID of the image to be cloned. Can be used instead of ``image_name``.
image_name
The name of the image to be cloned. Can be used instead of ``image_id``.
CLI Example:
..... | def image_clone(call=None, kwargs=None):
'''
Clones an existing image.
.. versionadded:: 2016.3.0
name
The name of the new image.
image_id
The ID of the image to be cloned. Can be used instead of ``image_name``.
image_name
The name of the image to be cloned. Can be us... |
Deletes a snapshot from the image.
.. versionadded:: 2016.3.0
image_id
The ID of the image from which to delete the snapshot. Can be used instead of
``image_name``.
image_name
The name of the image from which to delete the snapshot. Can be used instead
of ``image_id``.
... | def image_snapshot_delete(call=None, kwargs=None):
'''
Deletes a snapshot from the image.
.. versionadded:: 2016.3.0
image_id
The ID of the image from which to delete the snapshot. Can be used instead of
``image_name``.
image_name
The name of the image from which to delete... |
Replaces the image template contents.
.. versionadded:: 2016.3.0
image_id
The ID of the image to update. Can be used instead of ``image_name``.
image_name
The name of the image to update. Can be used instead of ``image_id``.
path
The path to a file containing the template of ... | def image_update(call=None, kwargs=None):
'''
Replaces the image template contents.
.. versionadded:: 2016.3.0
image_id
The ID of the image to update. Can be used instead of ``image_name``.
image_name
The name of the image to update. Can be used instead of ``image_id``.
path
... |
Deletes the given security group from OpenNebula. Either a name or a secgroup_id
must be supplied.
.. versionadded:: 2016.3.0
name
The name of the security group to delete. Can be used instead of
``secgroup_id``.
secgroup_id
The ID of the security group to delete. Can be used ... | def secgroup_delete(call=None, kwargs=None):
'''
Deletes the given security group from OpenNebula. Either a name or a secgroup_id
must be supplied.
.. versionadded:: 2016.3.0
name
The name of the security group to delete. Can be used instead of
``secgroup_id``.
secgroup_id
... |
Retrieves information for the given security group. Either a name or a
secgroup_id must be supplied.
.. versionadded:: 2016.3.0
name
The name of the security group for which to gather information. Can be
used instead of ``secgroup_id``.
secgroup_id
The ID of the security group... | def secgroup_info(call=None, kwargs=None):
'''
Retrieves information for the given security group. Either a name or a
secgroup_id must be supplied.
.. versionadded:: 2016.3.0
name
The name of the security group for which to gather information. Can be
used instead of ``secgroup_id``... |
Replaces the security group template contents.
.. versionadded:: 2016.3.0
secgroup_id
The ID of the security group to update. Can be used instead of
``secgroup_name``.
secgroup_name
The name of the security group to update. Can be used instead of
``secgroup_id``.
path... | def secgroup_update(call=None, kwargs=None):
'''
Replaces the security group template contents.
.. versionadded:: 2016.3.0
secgroup_id
The ID of the security group to update. Can be used instead of
``secgroup_name``.
secgroup_name
The name of the security group to update. ... |
Allocates a new template in OpenNebula.
.. versionadded:: 2016.3.0
path
The path to a file containing the elements of the template to be allocated.
Syntax within the file can be the usual attribute=value or XML. Can be used
instead of ``data``.
data
Contains the elements o... | def template_allocate(call=None, kwargs=None):
'''
Allocates a new template in OpenNebula.
.. versionadded:: 2016.3.0
path
The path to a file containing the elements of the template to be allocated.
Syntax within the file can be the usual attribute=value or XML. Can be used
ins... |
Clones an existing virtual machine template.
.. versionadded:: 2016.3.0
name
The name of the new template.
template_id
The ID of the template to be cloned. Can be used instead of ``template_name``.
template_name
The name of the template to be cloned. Can be used instead of ``... | def template_clone(call=None, kwargs=None):
'''
Clones an existing virtual machine template.
.. versionadded:: 2016.3.0
name
The name of the new template.
template_id
The ID of the template to be cloned. Can be used instead of ``template_name``.
template_name
The name... |
Deletes the given template from OpenNebula. Either a name or a template_id must
be supplied.
.. versionadded:: 2016.3.0
name
The name of the template to delete. Can be used instead of ``template_id``.
template_id
The ID of the template to delete. Can be used instead of ``name``.
... | def template_delete(call=None, kwargs=None):
'''
Deletes the given template from OpenNebula. Either a name or a template_id must
be supplied.
.. versionadded:: 2016.3.0
name
The name of the template to delete. Can be used instead of ``template_id``.
template_id
The ID of the t... |
Instantiates a new virtual machine from a template.
.. versionadded:: 2016.3.0
.. note::
``template_instantiate`` creates a VM on OpenNebula from a template, but it
does not install Salt on the new VM. Use the ``create`` function for that
functionality: ``salt-cloud -p opennebula-profi... | def template_instantiate(call=None, kwargs=None):
'''
Instantiates a new virtual machine from a template.
.. versionadded:: 2016.3.0
.. note::
``template_instantiate`` creates a VM on OpenNebula from a template, but it
does not install Salt on the new VM. Use the ``create`` function fo... |
Replaces the template contents.
.. versionadded:: 2016.3.0
template_id
The ID of the template to update. Can be used instead of ``template_name``.
template_name
The name of the template to update. Can be used instead of ``template_id``.
path
The path to a file containing the ... | def template_update(call=None, kwargs=None):
'''
Replaces the template contents.
.. versionadded:: 2016.3.0
template_id
The ID of the template to update. Can be used instead of ``template_name``.
template_name
The name of the template to update. Can be used instead of ``template_i... |
Submits an action to be performed on a given virtual machine.
.. versionadded:: 2016.3.0
name
The name of the VM to action.
action
The action to be performed on the VM. Available options include:
- boot
- delete
- delete-recreate
- hold
- ... | def vm_action(name, kwargs=None, call=None):
'''
Submits an action to be performed on a given virtual machine.
.. versionadded:: 2016.3.0
name
The name of the VM to action.
action
The action to be performed on the VM. Available options include:
- boot
- delete
... |
Allocates a new virtual machine in OpenNebula.
.. versionadded:: 2016.3.0
path
The path to a file defining the template of the VM to allocate.
Syntax within the file can be the usual attribute=value or XML.
Can be used instead of ``data``.
data
Contains the template defini... | def vm_allocate(call=None, kwargs=None):
'''
Allocates a new virtual machine in OpenNebula.
.. versionadded:: 2016.3.0
path
The path to a file defining the template of the VM to allocate.
Syntax within the file can be the usual attribute=value or XML.
Can be used instead of ``d... |
Attaches a new disk to the given virtual machine.
.. versionadded:: 2016.3.0
name
The name of the VM for which to attach the new disk.
path
The path to a file containing a single disk vector attribute.
Syntax within the file can be the usual attribute=value or XML.
Can be ... | def vm_attach(name, kwargs=None, call=None):
'''
Attaches a new disk to the given virtual machine.
.. versionadded:: 2016.3.0
name
The name of the VM for which to attach the new disk.
path
The path to a file containing a single disk vector attribute.
Syntax within the file... |
Initiates the instance of the given VM on the target host.
.. versionadded:: 2016.3.0
name
The name of the VM to deploy.
host_id
The ID of the target host where the VM will be deployed. Can be used instead
of ``host_name``.
host_name
The name of the target host where ... | def vm_deploy(name, kwargs=None, call=None):
'''
Initiates the instance of the given VM on the target host.
.. versionadded:: 2016.3.0
name
The name of the VM to deploy.
host_id
The ID of the target host where the VM will be deployed. Can be used instead
of ``host_name``.
... |
Detaches a disk from a virtual machine.
.. versionadded:: 2016.3.0
name
The name of the VM from which to detach the disk.
disk_id
The ID of the disk to detach.
CLI Example:
.. code-block:: bash
salt-cloud -a vm_detach my-vm disk_id=1 | def vm_detach(name, kwargs=None, call=None):
'''
Detaches a disk from a virtual machine.
.. versionadded:: 2016.3.0
name
The name of the VM from which to detach the disk.
disk_id
The ID of the disk to detach.
CLI Example:
.. code-block:: bash
salt-cloud -a vm_de... |
Detaches a disk from a virtual machine.
.. versionadded:: 2016.3.0
name
The name of the VM from which to detach the network interface.
nic_id
The ID of the nic to detach.
CLI Example:
.. code-block:: bash
salt-cloud -a vm_detach_nic my-vm nic_id=1 | def vm_detach_nic(name, kwargs=None, call=None):
'''
Detaches a disk from a virtual machine.
.. versionadded:: 2016.3.0
name
The name of the VM from which to detach the network interface.
nic_id
The ID of the nic to detach.
CLI Example:
.. code-block:: bash
salt... |
Sets the disk to be saved in the given image.
.. versionadded:: 2016.3.0
name
The name of the VM containing the disk to save.
disk_id
The ID of the disk to save.
image_name
The name of the new image where the disk will be saved.
image_type
The type for the new im... | def vm_disk_save(name, kwargs=None, call=None):
'''
Sets the disk to be saved in the given image.
.. versionadded:: 2016.3.0
name
The name of the VM containing the disk to save.
disk_id
The ID of the disk to save.
image_name
The name of the new image where the disk wi... |
Takes a new snapshot of the disk image.
.. versionadded:: 2016.3.0
name
The name of the VM of which to take the snapshot.
disk_id
The ID of the disk to save.
description
The description for the snapshot.
CLI Example:
.. code-block:: bash
salt-cloud -a vm_di... | def vm_disk_snapshot_create(name, kwargs=None, call=None):
'''
Takes a new snapshot of the disk image.
.. versionadded:: 2016.3.0
name
The name of the VM of which to take the snapshot.
disk_id
The ID of the disk to save.
description
The description for the snapshot.
... |
Deletes a disk snapshot based on the given VM and the disk_id.
.. versionadded:: 2016.3.0
name
The name of the VM containing the snapshot to delete.
disk_id
The ID of the disk to save.
snapshot_id
The ID of the snapshot to be deleted.
CLI Example:
.. code-block:: ba... | def vm_disk_snapshot_delete(name, kwargs=None, call=None):
'''
Deletes a disk snapshot based on the given VM and the disk_id.
.. versionadded:: 2016.3.0
name
The name of the VM containing the snapshot to delete.
disk_id
The ID of the disk to save.
snapshot_id
The ID o... |
Retrieves information for a given virtual machine. A VM name must be supplied.
.. versionadded:: 2016.3.0
name
The name of the VM for which to gather information.
CLI Example:
.. code-block:: bash
salt-cloud -a vm_info my-vm | def vm_info(name, call=None):
'''
Retrieves information for a given virtual machine. A VM name must be supplied.
.. versionadded:: 2016.3.0
name
The name of the VM for which to gather information.
CLI Example:
.. code-block:: bash
salt-cloud -a vm_info my-vm
'''
if c... |
Returns the monitoring records for a given virtual machine. A VM name must be
supplied.
The monitoring information returned is a list of VM elements. Each VM element
contains the complete dictionary of the VM with the updated information returned
by the poll action.
.. versionadded:: 2016.3.0
... | def vm_monitoring(name, call=None):
'''
Returns the monitoring records for a given virtual machine. A VM name must be
supplied.
The monitoring information returned is a list of VM elements. Each VM element
contains the complete dictionary of the VM with the updated information returned
by the p... |
Creates a new virtual machine snapshot from the provided VM.
.. versionadded:: 2016.3.0
vm_name
The name of the VM from which to create the snapshot.
snapshot_name
The name of the snapshot to be created.
CLI Example:
.. code-block:: bash
salt-cloud -a vm_snapshot_create... | def vm_snapshot_create(vm_name, kwargs=None, call=None):
'''
Creates a new virtual machine snapshot from the provided VM.
.. versionadded:: 2016.3.0
vm_name
The name of the VM from which to create the snapshot.
snapshot_name
The name of the snapshot to be created.
CLI Example... |
Deletes a virtual machine snapshot from the provided VM.
.. versionadded:: 2016.3.0
vm_name
The name of the VM from which to delete the snapshot.
snapshot_id
The ID of the snapshot to be deleted.
CLI Example:
.. code-block:: bash
salt-cloud -a vm_snapshot_delete my-vm s... | def vm_snapshot_delete(vm_name, kwargs=None, call=None):
'''
Deletes a virtual machine snapshot from the provided VM.
.. versionadded:: 2016.3.0
vm_name
The name of the VM from which to delete the snapshot.
snapshot_id
The ID of the snapshot to be deleted.
CLI Example:
.... |
Replaces the user template contents.
.. versionadded:: 2016.3.0
name
The name of the VM to update.
path
The path to a file containing new user template contents. Syntax within the
file can be the usual attribute=value or XML. Can be used instead of ``data``.
data
Cont... | def vm_update(name, kwargs=None, call=None):
'''
Replaces the user template contents.
.. versionadded:: 2016.3.0
name
The name of the VM to update.
path
The path to a file containing new user template contents. Syntax within the
file can be the usual attribute=value or XML... |
Allocates a new virtual network in OpenNebula.
.. versionadded:: 2016.3.0
path
The path to a file containing the template of the virtual network to allocate.
Syntax within the file can be the usual attribute=value or XML. Can be used
instead of ``data``.
data
Contains the ... | def vn_allocate(call=None, kwargs=None):
'''
Allocates a new virtual network in OpenNebula.
.. versionadded:: 2016.3.0
path
The path to a file containing the template of the virtual network to allocate.
Syntax within the file can be the usual attribute=value or XML. Can be used
... |
Deletes the given virtual network from OpenNebula. Either a name or a vn_id must
be supplied.
.. versionadded:: 2016.3.0
name
The name of the virtual network to delete. Can be used instead of ``vn_id``.
vn_id
The ID of the virtual network to delete. Can be used instead of ``name``.
... | def vn_delete(call=None, kwargs=None):
'''
Deletes the given virtual network from OpenNebula. Either a name or a vn_id must
be supplied.
.. versionadded:: 2016.3.0
name
The name of the virtual network to delete. Can be used instead of ``vn_id``.
vn_id
The ID of the virtual net... |
Frees a reserved address range from a virtual network.
.. versionadded:: 2016.3.0
vn_id
The ID of the virtual network from which to free an address range.
Can be used instead of ``vn_name``.
vn_name
The name of the virtual network from which to free an address range.
Can b... | def vn_free_ar(call=None, kwargs=None):
'''
Frees a reserved address range from a virtual network.
.. versionadded:: 2016.3.0
vn_id
The ID of the virtual network from which to free an address range.
Can be used instead of ``vn_name``.
vn_name
The name of the virtual networ... |
Retrieves information for the virtual network.
.. versionadded:: 2016.3.0
name
The name of the virtual network for which to gather information. Can be
used instead of ``vn_id``.
vn_id
The ID of the virtual network for which to gather information. Can be
used instead of ``n... | def vn_info(call=None, kwargs=None):
'''
Retrieves information for the virtual network.
.. versionadded:: 2016.3.0
name
The name of the virtual network for which to gather information. Can be
used instead of ``vn_id``.
vn_id
The ID of the virtual network for which to gathe... |
Releases a virtual network lease that was previously on hold.
.. versionadded:: 2016.3.0
vn_id
The ID of the virtual network from which to release the lease. Can be
used instead of ``vn_name``.
vn_name
The name of the virtual network from which to release the lease.
Can be... | def vn_release(call=None, kwargs=None):
'''
Releases a virtual network lease that was previously on hold.
.. versionadded:: 2016.3.0
vn_id
The ID of the virtual network from which to release the lease. Can be
used instead of ``vn_name``.
vn_name
The name of the virtual net... |
Intrepret the data coming from opennebula and raise if it's not XML. | def _get_xml(xml_str):
'''
Intrepret the data coming from opennebula and raise if it's not XML.
'''
try:
xml_data = etree.XML(xml_str)
# XMLSyntaxError seems to be only available from lxml, but that is the xml
# library loaded by this module
except etree.XMLSyntaxError as err:
... |
Uses the OpenNebula cloud provider configurations to connect to the
OpenNebula API.
Returns the server connection created as well as the user and password
values from the cloud provider config file used to make the connection. | def _get_xml_rpc():
'''
Uses the OpenNebula cloud provider configurations to connect to the
OpenNebula API.
Returns the server connection created as well as the user and password
values from the cloud provider config file used to make the connection.
'''
vm_ = get_configured_provider()
... |
Helper function for the list_* query functions - Constructs the
appropriate dictionaries to return from the API query.
full
If performing a full query, such as in list_nodes_full, change
this parameter to ``True``. | def _list_nodes(full=False):
'''
Helper function for the list_* query functions - Constructs the
appropriate dictionaries to return from the API query.
full
If performing a full query, such as in list_nodes_full, change
this parameter to ``True``.
'''
server, user, password = _g... |
Helper function to covert xml into a data dictionary.
xml
The xml data to convert. | def _xml_to_dict(xml):
'''
Helper function to covert xml into a data dictionary.
xml
The xml data to convert.
'''
dicts = {}
for item in xml:
key = item.tag.lower()
idx = 1
while key in dicts:
key += six.text_type(idx)
idx += 1
if ... |
Pass in a generic option and receive the value that will be assigned
CLI Example:
.. code-block:: bash
salt '*' config.option redis.host | def option(
value,
default='',
omit_opts=False,
omit_master=False,
omit_pillar=False):
'''
Pass in a generic option and receive the value that will be assigned
CLI Example:
.. code-block:: bash
salt '*' config.option redis.host
'''
if not omit_o... |
.. versionadded: 0.14.0
Attempt to retrieve the named value from the minion config file, pillar,
grains or the master config. If the named value is not available, return the
value specified by ``default``. If not specified, the default is an empty
string.
Values can also be retrieved from nested d... | def get(key, default='', delimiter=':', merge=None, omit_opts=False,
omit_pillar=False, omit_master=False, omit_grains=False):
'''
.. versionadded: 0.14.0
Attempt to retrieve the named value from the minion config file, pillar,
grains or the master config. If the named value is not available, r... |
Pass in a configuration value that should be preceded by the module name
and a dot, this will return a list of all read key/value pairs
CLI Example:
.. code-block:: bash
salt '*' config.dot_vals host | def dot_vals(value):
'''
Pass in a configuration value that should be preceded by the module name
and a dot, this will return a list of all read key/value pairs
CLI Example:
.. code-block:: bash
salt '*' config.dot_vals host
'''
ret = {}
for key, val in six.iteritems(__pillar_... |
Download the salt-bootstrap script, and return its location
bootstrap
URL of alternate bootstrap script
CLI Example:
.. code-block:: bash
salt '*' config.gather_bootstrap_script | def gather_bootstrap_script(bootstrap=None):
'''
Download the salt-bootstrap script, and return its location
bootstrap
URL of alternate bootstrap script
CLI Example:
.. code-block:: bash
salt '*' config.gather_bootstrap_script
'''
if not HAS_CLOUD:
return False, '... |
Builds a member formatted string for XML operation. | def _build_members(members, anycheck=False):
'''
Builds a member formatted string for XML operation.
'''
if isinstance(members, list):
# This check will strip down members to a single any statement
if anycheck and 'any' in members:
return "<member>any</member>"
resp... |
Sends an edit request to the device. | def _edit_config(xpath, element):
'''
Sends an edit request to the device.
'''
query = {'type': 'config',
'action': 'edit',
'xpath': xpath,
'element': element}
response = __proxy__['panos.call'](query)
return _validate_response(response) |
Moves an xpath to the after of its section. | def _move_after(xpath, target):
'''
Moves an xpath to the after of its section.
'''
query = {'type': 'config',
'action': 'move',
'xpath': xpath,
'where': 'after',
'dst': target}
response = __proxy__['panos.call'](query)
return _validate_resp... |
Moves an xpath to the bottom of its section. | def _move_before(xpath, target):
'''
Moves an xpath to the bottom of its section.
'''
query = {'type': 'config',
'action': 'move',
'xpath': xpath,
'where': 'before',
'dst': target}
response = __proxy__['panos.call'](query)
return _validate_r... |
Sends a set request to the device. | def _set_config(xpath, element):
'''
Sends a set request to the device.
'''
query = {'type': 'config',
'action': 'set',
'xpath': xpath,
'element': element}
response = __proxy__['panos.call'](query)
return _validate_response(response) |
Validates a response from a Palo Alto device. Used to verify success of commands. | def _validate_response(response):
'''
Validates a response from a Palo Alto device. Used to verify success of commands.
'''
if not response:
return False, 'Unable to validate response from device.'
elif 'msg' in response:
if 'line' in response['msg']:
if response['msg'][... |
Prevent other users from changing configuration until the lock is released.
name: The name of the module function to execute.
SLS Example:
.. code-block:: yaml
panos/takelock:
panos.add_config_lock | def add_config_lock(name):
'''
Prevent other users from changing configuration until the lock is released.
name: The name of the module function to execute.
SLS Example:
.. code-block:: yaml
panos/takelock:
panos.add_config_lock
'''
ret = _default_ret(name)
ret.... |
Ensures that an address object exists in the configured state. If it does not exist or is not configured with the
specified attributes, it will be adjusted to match the specified values.
This module will only process a single address type (ip-netmask, ip-range, or fqdn). It will process the specified
value... | def address_exists(name,
addressname=None,
vsys=1,
ipnetmask=None,
iprange=None,
fqdn=None,
description=None,
commit=False):
'''
Ensures that an address object exists in the confi... |
Commits the candidate configuration to the running configuration.
name: The name of the module function to execute.
SLS Example:
.. code-block:: yaml
panos/commit:
panos.commit_config | def commit_config(name):
'''
Commits the candidate configuration to the running configuration.
name: The name of the module function to execute.
SLS Example:
.. code-block:: yaml
panos/commit:
panos.commit_config
'''
ret = _default_ret(name)
ret.update({
... |
Deletes a Palo Alto XPATH to a specific value.
Use the xpath parameter to specify the location of the object to be deleted.
name: The name of the module function to execute.
xpath(str): The XPATH of the configuration API tree to control.
commit(bool): If true the firewall will commit the changes, if... | def delete_config(name, xpath=None, commit=False):
'''
Deletes a Palo Alto XPATH to a specific value.
Use the xpath parameter to specify the location of the object to be deleted.
name: The name of the module function to execute.
xpath(str): The XPATH of the configuration API tree to control.
... |
Ensures that a software version is downloaded.
name: The name of the module function to execute.
version(str): The software version to check. If this version is not already downloaded, it will attempt to download
the file from Palo Alto.
synch(bool): If true, after downloading the file it will be syn... | def download_software(name, version=None, synch=False, check=False):
'''
Ensures that a software version is downloaded.
name: The name of the module function to execute.
version(str): The software version to check. If this version is not already downloaded, it will attempt to download
the file fro... |
Edits a Palo Alto XPATH to a specific value. This will always overwrite the existing value, even if it is not
changed.
You can replace an existing object hierarchy at a specified location in the configuration with a new value. Use
the xpath parameter to specify the location of the object, including the nod... | def edit_config(name, xpath=None, value=None, commit=False):
'''
Edits a Palo Alto XPATH to a specific value. This will always overwrite the existing value, even if it is not
changed.
You can replace an existing object hierarchy at a specified location in the configuration with a new value. Use
the... |
Moves a XPATH value to a new location.
Use the xpath parameter to specify the location of the object to be moved, the where parameter to
specify type of move, and dst parameter to specify the destination path.
name: The name of the module function to execute.
xpath(str): The XPATH of the configuratio... | def move_config(name, xpath=None, where=None, dst=None, commit=False):
'''
Moves a XPATH value to a new location.
Use the xpath parameter to specify the location of the object to be moved, the where parameter to
specify type of move, and dst parameter to specify the destination path.
name: The nam... |
Release config lock previously held.
name: The name of the module function to execute.
SLS Example:
.. code-block:: yaml
panos/takelock:
panos.remove_config_lock | def remove_config_lock(name):
'''
Release config lock previously held.
name: The name of the module function to execute.
SLS Example:
.. code-block:: yaml
panos/takelock:
panos.remove_config_lock
'''
ret = _default_ret(name)
ret.update({
'changes': __sal... |
Ensures that a security rule exists on the device. Also, ensure that all configurations are set appropriately.
This method will create the rule if it does not exist. If the rule does exist, it will ensure that the
configurations are set appropriately.
If the rule does not exist and is created, any value t... | def security_rule_exists(name,
rulename=None,
vsys='1',
action=None,
disabled=None,
sourcezone=None,
destinationzone=None,
source=None,
... |
Ensures that a service object exists in the configured state. If it does not exist or is not configured with the
specified attributes, it will be adjusted to match the specified values.
name: The name of the module function to execute.
servicename(str): The name of the security object. The name is case-s... | def service_exists(name, servicename=None, vsys=1, protocol=None, port=None, description=None, commit=False):
'''
Ensures that a service object exists in the configured state. If it does not exist or is not configured with the
specified attributes, it will be adjusted to match the specified values.
nam... |
Ensures that a service group object exists in the configured state. If it does not exist or is not configured with
the specified attributes, it will be adjusted to match the specified values.
This module will enforce group membership. If a group exists and contains members this state does not include,
thos... | def service_group_exists(name,
groupname=None,
vsys=1,
members=None,
description=None,
commit=False):
'''
Ensures that a service group object exists in the configured state. If it does no... |
Sets a Palo Alto XPATH to a specific value. This will always overwrite the existing value, even if it is not
changed.
You can add or create a new object at a specified location in the configuration hierarchy. Use the xpath parameter
to specify the location of the object in the configuration
name: The ... | def set_config(name, xpath=None, value=None, commit=False):
'''
Sets a Palo Alto XPATH to a specific value. This will always overwrite the existing value, even if it is not
changed.
You can add or create a new object at a specified location in the configuration hierarchy. Use the xpath parameter
to... |
If the callback is None or is not callable, return a lambda that returns
the value passed. | def _check_cb(cb_):
'''
If the callback is None or is not callable, return a lambda that returns
the value passed.
'''
if cb_ is not None:
if hasattr(cb_, '__call__'):
return cb_
else:
log.error('log_callback is not callable, ignoring')
return lambda x: x |
Set python_shell default based on remote execution and __opts__['cmd_safe'] | def _python_shell_default(python_shell, __pub_jid):
'''
Set python_shell default based on remote execution and __opts__['cmd_safe']
'''
try:
# Default to python_shell=True when run directly from remote execution
# system. Cross-module calls won't have a jid.
if __pub_jid and pyth... |
If template is a valid template engine, process the cmd and cwd through
that engine. | def _render_cmd(cmd, cwd, template, saltenv='base', pillarenv=None, pillar_override=None):
'''
If template is a valid template engine, process the cmd and cwd through
that engine.
'''
if not template:
return (cmd, cwd)
# render the path as a template using path_template_engine as the en... |
Retrieve the level code for use in logging.Logger.log(). | def _check_loglevel(level='info'):
'''
Retrieve the level code for use in logging.Logger.log().
'''
try:
level = level.lower()
if level == 'quiet':
return None
else:
return LOG_LEVELS[level]
except (AttributeError, KeyError):
log.error(
... |
Whenever a state run starts, gather the pillar data fresh | def _gather_pillar(pillarenv, pillar_override):
'''
Whenever a state run starts, gather the pillar data fresh
'''
pillar = salt.pillar.get_pillar(
__opts__,
__grains__,
__opts__['id'],
__opts__['saltenv'],
pillar_override=pillar_override,
pillarenv=pillare... |
Check to see if the given command can be run | def _check_avail(cmd):
'''
Check to see if the given command can be run
'''
if isinstance(cmd, list):
cmd = ' '.join([six.text_type(x) if not isinstance(x, six.string_types) else x
for x in cmd])
bret = True
wret = False
if __salt__['config.get']('cmd_blacklis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.