�
i��dZ � �H � d dl mZmZmZ d dlmZ d dlmZ G d� dee� Zy)� )�Plugin�RedHatPlugin� PluginOpt)�quote)�matchc �F � e Zd ZdZdZdZdZ eddd�� gZd � Z d
� Z
d� Zy)
�Pulpz
Pulp platform�pulp)zpulp-serverzpulp-katellozpython3-pulpcore)�/etc/pulp/settings.py�tasks�� z*number of tasks to collect from DB queries)�default�descc � � d| _ d| _ d| _ d| _ d| _ d} t d� j
� j � D ]� }t d|� rH|j � d j d� d j d
� }|d | _ |d | _ t d|� rd|j � d z | _ t d
|� rd|j � d z | _ |j d� rd}|s��|j d� s��|j � d | _ d}�� | j ddi� | j g d�� | j d� }| j d|z � }| j d|z � }| j d|z � }| j d� }| j d� } | j! |d�� | j! |d�� | j! |d�� | j! |d�� | j! | d �� d!D ]) }
| j! d"|
� d#| j � d$�d%|
� ��&� �+ | j! d'd(�� y # t $ r Y ��Bw xY w))N� localhost�27017� Fz/etc/pulp/server.confz^\s*seeds:\s+\S+:\S+� �,r �:z\s*username:\s+\S+z-u %sz\s*password:\s+\S+z-p %sz[messaging]Tz certfile:z/etc/default/pulp_workers�pulp_worker_defaults)
z/etc/pulp/*.confr z /etc/pulp/server/plugins.conf.d/z/etc/default/pulp*z/var/log/httpd/pulp-http.log*z/var/log/httpd/pulp-https.log*z(/var/log/httpd/pulp-http_access_ssl.log*z)/var/log/httpd/pulp-https_access_ssl.log*z'/var/log/httpd/pulp-http_error_ssl.log*z(/var/log/httpd/pulp-https_error_ssl.log*r za"DBQuery.shellBatchSize=%s;; db.task_status.find().sort({finish_time: -1}).pretty().shellPrint()"zP"DBQuery.shellBatchSize=%s;; db.reserved_resources.find().pretty().shellPrint()"ze"DBQuery.shellBatchSize=%s;; db.task_status.find({state:{\$ne: \"finished\"}}).pretty().shellPrint()"a� "function humanReadable(bytes) { var i = -1; var byteUnits = ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; do { bytes = bytes / 1024; i++; } while (bytes > 1024); return Math.max(bytes, 0.1).toFixed(1) + ' ' + byteUnits[i];};var collectionNames = db.getCollectionNames(), stats = [];collectionNames.forEach(function (n) { stats.push(db[n].stats()); });stats = stats.sort(function(a, b) { return b['size'] - a['size']; });for (var c in stats) { print(stats[c]['ns'] + ': ' + humanReadable(stats[c]['size']) + ' (' + humanReadable(stats[c]['storageSize']) + ')'); }"z"db.stats()"zmongo-task_status)�suggest_filenamezmongo-reserved_resourceszpulp-running_taskszmongo-collection_sizeszmongo-db_stats�quczqpid-stat -z --ssl-certificate=z -b amqps://localhost:5671�
qpid_stat_)�tagszosudo -u pulp PULP_SETTINGS='/etc/pulp/settings.py' DJANGO_SETTINGS_MODULE='pulpcore.app.settings' dynaconf list�
dynaconf_list)�dbhost�dbport�dbuser�
dbpassword�messaging_cert_file�open�read�
splitlinesr �split�
startswith�IOError�
add_file_tags�
add_copy_spec�
get_option�build_mongo_cmd�add_cmd_output)�self�in_messaging_section�line�uri� num_tasks�mtasks�mres�prun�csizes�dbstats�opts �9/usr/lib/python3/dist-packages/sos/report/plugins/pulp.py�setupz
Pulp.setup s� � � "������������#%�� �$�� ��4�5�:�:�<�G�G�I�
1���0�$�7��*�*�,�q�/�/�/��4�Q�7�=�=�c�B�C�"%�a�&�D�K�"%�a�&�D�K��.��5�")�D�J�J�L��O�";�D�K��.��5�&-��
�
��Q��&?�D�O��?�?�=�1�+/�(�'�D�O�O�K�,H�/3�z�z�|�A��D�,�+0�(�
1�$
���'�)?�
� �
���
� � �O�O�G�,� ��%�%�
'�)2�
3�
�� �#�#�
C�EN�
O�
��
�#�#�
� )�
*�
�� �%�%�
M�
��. �&�&�'7�8�����F�5H��I����D�3M��N����D�3G��H����F�5M��N����G�6F��G�� )�C�����c�U�"5��+�+�,�,F�H�!�#��'�
�
)� )�
���
K�,� �
��_ � �� �s �C!I. � I. �I. �. I;�:I;c � � d}d| j �d| j �d| j �d| j ��}d}|t |||fz � z S )Nz
bash -c %sz--host z --port � z mongo pulp_database %s --eval %s)r r r r r )r- �query�_cmd�_mondb�_moncmds r8 r+ zPulp.build_mongo_cmd� sG � ���04���T�[�[�04���T�_�_�N��4���e�G�v�u�o�5�6�6�6� c � � d}d}| j d||� d}d}| j d||� d}d}| j d||� | j d ||� y )
Nz0(([a-z].*(passw|token|cred|secret).*)\:(\s))(.*)z\1 ********z/etc/pulp/(.*)\.conf$z7(\s*\".*(passw|cred|token|secret).*\"\s*:(\s))(.*)(\w+)z
\1********z/etc/pulp(.*)(.json$)z5(SECRET_KEY\s*=|(password|PASSWORD)(\"|'|:)+)\s*(\S*)r z
dynaconf list)�do_path_regex_sub�do_cmd_output_sub)r- �etcreg�repl�jreg�key_pass_res r8 �postprocz
Pulp.postproc� st � � E�������7���F�
J�������6��d�C�
O�������6��T�J������T�Br@ N)�__name__�
__module__�__qualname__�
short_desc�plugin_name�packages�filesr �option_listr9 r+ rH � r@ r8 r r s? � � �J��K�B�H�&�E��'�3�C� E��K�
u
�n7�Cr@ r N) �sos.report.pluginsr r r �pipesr �rer r rQ r@ r8 �<module>rU s% �� ?� >� � �aC�6�<� aCr@ |