def _aix_memdata():
    '''
    Return the memory information for AIX systems
    '''
    grains = {'mem_total': 0, 'swap_total': 0}
    prtconf = salt.utils.path.which('prtconf')
    if prtconf:
        for line in __salt__['cmd.run'](prtconf, python_shell=True).splitlines():
            comps = [x for x in line.strip().split(' ') if x]
            if len(comps) > 2 and 'Memory' in comps[0] and 'Size' in comps[1]:
                grains['mem_total'] = int(comps[2])
                break
    else:
        log.error('The \'prtconf\' binary was not found in $PATH.')

    swap_cmd = salt.utils.path.which('swap')
    if swap_cmd:
        swap_data = __salt__['cmd.run']('{0} -s'.format(swap_cmd)).split()
        try:
            swap_total = (int(swap_data[-2]) + int(swap_data[-6])) * 4
        except ValueError:
            swap_total = None
        grains['swap_total'] = swap_total
    else:
        log.error('The \'swap\' binary was not found in $PATH.')
    return grains
def _aix_memdata ( ) : grains = { 'mem_total' : 0 , 'swap_total' : 0 } prtconf = salt . utils . path . which ( 'prtconf' ) if prtconf : for line in __salt__ [ 'cmd.run' ] ( prtconf , python_shell = True ) . splitlines ( ) : comps = [ x for x in line . strip ( ) . split ( ' ' ) if x ] if len ( comps ) > 2 and 'Memory' in comps [ 0 ] and 'Size' in comps [ 1 ] : grains [ 'mem_total' ] = int ( comps [ 2 ] ) break else : log . error ( 'The \'prtconf\' binary was not found in $PATH.' ) swap_cmd = salt . utils . path . which ( 'swap' ) if swap_cmd : swap_data = __salt__ [ 'cmd.run' ] ( '{0} -s' . format ( swap_cmd ) ) . split ( ) try : swap_total = ( int ( swap_data [ - 2 ] ) + int ( swap_data [ - 6 ] ) ) * 4 except ValueError : swap_total = None grains [ 'swap_total' ] = swap_total else : log . error ( 'The \'swap\' binary was not found in $PATH.' ) return grains
Return the memory information for AIX systems