Example #1
0
def check_stack_feature(stack_feature, stack_version):
    """
  Given a stack_feature and a specific stack_version, it validates that the feature is supported by the stack_version.
  :param stack_feature: Feature name to check if it is supported by the stack. For example: "rolling_upgrade"
  :param stack_version: Version of the stack
  :return: Will return True if successful, otherwise, False. 
  """
    stack_features_config = default(
        "/configurations/cluster-env/stack_features", None)
    data = _DEFAULT_STACK_FEATURES

    if stack_features_config:
        data = json.loads(stack_features_config)

    for feature in data["stack_features"]:
        if feature["name"] == stack_feature:
            if "min_version" in feature:
                min_version = feature["min_version"]
                if Script.is_stack_less_than(min_version):
                    return False
            if "max_version" in feature:
                max_version = feature["max_version"]
                if Script.is_stack_greater_or_equal(max_version):
                    return False
            return True

    return False
Example #2
0
  def pre_upgrade_restart(self, env, upgrade_type=None):
    Logger.info("Executing Stack Upgrade pre-restart")
    import params
    env.set_params(params)

    # this function should not execute if the version can't be determined or
    # is not at least HDP 2.2.0.0
    if Script.is_stack_less_than("2.2"):
      return

    Logger.info("Executing Falcon Server Stack Upgrade pre-restart")
    conf_select.select(params.stack_name, "falcon", params.version)
    stack_select.select("falcon-server", params.version)
    falcon_server_upgrade.pre_start_restore()