HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/pulpcore.cpython-38.pyc
U

i��d>�@sBddlmZmZmZddlmZddlmZGdd�dee�ZdS)�)�Plugin�IndependentPlugin�	PluginOpt)�quote)�matchc@sNeZdZdZdZdZdZedddd�gZd	d
�Z	dd�Z
ddd�Zdd�ZdS)�PulpCorezPulp-3 aka pulpcore�pulpcore)zpulpcore-manager)�/etc/pulp/settings.py�	task-days�zdays of task history)�defaultZdesccCsjd}d|_d|_d|_d|_d|_d|_d d	d
�}�ztd����dd
��dd��dd��	�D]�}|r^|ddkrtq^|�
d�r�d}q^d}|r�t|d|�r�||�|_|r�t|d|�r�||�|_|r�t|d|�r�||�|_|r�t|d|�r�||�|_|�rd|k�rd}|�
d��r&||dd�|_|�
d�r^||dd�|_q^Wntk
�rXYnXd|ji|_
dS)!NFZ	localhosti8r�z/var/lib/pulp/assetsz/var/lib/pulp/media/upload�:cSsP|�|�d���d�}|�d�r,|�d�s@|�d�rL|�d�rL|dd�}|S)N��,�"�'���)�split�lstrip�rstrip�
startswith�endswith)�line�sep�val�r�=/usr/lib/python3/dist-packages/sos/report/plugins/pulpcore.py�separate_value&s��z6PulpCore.parse_settings_config.<locals>.separate_valuer	rz,
�{z{
�}z
}r�#Z	DATABASESTz\s*['|\"]%s['|\"]\s*:\s*\S+ZHOSTZPORT�NAMEZPASSWORDzSTATIC_ROOT = �=)rzCHUNKED_UPLOAD_DIR = Z
PGPASSWORD)r)�dbhost�dbport�dbnameZdbpasswd�
staticroot�	uploaddir�open�read�replace�
splitlinesrr�IOError�env)�selfZdatabases_scoperr�patternrrr�parse_settings_configsT
	���





zPulpCore.parse_settings_configcCs�|��|�ddg�|�d�|jddd�dddd	�}|jd
|d�|j|jfD]}|�d|�qT|�d
�}dD],}d||f}|�|�}|j||j|d�qv|�d�}|j|d|jd�dS)Nr	z/etc/pki/pulp/*z/etc/pki/pulp/**/*.keyz.curl -ks https://localhost/pulp/api/v3/status/Zpulp_status)�suggest_filenamezen_US.UTF-8zpulpcore.app.settings)�LC_ALLZ
PULP_SETTINGSZDJANGO_SETTINGS_MODULE�
dynaconf list)r.zls -l %sr
)Z	core_taskZcore_taskgroupZcore_groupprogressreportZcore_progressreportz`select * from %s where pulp_last_updated > NOW() - interval '%s days' order by pulp_last_updated)r.r2a[SELECT table_name, pg_size_pretty(total_bytes) AS total, pg_size_pretty(index_bytes) AS INDEX , pg_size_pretty(toast_bytes) AS toast, pg_size_pretty(table_bytes) AS TABLE FROM ( SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM (SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME, c.reltuples AS row_estimate, pg_total_relation_size(c.oid) AS total_bytes, pg_indexes_size(c.oid) AS index_bytes, pg_total_relation_size(reltoastrelid) AS toast_bytes FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE relkind = 'r') a) a order by total_bytes DESCZpulpcore_db_tables_sizes)r2r.)	r1Z
add_copy_specZadd_forbidden_pathZadd_cmd_outputr'r(Z
get_option�build_query_cmdr.)r/Zdynaconf_envZ_dirZ	task_days�tableZ_queryZ_cmdrrr�setupTs:�
��
�
��zPulpCore.setupFcCs*|rd|}d}||j|j|jt|�fS)aI
        Builds the command needed to invoke the pgsql query as the postgres
        user.
        The query requires significant quoting work to satisfy both the
        shell and postgres parsing requirements. Note that this will generate
        a large amount of quoting in sos logs referencing the command being run
        z>COPY (%s) TO STDOUT WITH (FORMAT 'csv', DELIMITER ',', HEADER)z2psql --no-password -h %s -p %s -U pulp -d %s -c %s)r$r%r&r)r/ZqueryZcsvZ_dbcmdrrrr5�s�zPulpCore.build_query_cmdcCs<|�ddd�|�ddd�|�ddd�|�ddd�dS)	Nr	z(SECRET_KEY\s*=\s*)(.*)z
\1********z(PASSWORD\S*\s*:\s*)(.*?)(,|\})z\1********\3r4z(SECRET_KEY<str>\s*)'(.*)'z(PASSWORD\S*\s*:\s*)(.*))Zdo_path_regex_subZdo_cmd_output_sub)r/rrr�postproc�s(����zPulpCore.postprocN)F)
�__name__�
__module__�__qualname__Z
short_descZplugin_nameZcommands�filesrZoption_listr1r7r5r8rrrrrs�9/
rN)	Zsos.report.pluginsrrrZpipesr�rerrrrrr�<module>s