File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/purefa.cpython-310.pyc
Back
o ;ja� � @ s� d Z ddlZddlZddlmZ ddlmZ zddlZdZW n ey) dZY nw dZ dZ d Zd ZdZ dd � Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� ZdLdd�ZdMd d!�ZdLd"d#�ZdLd$d%�ZdNd&d'�Zd(d)� Zd*d+� ZdNd,d-�ZdNd.d/�Zd0d1� Z d2d3� Z!dOd4d5�Z"dOd6d7�Z#d8d9� Z$dPd:d;�Z%dPd<d=�Z&d>d?� Z'dPd@dA�Z(dQdBdC�Z)dOdDdE�Z*dNdFdG�Z+dHdI� Z,dOdJdK�Z-dS )Ra, Management of Pure Storage FlashArray Installation Prerequisites -------------------------- - You will need the ``purestorage`` python package in your python installation path that is running salt. .. code-block:: bash pip install purestorage - Configure Pure Storage FlashArray authentication. Use one of the following three methods. 1) From the minion config .. code-block:: yaml pure_tags: fa: san_ip: management vip or hostname for the FlashArray api_token: A valid api token for the FlashArray being managed 2) From environment (PUREFA_IP and PUREFA_API) 3) From the pillar (PUREFA_IP and PUREFA_API) :maintainer: Simon Dodsley (simon@purestorage.com) :maturity: new :requires: purestorage :platform: all .. versionadded:: 2018.3.0 � N)�datetime)�CommandExecutionErrorTFzrestructuredtext enz1.0.0ZSaltZpurefa)Z23456789ZABCDEFGHJKLMNPQRSTUVWXYZZabcdefghijkmnopqrstuvwxyzc C s t rtS dS )z6 Determine whether or not to load this module )FzMpurefa execution module not loaded: purestorage python library not available.)�HAS_PURESTORAGE�__virtualname__� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/purefa.py�__virtual__S s r c C s t ttt�� d�} djd i | ��}z td d �d�}td d �d�}|r0|r0tj|||d�}W nK t t tfy| ztj �d�}tj �d �}tj|||d�}W n( tt t fyy ztjtd td |d�}W n t t fyv td ��w Y nw Y nw z|�� W |S ty� td��w )ae Get Pure Storage FlashArray configuration 1) From the minion config pure_tags: fa: san_ip: management vip or hostname for the FlashArray api_token: A valid api token for the FlashArray being managed 2) From environment (PUREFA_IP and PUREFA_API) 3) From the pillar (PUREFA_IP and PUREFA_API) )�base�class�version�platformz%{base} {class}/{version} ({platform})Z pure_tags�fa�san_ip� api_token)r � user_agentZ PUREFA_IPZ PUREFA_APIz-No Pure Storage FlashArray credentials found.z.Pure Storage FlashArray authentication failed.Nr )�USER_AGENT_BASE�__name__�VERSIONr �formatZ__opts__�get�purestorageZ FlashArray�KeyError� NameError� TypeError�os�environ� ValueErrorZ __pillar__r � Exception)Zagentr �arrayZapi�systemr r r r r �_get_system_ sR �� � ������� ��r c C s$ z|� | �W S tjy Y dS w )z Private function to check volumeN�Z get_volumer � PureError��namer r r r �_get_volume� s �r% c C sT | d | }z|j | dd�D ] }|d |kr| W S qW dS tjy) Y dS w )z"Private function to check snapshot�.T)�snapr$ Nr! )r$ �suffixr Zsnapshotr'