HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/glanceng.cpython-310.pyc
o

�N�g��@s�dZdZzddlZdZWn	eyYnwdZdd�Zdd	�Zdd
d�Zddd
�Zddd�Z	ddd�Z
ddd�Zddd�Zddd�Z
ddd�Zddd�Zddd�ZdS) a�
Glance module for interacting with OpenStack Glance

.. versionadded:: 2018.3.0

:depends:shade

Example configuration

.. code-block:: yaml

    glance:
      cloud: default

.. code-block:: yaml

    glance:
      auth:
        username: admin
        password: password123
        user_domain_name: mydomain
        project_name: myproject
        project_domain_name: myproject
        auth_url: https://example.org:5000/v3
      identity_api_version: 3
F�NTZglancengcCstrtSdS)zC
    Only load this module if shade python module is installed
    )FzRThe glanceng execution module failed to load: shade python module is not available)�	HAS_SHADE�__virtualname__�rr�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/glanceng.py�__virtual__'srcKs:i}|��D]\}}||vr|||kr||||<q|S)zt
    Compare two dicts returning only keys that exist in the first dict and are
    different in the second one
    )�items)�obj�kwargsZchanges�k�vrrr�compare_changes4s�rcKs,d|vr
|s
|�d�|d<tddi|��S)z3
    Sanatize the arguments for use with shade
    �nameZ
name_or_idzargs.clean_kwargsNr)�popZ	__utils__)�	keep_namer	rrr�
_clean_kwargsAsrcCst|�t|�dS)z�
    Call functions to create Shade cloud objects in __context__ to take
    advantage of Shade's in-memory caching across several states
    N)�get_operator_cloud�get_openstack_cloud��authrrr�setup_cloudsKsrcC�P|durtddi�}dtvrtdj|krtdStjdi|��td<tdS)z"
    Return an operator_cloud
    N�
config.option�glanceZ
shade_opcloudr)�__salt__�__context__r�shadeZoperator_cloudrrrrrT�rcCr)z#
    Return an openstack_cloud
    NrrZ
shade_oscloudr)rrrrZopenstack_cloudrrrrrarrcKs*t|�}tdddi|��}|jdi|��S)a
    Create an image

    CLI Example:

    .. code-block:: bash

        salt '*' glanceng.image_create name=cirros file=cirros.raw disk_format=raw
        salt '*' glanceng.image_create name=cirros file=cirros.raw disk_format=raw hw_scsi_model=virtio-scsi hw_disk_bus=scsi
    rTNr)rrZcreate_image�rr	Zcloudrrr�image_creatensrcK�&t|�}tdi|��}|jdi|��S)z�
    Delete an image

    CLI Example:

    .. code-block:: bash

        salt '*' glanceng.image_delete name=image1
        salt '*' glanceng.image_delete name=0e4febc2a5ab4f2c8f374b054162506d
    Nr)rrZdelete_imagerrrr�image_delete~�r cKr)z�
    List images

    CLI Example:

    .. code-block:: bash

        salt '*' glanceng.image_list
        salt '*' glanceng.image_list
    Nr)rrZlist_imagesrrrr�
image_list�r!r"cKr)z�
    Search for images

    CLI Example:

    .. code-block:: bash

        salt '*' glanceng.image_search name=image1
        salt '*' glanceng.image_search
    Nr)rrZ
search_imagesrrrr�image_search�r!r#cKr)z�
    Get a single image

    CLI Example:

    .. code-block:: bash

        salt '*' glanceng.image_get name=image1
        salt '*' glanceng.image_get name=0e4febc2a5ab4f2c8f374b054162506d
    Nr)rrZ	get_imagerrrr�	image_get�r!r$cKr)a#
    Update properties for an image

    CLI Example:

    .. code-block:: bash

        salt '*' glanceng.update_image_properties name=image1 hw_scsi_model=virtio-scsi hw_disk_bus=scsi
        salt '*' glanceng.update_image_properties name=0e4febc2a5ab4f2c8f374b054162506d min_ram=1024
    Nr)rr�update_image_propertiesrrrrr%�r!r%)F)N)�__doc__rr�ImportErrorrrrrrrrrr r"r#r$r%rrrr�<module>s*�