golden hour
/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/__pycache__
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.cpython-310.pyc
197 B
Del
OK
asam.cpython-310.pyc
7.9 KB
Del
OK
auth.cpython-310.pyc
1.89 KB
Del
OK
bgp.cpython-310.pyc
12.55 KB
Del
OK
cache.cpython-310.pyc
10.98 KB
Del
OK
cloud.cpython-310.pyc
4.16 KB
Del
OK
config.cpython-310.pyc
1.08 KB
Del
OK
ddns.cpython-310.pyc
6.7 KB
Del
OK
digicertapi.cpython-310.pyc
16.23 KB
Del
OK
doc.cpython-310.pyc
1.76 KB
Del
OK
drac.cpython-310.pyc
4.15 KB
Del
OK
error.cpython-310.pyc
771 B
Del
OK
event.cpython-310.pyc
2.32 KB
Del
OK
f5.cpython-310.pyc
8.29 KB
Del
OK
fileserver.cpython-310.pyc
17.12 KB
Del
OK
git_pillar.cpython-310.pyc
3.54 KB
Del
OK
http.cpython-310.pyc
2.55 KB
Del
OK
jobs.cpython-310.pyc
13.26 KB
Del
OK
launchd.cpython-310.pyc
1.49 KB
Del
OK
lxc.cpython-310.pyc
13.3 KB
Del
OK
manage.cpython-310.pyc
21.71 KB
Del
OK
mattermost.cpython-310.pyc
4.21 KB
Del
OK
mine.cpython-310.pyc
1.79 KB
Del
OK
nacl.cpython-310.pyc
8.46 KB
Del
OK
net.cpython-310.pyc
27.7 KB
Del
OK
network.cpython-310.pyc
2.59 KB
Del
OK
pagerduty.cpython-310.pyc
3.96 KB
Del
OK
pillar.cpython-310.pyc
4.25 KB
Del
OK
pkg.cpython-310.pyc
1.37 KB
Del
OK
queue.cpython-310.pyc
8.14 KB
Del
OK
reactor.cpython-310.pyc
4.32 KB
Del
OK
salt.cpython-310.pyc
4.58 KB
Del
OK
saltutil.cpython-310.pyc
15.88 KB
Del
OK
sdb.cpython-310.pyc
2.54 KB
Del
OK
smartos_vmadm.cpython-310.pyc
7.99 KB
Del
OK
spacewalk.cpython-310.pyc
7.54 KB
Del
OK
ssh.cpython-310.pyc
1000 B
Del
OK
state.cpython-310.pyc
8.22 KB
Del
OK
survey.cpython-310.pyc
5.07 KB
Del
OK
test.cpython-310.pyc
2.65 KB
Del
OK
thin.cpython-310.pyc
1.81 KB
Del
OK
vault.cpython-310.pyc
10.01 KB
Del
OK
venafiapi.cpython-310.pyc
5.57 KB
Del
OK
virt.cpython-310.pyc
13.15 KB
Del
OK
vistara.cpython-310.pyc
4.39 KB
Del
OK
winrepo.cpython-310.pyc
5.14 KB
Del
OK
Edit: vistara.cpython-310.pyc
o �xek � @ s\ d Z ddlZddlZddlZe�e�Zdd� Zdd� Z ddd �Z d d� Zdd � Zdd� Z dS )a Vistara Runner Runner to interact with the Vistara (http://www.vistarait.com/) REST API :codeauthor: Brad Thurber <brad.thurber@gmail.com> To use this runner, the Vistara client_id and Vistara oauth2 client_key and client_secret must be set in the master config. For example ``/etc/salt/master.d/_vistara.conf``: .. code-block:: yaml vistara: client_id: client_012345 client_key: N0tReallyaR3alKeyButShouldB12345 client_secret: ThisI5AreallyLongsecretKeyIwonderwhyTheyMakethemSoBigTheseDays00 � Nc C sT dt v rt d nd} | r(| �dd�}| �dd�}| �dd�}|r$|r$|s&dS dS dS ) z@ Check to see if master config has the necessary config �vistaraN� client_id� client_key� client_secret)Fzbvistara client_id or client_key or client_secret has not been specified in the Salt master config.T)Fzdvistara config has not been specificed in the Salt master config. See documentation for this runner.)�__opts__�get)Zvistara_configr r r � r �H/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/vistara.py�__virtual__! s r c C s$ t d d t d d t d d d�S )zF Return the Vistara configuration read from the master config r r r r )r r r )r r r r r �_get_vistara_configuration; s �r Tc C s� t � }|sdS t|d |d �}|sdS d�| �}t||d |�}|s%dS t|�}|r4|dkr4d �|�S g }|D ]}|d } t�| � t| |d |�} | sP dS |�| � q8|S )a� Deletes a device from Vistara based on DNS name or partial name. By default, delete_device will only perform the delete if a single host is returned. Set safety_on=False to delete all matches (up to default API search page size) CLI Example: .. code-block:: bash salt-run vistara.delete_device 'hostname-101.mycompany.com' salt-run vistara.delete_device 'hostname-101' salt-run vistara.delete_device 'hostname-1' safety_on=False Fr r z"Vistara access token not availablez dnsName:{}r zNo devices found� zJExpected to delete 1 device and found {}. Set safety_on=False to override.�id) r �_get_oath2_access_token�format�_search_devices�len�log�debug�_delete_resource�append)�nameZ safety_onZconfig�access_token�query_stringZdevicesZdevice_countZdelete_responsesZdevice� device_idZdelete_responser r r � delete_deviceF s4 � � r c C sv d� |�}|ddd�}d| i}d}d� |�}tjjj||||td�}|�dd �} | s,d S tjj�|d �} | d }|S )N� Bearer {}�application/json�Z Authorization�Content-Type�AcceptZqueryStringZGETz7https://api.vistara.io/api/v2/tenants/{}/devices/search��url�method�header_dict�params�opts�bodyF�results� r �salt�utils�http�queryr r �json�loads)r r r � authstring�headersr$ r"