~e&ddlZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z Gdde Z d d Zy) N) getLogger)Failure) log_failure)PluginRegistry)gather_resultscXeZdZdZfdZdZdZdZdZdZ dZ d Z d Z d Z xZS) SysInfoPluginRegistryaG When the sysinfo plugin registry is run, it will run each of the registered plugins so that they get a chance to feed information into the registry. There are three kinds of details collected: headers, notes, and footnotes. They are presented to the user in a way similar to the following: Header1: Value1 Header3: Value3 Header2: Value2 Header4: Value4 => This is first note => This is the second note The first footnote. The second footnote. Headers are supposed to display information which is regularly available, such as the load and temperature of the system. Notes contain eventual information, such as warnings of high temperatures, and low disk space. Finally, footnotes contain pointers to further information such as URLs. cht|i|_g|_g|_g|_d|_y)NF)super__init__ _header_index_headers_notes _footnotes _plugin_error)self __class__s ;/usr/lib/python3/dist-packages/landscape/sysinfo/sysinfo.pyr zSysInfoPluginRegistry.__init__'s3   "c"|jj|}|@t|j|j|<|jj ||fy|dz }||j|<|jj |||fy)ajAdd a new information header to be displayed to the user. Header names can be repeated. Headers with value None are not returned by get_headers(), but they still allocate a position in the list. This fact may be explored to create a deterministic ordering even when dealing with values obtained asynchornously. N)r getlenrappendinsert)rnamevalueindexs r add_headerz SysInfoPluginRegistry.add_header/s""&&t, ='*4=='9D  t $ MM $ / QJE',D  t $ MM u 6rcL|jDcgc] }|d | c}Scc}w)zGet all information headers to be displayed to the user. Headers which were added with value None are not included in the result. r)r)rpairs r get_headersz!SysInfoPluginRegistry.get_headersBs% "&F$q'2EFFFs !!c:|jj|y)z This is first note => This is the second note The first footnote. The second footnote. Header columns will be dynamically adjusted to conform to the size of header labels and values. z: rr )initial_indentsubsequent_indentwidthc3(K|] }|z yw)N).0footnoteindents r z!format_sysinfo..sA8Vh&As ) rminintmathceilfloatrangemaxrextendtextwrapwraprC)headersnotes footnotesrNrScolumn_separator note_prefix headers_lenvalue_separator min_lengthheaderrcolumnsheaders_per_columnheader_lengths total_lengthcolumnwidest_header_lenwidest_value_lenrow header_indexlineslinerLr%s ` rformat_sysinfort}s:8 S[Eg,KO J    K#e* $q (   %,*s3C/D"DEFG !;w+G!HI Gn IF!"  /0 I%(::S@  +-$+L$9MFE(+,=s6{(K%'*+;SZ'H$ Iz$4 55 !$44s?7KK L  ! !#46F"G H1 I4 a<<%/  1 Y ^ E'( Gn BF!$66&1*0B!BS!HHC#3c%j#@AAD+ B,  T9<  LL +- D LL #1&)C,?&?     LL  AyAA 99U r)rPrPrPPrKz z=> )rXrAr^loggingrtwisted.python.failurerlandscape.lib.logrlandscape.lib.pluginrlandscape.lib.twisted_utilrr rtrPrrr{sI *)/5mNmb   Ur