Blob Blame History Raw
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>org.freedesktop.Problems2.Entry</title><link rel="stylesheet" type="text/css" href="style.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Problems API"><link rel="up" href="ch02.html" title="Chapter 2. Interfaces"><link rel="prev" href="re01.html" title="org.freedesktop.Problems2"><link rel="next" href="re03.html" title="org.freedesktop.Problems2.Session"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
          <code class="literal">org.freedesktop.Problems2.Entry</code>
        </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re01.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Interfaces</th><td width="20%" align="right"> <a accesskey="n" href="re03.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="org.freedesktop.Problems2.Entry"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">
          <code class="literal">org.freedesktop.Problems2.Entry</code>
        </span></h2><p>org.freedesktop.Problems2.Entry — The Entry represents single problem.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="refsect2"><a name="methods"></a><h3>Methods</h3><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">
                <b class="fsfunc">GetSemanticElement</b>
              (</code></td><td>IN Array&lt;String&gt; <var class="pdparam">element_names</var>, </td></tr><tr><td> </td><td>OUT Dict&lt;String,Variant&gt; <var class="pdparam">values</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">
                <b class="fsfunc">SetSemanticElement</b>
              (</code></td><td>IN Dict&lt;String,Variant&gt; <var class="pdparam">values</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">
                <b class="fsfunc">ReadElements</b>
              (</code></td><td>IN Array&lt;String&gt; <var class="pdparam">element_names</var>, </td></tr><tr><td> </td><td>IN Int32 <var class="pdparam">flags</var>, </td></tr><tr><td> </td><td>OUT Dict&lt;String,Variant&gt; <var class="pdparam">response</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">
                <b class="fsfunc">SaveElements</b>
              (</code></td><td>IN Dict&lt;String,Variant&gt; <var class="pdparam">elements</var>, </td></tr><tr><td> </td><td>IN Int32 <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">
                <b class="fsfunc">DeleteElements</b>
              (</code></td><td>IN Array&lt;String&gt; <var class="pdparam">name</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect2"><a name="properties"></a><h3>Properties</h3><div class="refsynopsisdiv"><h2></h2><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">ID </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">UInt32 </span><span class="varname">UID </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">User </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Hostname </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Type </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">UInt64 </span><span class="varname">FirstOccurrence </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">UInt64 </span><span class="varname">LastOccurrence </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">UInt32 </span><span class="varname">Count </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Executable </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">CommandLineArguments </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Component </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Struct&lt;String,String,String,String,String&gt; </span><span class="varname">Package </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">UUID </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Duphash </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Array&lt;Struct&lt;String,Dict&lt;String,Variant&gt;&gt;&gt; </span><span class="varname">Reports </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Reason </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Array&lt;Struct&lt;String,String,String,String,String,Int32&gt;&gt; </span><span class="varname">Solutions </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">TechnicalDetails </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Array&lt;String&gt; </span><span class="varname">Elements </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Array&lt;String&gt; </span><span class="varname">SemanticElements </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Boolean </span><span class="varname">IsReported </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Boolean </span><span class="varname">CanBeReported </span>;</code><br><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Boolean </span><span class="varname">IsRemote </span>;</code></div></div></div><div class="refsection"><a name="methods"></a><h2>Methods</h2><div class="refsection"><a name="org.freedesktop.Problems2.Entry.GetSemanticElement"></a><h3>
            <code class="literal">org.freedesktop.Problems2.Entry.GetSemanticElement</code>
          </h3><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">
                <b class="fsfunc">GetSemanticElement</b>
              (</code></td><td>IN Array&lt;String&gt; <var class="pdparam">element_names</var>, </td></tr><tr><td> </td><td>OUT Dict&lt;String,Variant&gt; <var class="pdparam">values</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Gets semantic values of problem's elements. Each implementation of 'org.freedesktop.Problems2' supports their own Semantic Elements. It is an error to call this method with an element that is not listed in the property 'semantic_elements'</p><div class="glosslist"><dl><dt><span class="glossterm">
                <code class="literal">element_names</code>
              </span></dt><dd class="glossdef"><p>Requested element names.</p></dd><dt><span class="glossterm">
                <code class="literal">values</code>
              </span></dt><dd class="glossdef"><p>A dictionary where keys are element names and values depend on the implementation of 'org.freedesktop.Problems2'.</p></dd></dl></div></div><div class="refsection"><a name="org.freedesktop.Problems2.Entry.SetSemanticElement"></a><h3>
            <code class="literal">org.freedesktop.Problems2.Entry.SetSemanticElement</code>
          </h3><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">
                <b class="fsfunc">SetSemanticElement</b>
              (</code></td><td>IN Dict&lt;String,Variant&gt; <var class="pdparam">values</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Sets semantic value of problem's elements. Each implementation of 'org.freedesktop.Problems2' supports their own Semantic Elements. It is an error to call this method with an element that is not listed in the property 'semantic_elements'</p><div class="glosslist"><dl><dt><span class="glossterm">
                <code class="literal">values</code>
              </span></dt><dd class="glossdef"><p>A dictionary where keys are element names and values depend on the implementation of 'org.freedesktop.Problems2'.</p></dd></dl></div></div><div class="refsection"><a name="org.freedesktop.Problems2.Entry.ReadElements"></a><h3>
            <code class="literal">org.freedesktop.Problems2.Entry.ReadElements</code>
          </h3><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">
                <b class="fsfunc">ReadElements</b>
              (</code></td><td>IN Array&lt;String&gt; <var class="pdparam">element_names</var>, </td></tr><tr><td> </td><td>IN Int32 <var class="pdparam">flags</var>, </td></tr><tr><td> </td><td>OUT Dict&lt;String,Variant&gt; <var class="pdparam">response</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Gets a raw value of a problem's element.</p><p>
                    </p><div class="example"><a name="ReadElements_example_python"></a><p class="title"><b>Example 2.5. How to use ReadElements() method to print out a nice list of problems</b></p><div class="example-contents"><pre class="programlisting">

#!/usr/bin/python3
from sys import stdout
import dbus
from datetime import datetime

PROBLEMS_BUS="org.freedesktop.problems"
PROBLEMS_PATH="/org/freedesktop/Problems2"
PROBLEMS_IFACE="org.freedesktop.Problems2"
ENTRY_IFACE="org.freedesktop.Problems2.Entry"

bus = dbus.SystemBus()
proxy = bus.get_object(PROBLEMS_BUS, PROBLEMS_PATH)
problems = dbus.Interface(proxy, dbus_interface=PROBLEMS_IFACE)

prblms = problems.GetProblems(0x0, {})

for path in prblms:
    prblm_proxy = bus.get_object(PROBLEMS_BUS, path)
    prblm  = dbus.Interface(prblm_proxy, dbus_interface=ENTRY_IFACE)
    kv = prblm.ReadElements(["time", "count", "package", "reason"], 0x4)

    date = datetime.fromtimestamp(float(kv["time"]))
    count = int(kv.get("count", 0))
    package = str(kv.get("package", ""))
    reason = str(kv.get("reason", ""))

    stdout.write("{0} {1:-3} {2:40} : {3}\n".format(date, count, package, reason))

                        </pre></div></div><p><br class="example-break">
                </p><div class="glosslist"><dl><dt><span class="glossterm">
                <code class="literal">element_names</code>
              </span></dt><dd class="glossdef"><p>A list of names of required info. If type of a requested element does not match the type specified in the argument 'i', the element will be ignored and its value will not be included in the response.</p></dd><dt><span class="glossterm">
                <code class="literal">flags</code>
              </span></dt><dd class="glossdef"><p>Enables selection of the allowed type and the type of return values.
                        </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">0x0 : NO_FLAGS</span></dt><dd><p>Do not check element types and return text elements as D-Bus strings, big text elements as UNIX file descriptors and binary elements as UNIX file descriptors too.</p></dd><dt><span class="term">0x1 : ALL_FD</span></dt><dd><p>The returned values will be file descriptors for all element types (text, big text and binary)</p></dd><dt><span class="term">0x2 : ALL_TYPES</span></dt><dd><p>(TODO : I am not sure what I had on mind. I will remove this term later.)</p></dd><dt><span class="term">0x4 : ONLY_TEXT</span></dt><dd><p>Only those elements that are of text type are read and their contents are returned as D-Bus strings by default.</p></dd><dt><span class="term">0x8 : ONLY_BIG_TEXT</span></dt><dd><p>Only those elements that are of binary type are read and their contents are returned as UNIX file descriptors</p></dd><dt><span class="term">0x10 : ONLY_BINARY</span></dt><dd><p>Only those elements that are of big text type are read and their contents are returned as UNIX file descriptors</p></dd><dt><span class="term">0x20 : ALL_NO_FD</span></dt><dd><p>Return binary data as fixed byte array</p></dd></dl></div><p>
                    </p></dd><dt><span class="glossterm">
                <code class="literal">response</code>
              </span></dt><dd class="glossdef"><p>Dictionary here the key is a requested element name and the value is the element's value.</p></dd></dl></div></div><div class="refsection"><a name="org.freedesktop.Problems2.Entry.SaveElements"></a><h3>
            <code class="literal">org.freedesktop.Problems2.Entry.SaveElements</code>
          </h3><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">
                <b class="fsfunc">SaveElements</b>
              (</code></td><td>IN Dict&lt;String,Variant&gt; <var class="pdparam">elements</var>, </td></tr><tr><td> </td><td>IN Int32 <var class="pdparam">flags</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Creates or updates raw values of the given problem elements. See org.freedesktop.Problems2.NewProblem for more details about element naming rules.</p><div class="glosslist"><dl><dt><span class="glossterm">
                <code class="literal">elements</code>
              </span></dt><dd class="glossdef"><p>The problem elements and their values of one of the following types:
                    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">s</span></dt><dd><p>text data</p></dd><dt><span class="term">ay</span></dt><dd><p>binary data</p></dd><dt><span class="term">h</span></dt><dd><p>file descriptor - will be read in non-blocking mode</p></dd></dl></div><p>
                   </p></dd><dt><span class="glossterm">
                <code class="literal">flags</code>
              </span></dt><dd class="glossdef"><p>This argument is used to define how to recover from errors.</p></dd></dl></div></div><div class="refsection"><a name="org.freedesktop.Problems2.Entry.DeleteElements"></a><h3>
            <code class="literal">org.freedesktop.Problems2.Entry.DeleteElements</code>
          </h3><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">
                <b class="fsfunc">DeleteElements</b>
              (</code></td><td>IN Array&lt;String&gt; <var class="pdparam">name</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Deletes the listed problem's elements.</p><div class="glosslist"><dl><dt><span class="glossterm">
                <code class="literal">name</code>
              </span></dt><dd class="glossdef"><p>The list of deleted problem elements.</p></dd></dl></div></div></div><div class="refsection"><a name="dbus_properties"></a><h2>D-Bus Properties</h2><p>
            Accessed using the org.freedesktop.DBus.Properties interface.
          </p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">ID </span>;</code><br><p>The UNIX time when the collection was created.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">UInt32 </span><span class="varname">UID </span>;</code><br><p>The UID of the crashed program.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">User </span>;</code><br><p>The user name associated with the uid.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Hostname </span>;</code><br><p>Name of the host where the problem occurred</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Type </span>;</code><br><p>The type of the problem (CCpp, Python, Kerneloops, Java, Ruby, ...).</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">UInt64 </span><span class="varname">FirstOccurrence </span>;</code><br><p>The UNIX time when the problem entry was created.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">UInt64 </span><span class="varname">LastOccurrence </span>;</code><br><p>The UNIX time when the problem entry was seen for the last time.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">UInt32 </span><span class="varname">Count </span>;</code><br><p>The number of observed problem's occurrences.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Executable </span>;</code><br><p>The file system path to crashed program.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">CommandLineArguments </span>;</code><br><p>The command line arguments used run the crashed program.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Component </span>;</code><br><p>The component which the package belongs to.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Struct&lt;String,String,String,String,String&gt; </span><span class="varname">Package </span>;</code><br><p>Information about the package which the crashed program belongs to:
                </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>full name</p></li><li class="listitem"><p>epoch</p></li><li class="listitem"><p>name</p></li><li class="listitem"><p>version</p></li><li class="listitem"><p>release</p></li></ol></div><p>
                </p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">UUID </span>;</code><br><p>A local scope, unique identifier for similar problems to the problem.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Duphash </span>;</code><br><p>A global scope, unique identifier for similar problems to the problem.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Array&lt;Struct&lt;String,Dict&lt;String,Variant&gt;&gt;&gt; </span><span class="varname">Reports </span>;</code><br><p>The list of reports of the problem in the form of a dictionary where the key is the report type (e.g. Bugzilla, ABRT Server) and the value is another dictionary with the report information ("URL", "https://bugzilla.redhat.com/1000000"). Known information types are the following:
                    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">URL</span></dt><dd><p>An URL</p></dd><dt><span class="term">BTHASH</span></dt><dd><p>An indentifier of the problem returned by ABRT server</p></dd><dt><span class="term">MSG</span></dt><dd><p>A message</p></dd><dt><span class="term">CERTAINTY</span></dt><dd><p>This type can appear only together with a entry of the "URL" type. Its value is an integer and represents percentual relevance to of the URL to the problem.</p></dd></dl></div><p>
                </p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">Reason </span>;</code><br><p>A brief description of what caused the problem.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Array&lt;Struct&lt;String,String,String,String,String,Int32&gt;&gt; </span><span class="varname">Solutions </span>;</code><br><p>List of solutions that are a structrure with these members (which are self-explanatory):
                    </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>solution type</p></li><li class="listitem"><p>title</p></li><li class="listitem"><p>URL</p></li><li class="listitem"><p>note_text</p></li><li class="listitem"><p>note_html</p></li><li class="listitem"><p>certainty</p></li></ol></div><p>
                </p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">String </span><span class="varname">TechnicalDetails </span>;</code><br><p>Technical details about the problem usually containing explanation for the not-reporatiblity of the problem (e.g tainted Kernel oopses).</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Array&lt;String&gt; </span><span class="varname">Elements </span>;</code><br><p>List of all elements the problem data contains.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Array&lt;String&gt; </span><span class="varname">SemanticElements </span>;</code><br><p>List of all semantic elements that can be handled by GetSemanticElement and SetSemanticElement methods.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Boolean </span><span class="varname">IsReported </span>;</code><br><p>True if someone took the time to file a ticket in the OS's default bug tracking system.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Boolean </span><span class="varname">CanBeReported </span>;</code><br><p>TRUE if it is possible to file a ticket in the OS's default bug tracking system.</p><code class="fieldsynopsis"><span class="modifier">READ </span><span class="type">Boolean </span><span class="varname">IsRemote </span>;</code><p>TRUE if the problem data has been uploaded by another host.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re01.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">
          <code class="literal">org.freedesktop.Problems2</code>
         </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
          <code class="literal">org.freedesktop.Problems2.Session</code>
        </td></tr></table></div></body></html>