File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/cloud/clouds/__pycache__/gce.cpython-310.pyc
o
�N�g? � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl
ZddlZddl
ZddlZddlT ddlmZ ddlmZ ddlmZ dZz(ddlZddlmZmZ dd lmZ dd
lmZ dd lmZ dd
l!mZ" dZ#W n e$y� e�%� ZdZ#Y nw e�&e'�Z(d
Z)dZ*dZ+ee,e-� �Z,ee.e-� �Z.ee/e-� �Z/ee0e-� �Z0ee1e-� �Z1ee2e-� �Z2e�3d�Z4dd� Z5dd� Z6dd� Z7dd� Z8d�dd�Z9dd� Z:dd� Z;dd � Z<d!d"� Z=d#d$� Z>d%d&� Z?d�d'd(�Z@d�d)d*�ZAd�d+d,�ZBd-d.� ZCd/d0� ZDd1d2� ZEd3d4� ZFd5d6� ZGd7d8� ZHd9d:� ZId;d<� ZJd=d>� ZKd?d@� ZLdAdB� ZMdCdD� ZNdEdF� ZOdGdH� ZPd�dIdJ�ZQd�dKdL�ZRd�dMdN�ZSd�dOdP�ZTd�dQdR�ZUd�dSdT�ZVd�dUdV�ZWd�dWdX�ZXd�dYdZ�ZYd�d[d\�ZZd�d]d^�Z[d�d_d`�Z\d�dadb�Z]d�dcdd�Z^d�dedf�Z_d�dgdh�Z`d�didj�Zad�dkdl�Zbd�dmdn�Zcd�dodp�Zdd�dqdr�Zed�dsdt�Zfd�dudv�Zgd�dwdx�Zhd�dydz�Zid�d{d|�Zjd�d}d~�Zkd�dd��Zld�d�d��Zmd�d�d��Znd�d�d��Zod�d�d��Z/d�d�d��Zpd�d�� Zqd�d�d��Zrd�d�d��Zsd�d�d��ZtdS )�a�
Copyright 2013 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Google Compute Engine Module
============================
The Google Compute Engine module. This module interfaces with Google Compute
Engine (GCE). To authenticate to GCE, you will need to create a Service Account.
To set up Service Account Authentication, follow the :ref:`gce_setup` instructions.
Example Provider Configuration
------------------------------
.. code-block:: yaml
my-gce-config:
# The Google Cloud Platform Project ID
project: "my-project-id"
# The Service Account client ID
service_account_email_address: 1234567890@developer.gserviceaccount.com
# The location of the private key (PEM format)
service_account_private_key: /home/erjohnso/PRIVKEY.pem
driver: gce
# Specify whether to use public or private IP for deploy script.
# Valid options are:
# private_ips - The salt-master is also hosted with GCE
# public_ips - The salt-master is hosted outside of GCE
ssh_interface: public_ips
:maintainer: Eric Johnson <erjohnso@google.com>
:maintainer: Russell Tolle <russ.tolle@gmail.com>
:depends: libcloud >= 1.0.0
� N)�literal_eval)�*)�SaltCloudSystemExit)�namespaced_function)�Version)�ResourceInUseError�ResourceNotFoundError)�
get_driver)�ProviderTF�gcez
salt-cloudz0.2.0z'^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$c C s� t sdS ttj�td�k rdS t� du rdS t� du rdS td �� D ]$\} }d|vr,q#|d }tj �
|d �}|rGtjj
�| |�du rG dS q#tS )zI
Set up the libcloud functions and check for GCE configurations.
)Fz apache-libcloud is not installedz2.5.0)Fz9The salt-cloud GCE driver requires apache-libcloud>=2.5.0FZ providersr �service_account_private_key)�HAS_LIBCLOUDr �libcloud�__version__�get_configured_provider�get_dependencies�__opts__�items�os�path�
expanduser�salt�utilsZcloudZcheck_key_path_and_mode�__virtualname__)�provider�detailsZ
parameters�pathname� r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/cloud/clouds/gce.py�__virtual__h s&