-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ 4bcb6f7 🚀
- Loading branch information
1 parent
008b8da
commit f1af74f
Showing
88 changed files
with
46,907 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 8165c01eaef52589c9cc44d3fe1aa62b | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
303 changes: 303 additions & 0 deletions
303
8.2/_modules/bodhi/messages/schemas/buildroot_override.html
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,251 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en" data-content_root="../../../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>bodhi.server.logging — bodhi 8.1.1 documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=fa44fd50" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/basic.css?v=c058f7c8" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/alabaster.css?v=1f462c57" /> | ||
<script src="../../../_static/documentation_options.js?v=23ce250a"></script> | ||
<script src="../../../_static/doctools.js?v=9a2dae69"></script> | ||
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<link rel="index" title="Index" href="../../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../../search.html" /> | ||
|
||
<link rel="stylesheet" href="../../../_static/custom.css" type="text/css" /> | ||
|
||
|
||
|
||
|
||
|
||
</head><body> | ||
|
||
|
||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
|
||
|
||
<div class="body" role="main"> | ||
|
||
<h1>Source code for bodhi.server.logging</h1><div class="highlight"><pre> | ||
<span></span><span class="c1"># Copyright © 2019 Red Hat, Inc.</span> | ||
<span class="c1">#</span> | ||
<span class="c1"># This file is part of Bodhi.</span> | ||
<span class="c1">#</span> | ||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span> | ||
<span class="c1"># it under the terms of the GNU General Public License as published by</span> | ||
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span> | ||
<span class="c1"># (at your option) any later version.</span> | ||
<span class="c1">#</span> | ||
<span class="c1"># This program is distributed in the hope that it will be useful,</span> | ||
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span> | ||
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> | ||
<span class="c1"># GNU General Public License for more details.</span> | ||
<span class="c1">#</span> | ||
<span class="c1"># You should have received a copy of the GNU General Public License along</span> | ||
<span class="c1"># with this program; if not, write to the Free Software Foundation, Inc.,</span> | ||
<span class="c1"># 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.</span> | ||
<span class="sd">"""Utilities for logging in Bodhi."""</span> | ||
|
||
<span class="kn">import</span> <span class="nn">logging</span> | ||
|
||
<span class="kn">from</span> <span class="nn">pyramid</span> <span class="kn">import</span> <span class="n">paster</span> | ||
<span class="kn">import</span> <span class="nn">yaml</span> | ||
|
||
<span class="kn">from</span> <span class="nn">bodhi.server</span> <span class="kn">import</span> <span class="n">config</span> | ||
|
||
|
||
<span class="k">def</span> <span class="nf">setup</span><span class="p">():</span> | ||
<span class="w"> </span><span class="sd">"""Set up logging from our config file."""</span> | ||
<span class="n">pyramid_includes</span> <span class="o">=</span> <span class="n">config</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'pyramid.includes'</span><span class="p">,</span> <span class="s1">''</span><span class="p">)</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">'</span><span class="se">\n</span><span class="s1">'</span><span class="p">)</span> | ||
<span class="k">if</span> <span class="s1">'pyramid_sawing'</span> <span class="ow">in</span> <span class="n">pyramid_includes</span><span class="p">:</span> | ||
<span class="c1"># This Bodhi deployment is using pyramid_sawing to configure logging. This means that we</span> | ||
<span class="c1"># cannot use paster.setup_logging() because the main config file doesn't have the logging</span> | ||
<span class="c1"># settings. Let's read the main config file to find out where the logging settings are.</span> | ||
<span class="n">logging_config</span> <span class="o">=</span> <span class="n">config</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s1">'pyramid_sawing.file'</span><span class="p">]</span> | ||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">logging_config</span><span class="p">)</span> <span class="k">as</span> <span class="n">logging_config_file</span><span class="p">:</span> | ||
<span class="n">logging_config</span> <span class="o">=</span> <span class="n">yaml</span><span class="o">.</span><span class="n">safe_load</span><span class="p">(</span><span class="n">logging_config_file</span><span class="o">.</span><span class="n">read</span><span class="p">())</span> | ||
<span class="n">logging</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">dictConfig</span><span class="p">(</span><span class="n">logging_config</span><span class="p">)</span> | ||
<span class="k">else</span><span class="p">:</span> | ||
<span class="n">paster</span><span class="o">.</span><span class="n">setup_logging</span><span class="p">(</span><span class="n">config</span><span class="o">.</span><span class="n">get_configfile</span><span class="p">())</span> | ||
|
||
|
||
<div class="viewcode-block" id="RateLimiter"> | ||
<a class="viewcode-back" href="../../../administration.html#bodhi.server.logging.RateLimiter">[docs]</a> | ||
<span class="k">class</span> <span class="nc">RateLimiter</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">Filter</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Log filter that rate-limits logs based on time.</span> | ||
|
||
<span class="sd"> The rate limit is applied to records by filename and line number.</span> | ||
|
||
<span class="sd"> Filters can be applied to handlers and loggers. Configuring this via</span> | ||
<span class="sd"> dictConfig is possible, but has somewhat odd syntax::</span> | ||
|
||
<span class="sd"> log_config = {</span> | ||
<span class="sd"> "filters": {</span> | ||
<span class="sd"> "60_second_filter": {</span> | ||
<span class="sd"> "()": "fedmsg_migration_tools.filters.RateLimiter",</span> | ||
<span class="sd"> "rate": "60"</span> | ||
<span class="sd"> }</span> | ||
<span class="sd"> }</span> | ||
<span class="sd"> "handlers": {</span> | ||
<span class="sd"> "rate_limited": {</span> | ||
<span class="sd"> "filters": ["60_second_filter"],</span> | ||
<span class="sd"> ...</span> | ||
<span class="sd"> }</span> | ||
<span class="sd"> }</span> | ||
<span class="sd"> "loggers": {</span> | ||
<span class="sd"> "fedmsg_migration_tools": {</span> | ||
<span class="sd"> "filters": ["60_second_filter"],</span> | ||
<span class="sd"> ...</span> | ||
<span class="sd"> }</span> | ||
<span class="sd"> }</span> | ||
<span class="sd"> }</span> | ||
|
||
<span class="sd"> This was shamelessly stolen from</span> | ||
<span class="sd"> https://github.com/fedora-infra/fedmsg-migration-tools/blob/0cafc8f/fedmsg_migration_tools/filters.py</span> | ||
<span class="sd"> which is also licensed GPLv2+.</span> | ||
|
||
<span class="sd"> Attributes:</span> | ||
<span class="sd"> rate: How often, in seconds, to allow records. Defaults to hourly.</span> | ||
<span class="sd"> """</span> | ||
|
||
<div class="viewcode-block" id="RateLimiter.__init__"> | ||
<a class="viewcode-back" href="../../../administration.html#bodhi.server.logging.RateLimiter.__init__">[docs]</a> | ||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rate</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3600</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Initialize the log filter.</span> | ||
|
||
<span class="sd"> Args:</span> | ||
<span class="sd"> rate: How often, in seconds, to allow records. Defaults to hourly.</span> | ||
<span class="sd"> """</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">rate</span> <span class="o">=</span> <span class="n">rate</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">_sent</span> <span class="o">=</span> <span class="p">{}</span></div> | ||
|
||
|
||
<div class="viewcode-block" id="RateLimiter.filter"> | ||
<a class="viewcode-back" href="../../../administration.html#bodhi.server.logging.RateLimiter.filter">[docs]</a> | ||
<span class="k">def</span> <span class="nf">filter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">record</span><span class="p">:</span> <span class="n">logging</span><span class="o">.</span><span class="n">LogRecord</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Record call sites and filter based on time.</span> | ||
|
||
<span class="sd"> Args:</span> | ||
<span class="sd"> record: The log record we are filtering on.</span> | ||
<span class="sd"> Returns:</span> | ||
<span class="sd"> True if the record should be emitted, False otherwise.</span> | ||
<span class="sd"> """</span> | ||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"</span><span class="si">{}</span><span class="s2">:</span><span class="si">{}</span><span class="s2">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">record</span><span class="o">.</span><span class="n">pathname</span><span class="p">,</span> <span class="n">record</span><span class="o">.</span><span class="n">lineno</span><span class="p">)</span> | ||
<span class="k">try</span><span class="p">:</span> | ||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">rate</span> <span class="o">></span> <span class="n">record</span><span class="o">.</span><span class="n">created</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sent</span><span class="p">[</span><span class="n">key</span><span class="p">]:</span> | ||
<span class="k">return</span> <span class="kc">False</span> | ||
<span class="k">except</span> <span class="ne">KeyError</span><span class="p">:</span> | ||
<span class="k">pass</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">_sent</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">record</span><span class="o">.</span><span class="n">created</span> | ||
<span class="k">return</span> <span class="kc">True</span></div> | ||
</div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
<div class="sphinxsidebar" role="navigation" aria-label="Main"> | ||
<div class="sphinxsidebarwrapper"> | ||
<p class="logo"> | ||
<a href="../../../index.html"> | ||
<img class="logo" src="../../../_static/logo.svg" alt="Logo" /> | ||
|
||
<h1 class="logo logo-name">bodhi</h1> | ||
|
||
</a> | ||
</p> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<p> | ||
<iframe src="https://ghbtns.com/github-btn.html?user=fedora-infra&repo=bodhi&type=watch&count=true&size=large&v=2" | ||
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe> | ||
</p> | ||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../user/automatic_updates.html">Automatic Updates</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../user/buildroot_overrides.html">Buildroot Overrides</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../user/fedora-flavored-markdown.html">Fedora-Flavored Markdown</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../user/testing.html">Testing updates</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../user/update_states.html">Update states</a></li> | ||
</ul> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../user/release_notes.html">Release notes</a></li> | ||
</ul> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../server_api/index.html">Bodhi Server APIs</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../python_bindings.html">Python bindings</a></li> | ||
</ul> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../developer/index.html">Developer documentation</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../developer/releases.html">Release process</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../developer/bcd.html">BCD - the Bodhi Container Development environment</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../developer/bcd_vscode.html">Debugging with Visual Studio Code</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../developer/models.html">Database models</a></li> | ||
</ul> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../administration.html">Administration</a></li> | ||
</ul> | ||
|
||
<div class="relations"> | ||
<h3>Related Topics</h3> | ||
<ul> | ||
<li><a href="../../../index.html">Documentation overview</a><ul> | ||
<li><a href="../../index.html">Module code</a><ul> | ||
</ul></li> | ||
</ul></li> | ||
</ul> | ||
</div> | ||
<search id="searchbox" style="display: none" role="search"> | ||
<h3 id="searchlabel">Quick search</h3> | ||
<div class="searchformwrapper"> | ||
<form class="search" action="../../../search.html" method="get"> | ||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> | ||
<input type="submit" value="Go" /> | ||
</form> | ||
</div> | ||
</search> | ||
<script>document.getElementById('searchbox').style.display = "block"</script> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="footer"> | ||
©2007-2024, Red Hat, Inc.. | ||
|
||
| | ||
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.0.2</a> | ||
& <a href="https://alabaster.readthedocs.io">Alabaster 1.0.0</a> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
</body> | ||
</html> |
Oops, something went wrong.