/usr/lib/python2.7/dist-packages/framework/subsystems/ousaged/helpers.py is in fso-frameworkd 0.10.1-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | import logging
logger = logging.getLogger( "ousaged.helpers" )
#============================================================================#
def readFromFile( path ):
#============================================================================#
try:
value = open( path, 'r' ).read().strip()
except IOError, e:
logger.warning( "(could not read from '%s': %s)" % ( path, e ) )
return "N/A"
else:
logger.debug( "(read %s from '%s')" % ( repr(value), path ) )
return value
#============================================================================#
def writeToFile( path, value ):
#============================================================================#
logger.debug( "(writing '%s' to '%s')" % ( value, path ) )
try:
f = open( path, 'w' )
except IOError, e:
logger.warning( "(could not write to '%s': %s)" % ( path, e ) )
else:
f.write( "%s\n" % value )
#============================================================================#
def hardwareName():
#============================================================================#
value = readFromFile( "/proc/cpuinfo" )
for line in value.split( '\n' ):
try:
left, right = line.split( ':' )
except ValueError:
continue
else:
if left.strip().startswith( "Hardware" ):
return right.strip()
return "unknown"
|