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/runners/__pycache__/cloud.cpython-310.pyc
o

�N�g��@s�dZddlZddlZddlZddlZddlmZe�e	�Z
dd�Zd dd�Zd d	d
�Z
d dd�Zd!dd�Zd"dd�Zd#dd�Zd$dd�Zd%dd�Zd&dd�Z						d'dd�Zd&dd�ZdS)(z�
The Salt Cloud Runner
=====================

This runner wraps the functionality of salt cloud making salt cloud routines
available to all internal apis via the runner system
�N)�SaltCloudConfigErrorcCs&tj�tj�tj�td�d��}|S)z
    Return cloud client
    Z	conf_file�cloud)�saltrZCloudClient�os�path�join�dirnameZ__opts__)�client�r
�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/cloud.py�_get_clients�r�allcC�t�}|�|�}|S�z;
    List cloud provider sizes for the given providers
    )r�
list_sizes)�providerr	Zsizesr
r
rr�
rcCr)z<
    List cloud provider images for the given providers
    )r�list_images)rr	Zimagesr
r
rr'rrcCrr)r�list_locations)rr	Z	locationsr
r
rr0rr�
list_nodescCr)z4
    List cloud provider data for all providers
    )r�query�Z
query_typer	�infor
r
rr9rr�list_nodes_fullcCr)z0
    List all available cloud provider data
    )r�
full_queryrr
r
rrBrr�list_nodes_selectcCr)z
    List selected nodes
    )r�select_queryrr
r
rrKrrcKs�|durd|vr|d}|durddiS|dur d|vr |d}|dur(ddiSt�}t|t�r6|j�|�|j||fitjjj	di|����}|S)z�
    Create a cloud vm with the given profile and instances, instances can be a
    list or comma-delimited string

    CLI Example:

    .. code-block:: bash

        salt-run cloud.profile prof=my-ec2 instances=node1,node2,node3
    N�profile�Errorz#A profile (or prof) must be defined�namesz3One or more instances (comma-delimited) must be setr
)
r�
isinstance�dict�opts�updaterr�utils�args�clean_kwargs)Zprof�	instancesr"�kwargsr	rr
r
rrTs
$rcKsBt�}t|t�r|j�|�|j|fitjjj	di|����}|S)z'
    Execute a salt cloud map file
    Nr
)
rr r!r"r#�map_runrr$r%r&)rr"r(r	rr
r
rr)rs

"r)cCs*t�}t|t�r|j�|�|�|�}|S)z!
    Destroy the named vm(s)
    )rr r!r"r#�destroy)r'r"r	rr
r
rr*}s


r*c
Ks|i}t�}t|t�r|j�|�z|�|||||tjjj	di|���}W|St
y=}	zt�|	�WYd}	~	|Sd}	~	ww)z�
    Execute a single action on the given map/provider/instance

    CLI Example:

    .. code-block:: bash

        salt-run cloud.action start my-salt-vm
    Nr
)
rr r!r"r#�actionrr$r%r&r�log�error)
�funcZcloudmapr'r�instancer"r(rr	�errr
r
rr+�s&
�
���r+cKsDt�}t|t�r|j�|�|j||fitjjj	di|����}|S)a
    Create an instance using Salt Cloud

    CLI Example:

    .. code-block:: bash

        salt-run cloud.create my-ec2-config myinstance \
            image=ami-1624987f size='t1.micro' ssh_username=ec2-user \
            securitygroup=default delvol_on_destroy=True
    Nr
)
rr r!r"r#�createrr$r%r&)rr'r"r(r	rr
r
rr1�s

$r1)r
)r)r)r)NNN)NN)N)NNNNNN)�__doc__�loggingrZ
salt.cloudrZsalt.utils.argsZsalt.exceptionsr�	getLogger�__name__r,rrrrrrrrr)r*r+r1r
r
r
r�<module>s2



	
	
	
	
	
	


�$