File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/aixpkg.cpython-310.pyc
o
�N�g�_ � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl
mZ e�e
�ZdZdd� Zdd� Zd d
� Zdd� Zddd�Zdd� Zdd� Zddd�Zddd�Zdd� Zejj�ed�Zdd� ZdS ) a+
Package support for AIX
.. important::
If you feel that Salt should be using this module to manage filesets or
rpm packages on a minion, and it is using a different module (or gives an
error similar to *'pkg.install' is not available*), see :ref:`here
<module-provider-override>`.
� N)�CommandExecutionErrorZpkgc C s t d dkrtS dS )z5
Set the virtual pkg module if the os is AIX
Z os_familyZAIX)Fz&Did not load AIX module on non-AIX OS.)Z
__grains__�__virtualname__� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aixpkg.py�__virtual__ s r c
C s� i }dd| g}t d |dd�}d|d kr]d}d}d}|d �� }|D ]4}|�d
�r+q#|�d�} t| �dk rBtd
d| d �� id��d| d v rO| d }d}n| d }| d } |||fS td
d|d �� id��)zF
Return name, version and if rpm package for specified target
�/usr/bin/lslpp�-Lc�cmd.run_allF��python_shellr �retcode� �stdout�#�:� z&Error occurred finding fileset/package�errors� ��info�R� T� �stderr)�__salt__�
splitlines�
startswith�split�lenr �strip)
�target�ret�cmd�result�name�version_num�rpmpkg�lines�line�compsr r r �
_check_pkg% s8
�
�r* c C s dd| g}t d |�dkS )zP
Returns True if the rpm package is installed. Otherwise returns False.
�/usr/bin/rpmz-q�cmd.retcoder �r )r$ r"