def ismounted(device):
 with settings(hide('running', 'stdout')):
  res = run_as_root('mount')
 for line in res.splitlines():
  fields = line.split()
  if (fields[0] == device):
   return True
 with settings(hide('running', 'stdout')):
  res = run_as_root('swapon -s')
 for line in res.splitlines():
  fields = line.split()
  if (fields[0] == device):
   return True
 return False

def ismounted ( device ) : with settings ( hide ( 'running' , 'stdout' ) ) : res = run_as_root ( 'mount' ) for line in res . splitlines ( ) : fields = line . split ( ) if ( fields [ 0 ] == device ) : return True with settings ( hide ( 'running' , 'stdout' ) ) : res = run_as_root ( 'swapon -s' ) for line in res . splitlines ( ) : fields = line . split ( ) if ( fields [ 0 ] == device ) : return True return False
check if partition is mounted example:: from fabtools .