File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/wheel/__pycache__/key.cpython-310.pyc
Back
o ;j�6 � @ s d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl mZ ddd�Ze� e�Zdd� Zd d � Zdd� Zd+dd�Zd+dd�Zdd� Zdd� Zd+dd�Zd+dd�Zdd� Zdd� Zd,dd�Zd,d d!�Zd-d#d$�Zd.d%d&�Zd/d'd(�Zd0d)d*�Z dS )1a? Wheel system wrapper for the Salt key system to be used in interactions with the Salt Master programmatically. The key module for the wheel system is meant to provide an internal interface for other Salt systems to interact with the Salt Master. The following usage examples assume that a WheelClient is available: .. code-block:: python import salt.config import salt.wheel opts = salt.config.master_config('/etc/salt/master') wheel = salt.wheel.WheelClient(opts) Note that importing and using the ``WheelClient`` must be performed on the same machine as the Salt Master and as the same user that runs the Salt Master, unless :conf_master:`external_auth` is configured and the user is authorized to execute wheel functions. The function documentation starts with the ``wheel`` reference from the code sample above and use the :py:class:`WheelClient` functions to show how they can be called from a Python interpreter. The wheel key functions can also be called via a ``salt`` command at the CLI using the :mod:`saltutil execution module <salt.modules.saltutil>`. � N)�clean�list�print)�list_�key_strc C �: t j�t�� }|�| �W d � S 1 sw Y dS )a� List all the keys under a named status. Returns a dictionary. match The type of keys to list. The ``pre``, ``un``, and ``unaccepted`` options will list unaccepted/unsigned keys. ``acc`` or ``accepted`` will list accepted/signed keys. ``rej`` or ``rejected`` will list rejected keys. Finally, ``all`` will list all keys. .. code-block:: python >>> wheel.cmd('key.list', ['accepted']) {'minions': ['minion1', 'minion2', 'minion3']} N)�salt�key�get_key�__opts__Zlist_status��match�skey� r �B/opt/saltstack/salt/lib/python3.10/site-packages/salt/wheel/key.pyr 0 s $�r c C s8 t j�t��} | �� W d � S 1 sw Y dS )a� List all the keys. Returns a dictionary containing lists of the minions in each salt-key category, including ``minions``, ``minions_rejected``, ``minions_denied``, etc. Returns a dictionary. .. code-block:: python >>> wheel.cmd('key.list_all') {'local': ['master.pem', 'master.pub'], 'minions_rejected': [], 'minions_denied': [], 'minions_pre': [], 'minions': ['minion1', 'minion2', 'minion3']} N)r r r r Zall_keys)r r r r �list_allC s $�r c C r )z1 List all the keys based on a glob match N)r r r r � name_matchr r r r r T s $�r Fc C �@ t j�t��}|j| ||d�W d � S 1 sw Y dS )a Accept keys based on a glob match. Returns a dictionary. match The glob match of keys to accept. include_rejected To include rejected keys in the match along with pending keys, set this to ``True``. Defaults to ``False``. include_denied To include denied keys in the match along with pending keys, set this to ``True``. Defaults to ``False``. .. code-block:: python >>> wheel.cmd('key.accept', ['minion1']) {'minions': ['minion1']} )�include_rejected�include_deniedN�r r r r �accept�r r r r r r r r \ � �$�r c C r )a` Accept keys based on a dict of keys. Returns a dictionary. match The dictionary of keys to accept. include_rejected To include rejected keys in the match along with pending keys, set this to ``True``. Defaults to ``False``. .. versionadded:: 2016.3.4 include_denied To include denied keys in the match along with pending keys, set this to ``True``. Defaults to ``False``. .. versionadded:: 2016.3.4 Example to move a list of keys from the ``minions_pre`` (pending) directory to the ``minions`` (accepted) directory: .. code-block:: python >>> wheel.cmd('key.accept_dict', { 'minions_pre': [ 'jerry', 'stuart', 'bob', ], }) {'minions': ['jerry', 'stuart', 'bob']} )� match_dictr r Nr r r r r �accept_dictv s "�$�r c C r )a- Delete keys based on a glob match. Returns a dictionary. match The glob match of keys to delete. .. code-block:: python >>> wheel.cmd_async({'fun': 'key.delete', 'match': 'minion1'}) {'jid': '20160826201244808521', 'tag': 'salt/wheel/20160826201244808521'} N�r r r r Z delete_keyr r r r �delete� s $�r c C s<