Beispiel #1
0
def create_config_links(stack_id, stack_version):
  """
  Creates config links
  stack_id:  stack id, ie HDP-2.3
  stack_version:  version to set, ie 2.3.0.0-1234
  """
  if stack_id is None:
    Logger.info("Cannot create config links when stack_id is not defined")
    return
  args = stack_id.upper().split('-')
  if len(args) != 2:
    Logger.info("Unrecognized stack id {0}".format(stack_id))
    return
  if args[0] != "HDP":
    Logger.info("Unrecognized stack name {0}".format(args[0]))
  if version.compare_versions(version.format_hdp_stack_version(args[1]), "2.3.0.0") < 0:
    Logger.info("Cannot link configs unless HDP-2.3 or higher")
    return
  for k, v in PACKAGE_DIRS.iteritems():
    dirs = create(args[0], k, stack_version, dry_run = True)
    if 0 == len(dirs):
      Logger.debug("Package {0} is not installed".format(k))
    else:
      need = False
      for new_conf_dir in dirs:
        if not os.path.exists(new_conf_dir):
          need = True

      if need:
        Logger.info("Creating conf dirs {0} for {1}".format(",".join(dirs), k))
        try:
          select(args[0], k, stack_version)
        except Exception, err:
          # don't ruin someone's day
          Logger.logger.exception("'conf-select set' failed to link '{0}'. Error: {1}".format(k, str(err)))
Beispiel #2
0
def create_config_links(stack_id, stack_version):
    """
  Creates config links
  stack_id:  stack id, ie HDP-2.3
  stack_version:  version to set, ie 2.3.0.0-1234
  """

    if stack_id is None:
        Logger.info("Cannot create config links when stack_id is not defined")
        return

    args = stack_id.upper().split('-')
    if len(args) != 2:
        Logger.info("Unrecognized stack id {0}".format(stack_id))
        return

    if args[0] != "HDP":
        Logger.info("Unrecognized stack name {0}".format(args[0]))

    if version.compare_versions(version.format_hdp_stack_version(args[1]),
                                "2.3.0.0") < 0:
        Logger.info("Cannot link configs unless HDP-2.3 or higher")
        return

    for k, v in PACKAGE_DIRS.iteritems():
        if os.path.exists(v['conf_dir']):
            new_conf_dir = create(args[0], k, stack_version, dry_run=True)

            if not os.path.exists(new_conf_dir):
                Logger.info("Creating conf {0} for {1}".format(
                    new_conf_dir, k))
                select(args[0], k, stack_version)
Beispiel #3
0
def _valid(stack_name, package, ver):
  if stack_name != "HDP":
    return False

  if version.compare_versions(version.format_hdp_stack_version(ver), "2.3.0.0") < 0:
    return False

  return True
def _valid(stack_name, package, ver):
  if stack_name != "HDP":
    return False

  if version.compare_versions(version.format_hdp_stack_version(ver), "2.3.0.0") < 0:
    return False

  return True