def mount(location, access='rw', root=None):
 if (root is None):
  root = os.path.join(tempfile.gettempdir(), 'guest', location.lstrip(os.sep).replace('/', '.'))
  log.debug('Using root {0}'.format(root))
 if (not os.path.isdir(root)):
  try:
   os.makedirs(root)
  except OSError:
   pass
 while True:
  if os.listdir(root):
   hash_type = getattr(hashlib, __opts__.get('hash_type', 'md5'))
   rand = hash_type(os.urandom(32)).hexdigest()
   root = os.path.join(tempfile.gettempdir(), 'guest', (location.lstrip(os.sep).replace('/', '.') + rand))
   log.debug('Establishing new root as {0}'.format(root))
  else:
   break
 cmd = 'guestmount -i -a {0} --{1} {2}'.format(location, access, root)
 __salt__['cmd.run'](cmd, python_shell=False)
 return root

def mount ( location , access = 'rw' , root = None ) : if ( root is None ) : root = os . path . join ( tempfile . gettempdir ( ) , 'guest' , location . lstrip ( os . sep ) . replace ( '/' , '.' ) ) log . debug ( 'Using root {0}' . format ( root ) ) if ( not os . path . isdir ( root ) ) : try : os . makedirs ( root ) except OSError : pass while True : if os . listdir ( root ) : hash_type = getattr ( hashlib , __opts__ . get ( 'hash_type' , 'md5' ) ) rand = hash_type ( os . urandom ( 32 ) ) . hexdigest ( ) root = os . path . join ( tempfile . gettempdir ( ) , 'guest' , ( location . lstrip ( os . sep ) . replace ( '/' , '.' ) + rand ) ) log . debug ( 'Establishing new root as {0}' . format ( root ) ) else : break cmd = 'guestmount -i -a {0} --{1} {2}' . format ( location , access , root ) __salt__ [ 'cmd.run' ] ( cmd , python_shell = False ) return root
mount a partition example:: from fabtools .