Revision f95c81bf

b/lib/backend.py
1658 1658
  """
1659 1659
  if base_dir is None:
1660 1660
    os_dir = utils.FindFile(name, constants.OS_SEARCH_PATH, os.path.isdir)
1661
    if os_dir is None:
1662
      raise errors.InvalidOS(name, None, "OS dir not found in search path")
1663 1661
  else:
1664
    os_dir = os.path.sep.join([base_dir, name])
1662
    os_dir = utils.FindFile(name, [base_dir], os.path.isdir)
1663

  
1664
  if os_dir is None:
1665
    raise errors.InvalidOS(name, None, "OS dir not found in search path")
1665 1666

  
1666 1667
  api_versions = _OSOndiskVersion(name, os_dir)
1667 1668

  
b/lib/utils.py
1633 1633
  @return: full path to the object if found, None otherwise
1634 1634

  
1635 1635
  """
1636
  # validate the filename mask
1637
  if constants.EXT_PLUGIN_MASK.match(name) is None:
1638
    logging.critical("Invalid value passed for external script name: '%s'",
1639
                     name)
1640
    return None
1641

  
1636 1642
  for dir_name in search_path:
1637 1643
    item_name = os.path.sep.join([dir_name, name])
1638
    if test(item_name):
1644
    # check the user test and that we're indeed resolving to the given
1645
    # basename
1646
    if test(item_name) and os.path.basename(item_name) == name:
1639 1647
      return item_name
1640 1648
  return None
1641 1649

  

Also available in: Unified diff