
    -_g                     H    d dl mZ d dlmZ d dlmZmZmZ  G d dee      Zy)    )match)quote)PluginRedHatPlugin	PluginOptc                   V    e Zd ZdZdZdZdZ eddd      gZd	Z	d
Z
dZdZd Zd Zd Zy)PulpzPulp platformpulp)zpulp-serverzpulp-katellozpython3-pulpcore)/etc/pulp/settings.pytasks   z*number of tasks to collect from DB queries)defaultdesc	localhost27017 c                    d}d}	 t        ddd      5 }|j                         j                         }d d d        D ]  }t        d|      rH|j	                         d   j	                  d	      d
   j	                  d      }|d
   | _        |d   | _        t        d|      rd|j	                         d    | _        t        d|      rd|j	                         d    | _        |j                  d      rd}|s|j                  d      s|j	                         d   }d} 	 | j                  ddi       | j                  g d       | j                  d      }| j                  d| d      }| j                  d| d      }	| j                  d| d      }
| j                  d      }| j                  d      }| j                  |d       | j                  |	d       | j                  |
d        | j                  |d!       | j                  |d"       d#D ]  }| j                  d$| d%| d&d'| (       ! | j                  d)d*       y # 1 sw Y    xY w# t        $ r Y Hw xY w)+Nr   Fz/etc/pulp/server.confrzUTF-8)encodingz^\s*seeds:\s+\S+:\S+   ,r   :z\s*username:\s+\S+z-u z\s*password:\s+\S+z-p z[messaging]Tz	certfile:z/etc/default/pulp_workerspulp_worker_defaults)z/etc/pulp/*.confr   /etc/pulp/settings.local.pyz /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   z"DBQuery.shellBatchSize=zG;; db.task_status.find().sort({finish_time: -1}).pretty().shellPrint()"z6;; db.reserved_resources.find().pretty().shellPrint()"zK;; 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()"zmongo-task_status)suggest_filenamezmongo-reserved_resourceszpulp-running_taskszmongo-collection_sizeszmongo-db_statsquczqpid-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)openread
splitlinesr   splitdbhostdbportdbuser
dbpassword
startswithIOErroradd_file_tagsadd_copy_spec
get_optionbuild_mongo_cmdadd_cmd_output)selfmessaging_cert_filein_messaging_sectionfile
pulp_lines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    !$	-sWE 6!YY[335
6" 10$7**,q///4Q7==cBC"%a&DK"%a&DK.5$'

Q'8"9DK.5(+DJJLO+<&=DO??=1+/('DOOK,H*.**,q/'+0(1$ 	')?
 	 	 
 	 OOG,	%%'	{ 3' '
 ##'	{ 3C C

 ##'	{ 3 
 %%M
. &&'78F5HID3MND3GHF5MNG6FG 	)CcU"5&''AC!#'   )	) 	K, 	 	
A6 6   		s4   I ICI 8I 
I II 	I+*I+c                     d}d| j                    d| j                   d| j                   d| j                   }d}|t	        |||fz        z  S )z Build mongoDB command z
bash -c %sz--host z --port  z mongo pulp_database %s --eval %s)r$   r%   r&   r'   r   )r/   query_cmd_mondb_moncmds        r=   r-   zPulp.build_mongo_cmd   sW    DKK=Qt{{m1__%'4eGvuo5666    c                     d}d}| j                  d||       d}d}| j                  d||       d}d}| j                  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$)z_((?:SECRET_KEY|AUTH_LDAP_BIND_PASSWORD)(?:\<.+\>)?(\s*=)?|(password|PASSWORD)(\"|'|:)+)\s*(\S*)r   r   zdynaconf list)do_path_regex_subdo_cmd_output_sub)r/   etcregrepljregkey_pass_res        r=   postproczPulp.postproc   s     E7F
 J6dC, 6TJ<k#	%TBrE   N)__name__
__module____qualname__
short_descplugin_namepackagesfilesr   option_listr$   r%   r&   r'   r>   r-   rM    rE   r=   r	   r	      sU     JKBH&E'3C	EK
 FFFJt
l7CrE   r	   N)	rer   shlexr   sos.report.pluginsr   r   r   r	   rV   rE   r=   <module>rZ      s%      > >kC6< kCrE   