def check_path_traversal(path, user='root', skip_perm_errors=False):
 for tpath in list_path_traversal(path):
  if (not os.access(tpath, os.R_OK)):
   msg = 'Could not access {0}.'.format(tpath)
   if (not os.path.exists(tpath)):
    msg += ' Path does not exist.'
   else:
    current_user = salt.utils.get_user()
    if (user != current_user):
     msg += ' Try running as user {0}.'.format(user)
    else:
     msg += ' Please give {0} read permissions.'.format(user)
   if skip_perm_errors:
    return
   raise SaltClientError(msg)

def check_path_traversal ( path , user = 'root' , skip_perm_errors = False ) : for tpath in list_path_traversal ( path ) : if ( not os . access ( tpath , os . R_OK ) ) : msg = 'Could not access {0}.' . format ( tpath ) if ( not os . path . exists ( tpath ) ) : msg += ' Path does not exist.' else : current_user = salt . utils . get_user ( ) if ( user != current_user ) : msg += ' Try running as user {0}.' . format ( user ) else : msg += ' Please give {0} read permissions.' . format ( user ) if skip_perm_errors : return raise SaltClientError ( msg )
walk from the root up to a directory and verify that the current user has access to read each directory .