관리-도구
편집 파일: saltmaster.cpython-39.pyc
a -�_g � @ s6 d dl Z d dlZd dlmZmZ G dd� dee�ZdS )� N)�Plugin�IndependentPluginc @ s4 e Zd ZdZdZdZdZdd� Zdd� Zd d � Z dS )� SaltMasterzSalt MasterZ saltmaster)Zsysmgmt)zsalt-masterzsalt-apic C sR | � d�r| �d� n | �d� | �d� | �d� | �� | jg d�dd� d S ) NZall_logsz /var/log/saltz/var/log/salt/masterz /etc/saltz/etc/salt/pki/*/*.pem)zsalt-master --versionz#systemctl --full status salt-masterz systemctl --full status salt-apizsalt-key --list allz"salt-run jobs.list_jobs --out=yamlz%salt-run manage.list_state --out=yamlz)salt-run manage.list_not_state --out=yamlz!salt-run manage.joined --out=yaml� )�timeout)Z get_option� add_copy_specZadd_forbidden_path�add_pillar_rootsZadd_cmd_output)�self� r �A/usr/lib/python3.9/site-packages/sos/report/plugins/saltmaster.py�setup s �zSaltMaster.setupc C s� t � d�}d}| �|�r"|�|� g }|D ]r}t|ddd��P}zt�|��di ��dg �}W n tyr g }Y n0 |�|� W d � q*1 s�0 Y q*| � |� dS ) z+ Collect pilliar_roots of all salt configs z/etc/salt/master.d/*confz/etc/salt/master�rzUTF-8)�encodingZpillar_roots�baseN) �globZpath_exists�append�open�yamlZ safe_load�get�AttributeError�extendr )r ZcfgsZmain_cfgZall_pillar_rootsZcfg�fileZcfg_pillar_rootsr r r r , s �� *zSaltMaster.add_pillar_rootsc C s d}d}| � d||� d S )Nz4(^\s+.*(pass|secret|(?<![A-z])key(?![A-z])).*:\ ).+$z\1******z/etc/salt/*)Zdo_path_regex_sub)r Zregexp�substr r r �postprocB s zSaltMaster.postprocN) �__name__� __module__�__qualname__Z short_descZplugin_nameZprofilesZpackagesr r r r r r r r s r )r r Zsos.report.pluginsr r r r r r r �<module> s