%PDF- %PDF-
| Direktori : /proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/salt/modules/ |
| Current File : //proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/salt/modules/smbios.pyc |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l Z d d l
Z d d l m Z d d l m
Z
e j e � Z d � Z e d � Z d d e d � Z e d d � Z d
� Z e d � Z d � Z d d
� Z d S( u!
Interface to SMBIOS/DMI
(Parsing through dmidecode)
External References
-------------------
| `Desktop Management Interface (DMI) <http://www.dmtf.org/standards/dmi>`_
| `System Management BIOS <http://www.dmtf.org/standards/smbios>`_
| `DMIdecode <http://www.nongnu.org/dmidecode/>`_
i ( t absolute_importt unicode_literalst print_functionN( t range( t zipc C@ s% t t j j j d d g � � d f S( u0
Only work when dmidecode is installed.
u dmidecodeu smbiosuU The smbios execution module failed to load: neither dmidecode nor smbios in the path.( t boolt saltt utilst patht which_bin( ( ( s7 /usr/lib/python2.7/site-packages/salt/modules/smbios.pyt __virtual__! s c C@ s� t d j | � � j � } d j g | j d � D] } | j d � s1 | ^ q1 � } | j d � sz | r� t | | � r� d } n | S( u]
Get an individual DMI string from SMBIOS info
string
The string to fetch. DMIdecode supports:
- ``bios-vendor``
- ``bios-version``
- ``bios-release-date``
- ``system-manufacturer``
- ``system-product-name``
- ``system-version``
- ``system-serial-number``
- ``system-uuid``
- ``baseboard-manufacturer``
- ``baseboard-product-name``
- ``baseboard-version``
- ``baseboard-serial-number``
- ``baseboard-asset-tag``
- ``chassis-manufacturer``
- ``chassis-type``
- ``chassis-version``
- ``chassis-serial-number``
- ``chassis-asset-tag``
- ``processor-family``
- ``processor-manufacturer``
- ``processor-version``
- ``processor-frequency``
clean
| Don't return well-known false information
| (invalid UUID's, serial 000000000's, etcetera)
| Defaults to ``True``
CLI Example:
.. code-block:: bash
salt '*' smbios.get system-uuid clean=False
u -s {0}u
u #u /dev/memN( t _dmidecodert formatt stript joint splitt
startswitht _dmi_iscleant None( t stringt cleant valt v( ( s7 /usr/lib/python2.7/site-packages/salt/modules/smbios.pyt get) s
):% c C@ sI | d k r$ t t � | | � } n! t t d j | � � | | � } | S( u
Return DMI records from SMBIOS
type
Return only records of type(s)
The SMBIOS specification defines the following DMI types:
==== ======================================
Type Information
==== ======================================
0 BIOS
1 System
2 Baseboard
3 Chassis
4 Processor
5 Memory Controller
6 Memory Module
7 Cache
8 Port Connector
9 System Slots
10 On Board Devices
11 OEM Strings
12 System Configuration Options
13 BIOS Language
14 Group Associations
15 System Event Log
16 Physical Memory Array
17 Memory Device
18 32-bit Memory Error
19 Memory Array Mapped Address
20 Memory Device Mapped Address
21 Built-in Pointing Device
22 Portable Battery
23 System Reset
24 Hardware Security
25 System Power Controls
26 Voltage Probe
27 Cooling Device
28 Temperature Probe
29 Electrical Current Probe
30 Out-of-band Remote Access
31 Boot Integrity Services
32 System Boot
33 64-bit Memory Error
34 Management Device
35 Management Device Component
36 Management Device Threshold Data
37 Memory Channel
38 IPMI Device
39 Power Supply
40 Additional Information
41 Onboard Devices Extended Information
42 Management Controller Host Interface
==== ======================================
clean
| Don't return well-known false information
| (invalid UUID's, serial 000000000's, etcetera)
| Defaults to ``True``
CLI Example:
.. code-block:: bash
salt '*' smbios.records clean=False
salt '*' smbios.records 14
salt '*' smbios.records 4 core_count,thread_count,current_speed
u -t {0}N( R t
_dmi_parseR R ( t rec_typet fieldsR t smbios( ( s7 /usr/lib/python2.7/site-packages/salt/modules/smbios.pyt records\ s F!c C@ s` g } t j d t j t j � } t t j | | � d � } xt | | � D]
\ } } g | j d � D] } | j � d ^ qj d d !\ } } | j d � } t j d | � i | d 6| j d � j
� d
6t | � d 6} t | � s
| sN | j
| � qN qN n t | | | � }
t |
� rB|
| d <| j
| � qN | sN | j
| � qN qN W| S(
ug
Structurize DMI records into a nice list
Optionally trash bogus entries and filter output
u (handle [0-9]x[0-9a-f]+[^
]+)
i u ,i����i i u
u Parsing handle %su handleu descriptionu typeu data( t ret compilet MULTILINEt
IGNORECASEt iterR R t logt debugt popR
t intt lent appendt _dmi_data( t dataR R t dmit dmi_splitt dmi_rawt handlet hlinet htypet recordt dmi_data( ( s7 /usr/lib/python2.7/site-packages/salt/modules/smbios.pyR � s, 9
c
C@ s� i } d } d g g } xr| D]j} t j d | � r*| d k r� | \ } } t | � r� | d k rz | j d | � n | | | <q� | d k r� | | | <q� n | j d d � \ } } | j � j � j d d � } | r� | d k s� | r | | k r d } q q�t | | j � | � g g } q | d k r<q q t j d | � r t | | j � | � } | d k r�| d j
| � q�q q W| S(
uP
Parse the raw DMIdecode output of a single handle
into a nice dict
u \t[^\s]+i u :i u u _u header_and_datau
\t\t[^\s]+N( R R t matchR&