3 ܓi @ sB d dl mZ d dlmZ d dlmZmZmZ G dd deeZdS ) )match)quote)PluginRedHatPlugin PluginOptc @ sT e Zd ZdZdZdZdZeddd d gZdZ dZ d Zd Zdd Z dd Zdd ZdS )Pulpz Pulp platformZpulppulp-serverpulp-katellopython3-pulpcore/etc/pulp/settings.pytasks z*number of tasks to collect from DB queries)defaultZdescZ localhostZ27017 c C s d}d}yt dddd}|j j }W d Q R X x|D ]}td|rt|j d jd d jd}|d | _|d | _td|rd |j d | _td|rd|j d | _|j drd}|r6|j dr6|j d }d}q6W W n t k r Y nX | jddi | jdddddddddddg | j d }| jd!| d"}| jd!| d#} | jd!| d$} | jd%}| jd&}| j|d'd( | j| d)d( | j| d*d( | j|d+d( | j|d,d( x0d-D ](} | jd.| d/| d0d1| d2 qW | jd3d4d( d S )5Nr Fz/etc/pulp/server.confrzUTF-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_workersZpulp_worker_defaultsz/etc/pulp/*.confz/etc/pulp/settings.pyz/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()"zmongo-task_status)Zsuggest_filenamezmongo-reserved_resourceszpulp-running_taskszmongo-collection_sizeszmongo-db_statsZquczqpid-stat -z --ssl-certificate=z -b amqps://localhost:5671Z qpid_stat_)Ztagszosudo -u pulp PULP_SETTINGS='/etc/pulp/settings.py' DJANGO_SETTINGS_MODULE='pulpcore.app.settings' dynaconf listZ dynaconf_list)openread splitlinesr splitdbhostdbportdbuser dbpassword startswithIOErrorZ add_file_tagsZ add_copy_specZ get_optionbuild_mongo_cmdZadd_cmd_output)selfZmessaging_cert_fileZin_messaging_sectionfileZ pulp_lineslineZuriZ num_tasksZmtasksZmresZprunZcsizesZdbstatsopt r$ /usr/lib/python3.6/pulp.pysetup! sr z Pulp.setupc C s@ d}d| j d| j d| j d| j }d}|t|||f 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 ZqueryZ_cmdZ_mondbZ_moncmdr$ r$ r% r s $zPulp.build_mongo_cmdc C sb d}d}| j d|| d}d}| j d|| d}d}| j d|| | j d || | jd || d S )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*)z/etc/pulp/settings.pyz/etc/pulp/settings.local.pyz dynaconf list)Zdo_path_regex_subZdo_cmd_output_sub)r ZetcregreplZjregZkey_pass_rer$ r$ r% postproc s z Pulp.postprocN)r r r )r )__name__ __module____qualname__Z short_descZplugin_nameZpackagesfilesr Zoption_listr r r r r&