Beispiel #1
0
    def uname(self):
        '''
        Return system information
        @rtype: dict
        
        Sample:
        {'kernel_name': 'Linux',
        'kernel_release': '2.6.41.10-3.fc15.x86_64',
        'kernel_version': '#1 SMP Mon Jan 23 15:46:37 UTC 2012',
        'nodename': 'marat.office.webta',           
        'machine': 'x86_64',
        'processor': 'x86_64',
        'hardware_platform': 'x86_64'}
        '''

        uname = disttool.uname()
        return {
            'kernel_name': uname[0],
            'nodename': uname[1],
            'kernel_release': uname[2],
            'kernel_version': uname[3],
            'machine': uname[4],
            'processor': uname[5],
            'hardware_platform': disttool.arch()
        }
Beispiel #2
0
    def uname(self):
        '''
        Return system information
        @rtype: dict
        
        Sample:
        {'kernel_name': 'Linux',
        'kernel_release': '2.6.41.10-3.fc15.x86_64',
        'kernel_version': '#1 SMP Mon Jan 23 15:46:37 UTC 2012',
        'nodename': 'marat.office.webta',           
        'machine': 'x86_64',
        'processor': 'x86_64',
        'hardware_platform': 'x86_64'}
        '''

        uname = disttool.uname()
        return {
            'kernel_name': uname[0],
            'nodename': uname[1],
            'kernel_release': uname[2],
            'kernel_version': uname[3],
            'machine': uname[4],
            'processor': uname[5],
            'hardware_platform': disttool.arch()
        }
Beispiel #3
0
def system_info(verbose=False):

    def check_module(module):
        try:
            return not coreutils.modprobe(module, dry_run=True)[2]
        except:
            return False

    ret = {}
    ret['software'] = []
    installed_list = all_installed()
    for software_inf in installed_list:
        v = dict(
                name=software_inf.name,
                version='.'.join([str(x) for x in software_inf.version])
        )
        if verbose:
            v['string_version'] = software_inf.string_version

        ret['software'].append(v)


    ret['os'] = {}
    ret['os']['version']            = ' '.join(disttool.linux_dist())
    ret['os']['string_version'] = ' '.join(disttool.uname()).strip()

    ret['dist'] = {
            'distributor': linux.os['name'].lower(),
            'release': str(linux.os['release']),
            'codename': linux.os['codename']
    }

    ret['storage'] = {}
    ret['storage']['fstypes'] = []

    for fstype in ['xfs', 'ext3', 'ext4']:
        try:
            retcode = coreutils.modprobe(fstype, dry_run=True)[1]
        except:
            retcode = 1
        exe = whereis('mkfs.%s' % fstype)
        if not retcode and exe:
            ret['storage']['fstypes'].append(fstype)

    # Raid levels support detection
    if whereis('mdadm'):
        for module in  ('raid0', 'raid1', 'raid456'):
            ret['storage'][module] = 1 if check_module(module) else 0

    # Lvm2 support detection
    if whereis('dmsetup') and all(map(check_module, ('dm_mod', 'dm_snapshot'))):
        ret['storage']['lvm'] = 1
    else:
        ret['storage']['lvm'] = 0

    return ret
Beispiel #4
0
def system_info(verbose=False):
    def check_module(module):
        try:
            return not coreutils.modprobe(module, dry_run=True)[2]
        except:
            return False

    ret = {}
    ret['software'] = []
    installed_list = all_installed()
    for software_inf in installed_list:
        v = dict(name=software_inf.name,
                 version='.'.join([str(x) for x in software_inf.version]))
        if verbose:
            v['string_version'] = software_inf.string_version

        ret['software'].append(v)

    ret['os'] = {}
    ret['os']['version'] = ' '.join(disttool.linux_dist())
    ret['os']['string_version'] = ' '.join(disttool.uname()).strip()

    ret['dist'] = {
        'distributor': linux.os['name'].lower(),
        'release': str(linux.os['release']),
        'codename': linux.os['codename']
    }

    ret['storage'] = {}
    ret['storage']['fstypes'] = []

    for fstype in ['xfs', 'ext3', 'ext4']:
        try:
            retcode = coreutils.modprobe(fstype, dry_run=True)[1]
        except:
            retcode = 1
        exe = whereis('mkfs.%s' % fstype)
        if not retcode and exe:
            ret['storage']['fstypes'].append(fstype)

    # Raid levels support detection
    if whereis('mdadm'):
        for module in ('raid0', 'raid1', 'raid456'):
            ret['storage'][module] = 1 if check_module(module) else 0

    # Lvm2 support detection
    if whereis('dmsetup') and all(map(check_module,
                                      ('dm_mod', 'dm_snapshot'))):
        ret['storage']['lvm'] = 1
    else:
        ret['storage']['lvm'] = 0

    return ret
Beispiel #5
0
    def __init__(self):
        self._logger = logging.getLogger(__name__)
        self._handlers_chain = None
        cnf = bus.cnf
        platform = bus.platform

        LOG.debug("Initializing message listener")
        self._accept_kwargs = dict(behaviour=config.split(
            cnf.rawini.get(config.SECT_GENERAL, config.OPT_BEHAVIOUR)),
                                   platform=platform.name,
                                   os=disttool.uname(),
                                   dist=disttool.linux_dist())
        LOG.debug("Keywords for each Handler::accept\n%s",
                  pprint.pformat(self._accept_kwargs))

        self.get_handlers_chain()