File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/esxi.cpython-310.pyc
o
�N�g� � @ s� d Z ddlZddlZddlZddlmZ ddlZddlm Z m
Z
ddlmZm
Z
mZmZmZmZ ddlmZ zddlZdZW n eyI dZY nw e�e�Zz!dd lmZ d
ejv rmejdkrmejdk rme�d
� e� �dZW n ey{ dZY nw dd� Z dd� Z!e!d+dd��Z"e!dd� �Z#e! d,dd��Z$e!d-dd��Z%e!d.dd��Z&e! d/dd��Z'e! d0d d!��Z(ee�ee�e!d.d"d#����Z)ee�ee�e! $ d1d%d&����Z*d'd(� Z+d)d*� Z,dS )2a
Manage VMware ESXi Hosts.
.. Warning::
This module will be deprecated in a future release of Salt. VMware strongly
recommends using the
`VMware Salt extensions <https://docs.saltproject.io/salt/extensions/salt-ext-modules-vmware/en/latest/all.html>`_
instead of the ESXi module. Because the Salt extensions are newer and
actively supported by VMware, they are more compatible with current versions
of ESXi and they work well with the latest features in the VMware product
line.
Dependencies
============
- pyVmomi Python Module
- ESXCLI
pyVmomi
-------
PyVmomi can be installed via pip:
.. code-block:: bash
pip install pyVmomi
.. note::
Version 6.0 of pyVmomi has some problems with SSL error handling on certain
versions of Python. If using version 6.0 of pyVmomi, Python 2.6,
Python 2.7.9, or newer must be present. This is due to an upstream dependency
in pyVmomi 6.0 that is not supported in Python versions 2.7 to 2.7.8. If the
version of Python is not in the supported range, you will need to install an
earlier version of pyVmomi. See `Issue #29537`_ for more information.
.. _Issue #29537: https://github.com/saltstack/salt/issues/29537
Based on the note above, to install an earlier version of pyVmomi than the
version currently listed in PyPi, run the following:
.. code-block:: bash
pip install pyVmomi==5.5.0.2014.1.1
The 5.5.0.2014.1.1 is a known stable version that this original ESXi State
Module was developed against.
ESXCLI
------
Currently, about a third of the functions used in the vSphere Execution Module require
the ESXCLI package be installed on the machine running the Proxy Minion process.
The ESXCLI package is also referred to as the VMware vSphere CLI, or vCLI. VMware
provides vCLI package installation instructions for `vSphere 5.5`_ and
`vSphere 6.0`_.
.. _vSphere 5.5: http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.vcli.getstart.doc/cli_install.4.2.html
.. _vSphere 6.0: http://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vcli.getstart.doc/cli_install.4.2.html
Once all of the required dependencies are in place and the vCLI package is
installed, you can check to see if you can connect to your ESXi host or vCenter
server by running the following command:
.. code-block:: bash
esxcli -s <host-location> -u <username> -p <password> system syslog config get
If the connection was successful, ESXCLI was successfully installed on your system.
You should see output related to the ESXi host's syslog configuration.
.. note::
Be aware that some functionality in this state module may depend on the
type of license attached to the ESXi host.
For example, certain services are only available to manipulate service state
or policies with a VMware vSphere Enterprise or Enterprise Plus license, while
others are available with a Standard license. The ``ntpd`` service is restricted
to an Enterprise Plus license, while ``ssh`` is available via the Standard
license.
Please see the `vSphere Comparison`_ page for more information.
.. _vSphere Comparison: https://www.vmware.com/products/vsphere/compare
About
-----
This state module was written to be used in conjunction with Salt's
:mod:`ESXi Proxy Minion <salt.proxy.esxi>`. For a tutorial on how to use Salt's
ESXi Proxy Minion, please refer to the
:ref:`ESXi Proxy Minion Tutorial <tutorial-esxi-proxy>` for
configuration examples, dependency installation instructions, how to run remote
execution functions against ESXi hosts via a Salt Proxy Minion, and a larger state
example.
� N��wraps)�DiskGroupsDiskScsiAddressSchema�HostCacheSchema)�ArgumentValueError�CommandExecutionError�InvalidConfigError�VMwareApiError�VMwareObjectRetrievalError�VMwareSaltError)�dependsTF)�VmomiSupportz vim25/6.0)� � )r r � zFpyVmomi not loaded: Incompatible versions of Python. See Issue #29537.c C s dt v rdS dS )N�esxi.cmdT)Fzesxi module could not be loaded)�__salt__� r r �D/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/esxi.py�__virtual__� s r c s t � �� fdd��}|S )z>
Decorator wrapper to warn about azurearm deprecation
c s6 t jjjddtd� � | i t jjjdi |����}|S )NZArgonz�The 'esxi' functionality in Salt has been deprecated and its functionality will be removed in version 3008 in favor of the saltext.vmware Salt Extension. (https://github.com/saltstack/salt-ext-modules-vmware))�categoryr )�salt�utilsZversionsZ
warn_until�
FutureWarning�argsZclean_kwargs)r �kwargs�ret��functionr r �wrapped� s �z%_deprecation_message.<locals>.wrappedr )r r r r r �_deprecation_message� s r �vmk0�d c C sH | di dd�}d}d}t d d }t| d��|�} | �d �}
|
r*d
|
� �|d<