예제 #1
0
    def set_pre_start(self, env):
        import params
        env.set_params(params)

        orchestration = stack_select.PACKAGE_SCOPE_STANDARD
        summary = upgrade_summary.get_upgrade_summary()

        if summary is not None:
            orchestration = summary.orchestration
            if orchestration is None:
                raise Fail(
                    "The upgrade summary does not contain an orchestration type"
                )

            if orchestration.upper(
            ) in stack_select._PARTIAL_ORCHESTRATION_SCOPES:
                orchestration = stack_select.PACKAGE_SCOPE_PATCH

        stack_select_packages = stack_select.get_packages(
            orchestration,
            service_name="RANGER",
            component_name="RANGER_ADMIN")
        if stack_select_packages is None:
            raise Fail("Unable to get packages for stack-select")

        Logger.info(
            "RANGER_ADMIN component will be stack-selected to version {0} using a {1} orchestration"
            .format(params.version, orchestration.upper()))

        for stack_select_package_name in stack_select_packages:
            stack_select.select(stack_select_package_name, params.version)
예제 #2
0
def setup_stack_symlinks(struct_out_file):
    """
  Invokes <stack-selector-tool> set all against a calculated fully-qualified, "normalized" version based on a
  stack version, such as "4.1". This should always be called after a component has been
  installed to ensure that all IOP pointers are correct. The stack upgrade logic does not
  interact with this since it's done via a custom command and will not trigger this hook.
  :return:
  """
    import params
    if params.upgrade_suspended:
        Logger.warning(
            "Skipping running stack-selector-tool because there is a suspended upgrade"
        )
        return

    # get the packages which the stack-select tool should be used on
    stack_packages = stack_select.get_packages(
        stack_select.PACKAGE_SCOPE_INSTALL)
    if stack_packages is None:
        return

    json_version = load_version(struct_out_file)

    if not json_version:
        Logger.info(
            "There is no advertised version for this component stored in {0}".
            format(struct_out_file))
        return

    # On parallel command execution this should be executed by a single process at a time.
    with FcntlBasedProcessLock(params.stack_select_lock_file,
                               enabled=params.is_parallel_execution_enabled,
                               skip_fcntl_failures=True):
        for package in stack_packages:
            stack_select.select(package, json_version)
예제 #3
0
  def configure_atlas_user_for_tagsync(self, env):
    Logger.info("Configuring Atlas user for Tagsync service.")
    import params
    env.set_params(params)

    orchestration = stack_select.PACKAGE_SCOPE_STANDARD
    summary = upgrade_summary.get_upgrade_summary()

    if summary is not None:
      orchestration = summary.orchestration
      if orchestration is None:
        raise Fail("The upgrade summary does not contain an orchestration type")

      if orchestration.upper() in stack_select._PARTIAL_ORCHESTRATION_SCOPES:
        orchestration = stack_select.PACKAGE_SCOPE_PATCH

    stack_select_packages = stack_select.get_packages(orchestration, service_name = "RANGER", component_name = "RANGER_TAGSYNC")
    if stack_select_packages is None:
      raise Fail("Unable to get packages for stack-select")

    Logger.info("RANGER_TAGSYNC component will be stack-selected to version {0} using a {1} orchestration".format(params.version, orchestration.upper()))

    for stack_select_package_name in stack_select_packages:
      stack_select.select(stack_select_package_name, params.version)

    if params.stack_supports_ranger_tagsync_ssl_xml_support:
      Logger.info("Upgrading Tagsync, stack support Atlas user for Tagsync, creating keystore for same.")
      self.create_atlas_user_keystore(env)
    else:
      Logger.info("Upgrading Tagsync, stack does not support Atlas user for Tagsync, skipping keystore creation for same.")

    Logger.info("Configuring Atlas user for Tagsync service done.")
예제 #4
0
    def update_atlas_simple_authz(self, env):
        import params
        env.set_params(params)
        if params.upgrade_direction == Direction.UPGRADE:
            orchestration = stack_select.PACKAGE_SCOPE_STANDARD
            summary = upgrade_summary.get_upgrade_summary()

            if summary is not None:
                orchestration = summary.orchestration
                if orchestration is None:
                    raise Fail(
                        "The upgrade summary does not contain an orchestration type"
                    )

                if orchestration.upper(
                ) in stack_select._PARTIAL_ORCHESTRATION_SCOPES:
                    orchestration = stack_select.PACKAGE_SCOPE_PATCH

            stack_select_packages = stack_select.get_packages(
                orchestration,
                service_name="ATLAS",
                component_name="ATLAS_SERVER")
            if stack_select_packages is None:
                raise Fail("Unable to get packages for stack-select")

            Logger.info(
                "ATLAS_SERVER component will be stack-selected to version {0} using a {1} orchestration"
                .format(params.version, orchestration.upper()))

            for stack_select_package_name in stack_select_packages:
                stack_select.select(stack_select_package_name, params.version)
            Directory(
                format('{metadata_home}/'),
                owner=params.metadata_user,
                group=params.user_group,
                recursive_ownership=True,
            )

            target_version = upgrade_summary.get_target_version('ATLAS')
            update_atlas_simple_authz_script = os.path.join(
                format('{stack_root}'), target_version, 'atlas', 'bin',
                'atlas_update_simple_auth_json.py')
            update_atlas_simple_authz_command = format(
                'source {params.conf_dir}/atlas-env.sh ; {update_atlas_simple_authz_script} {conf_dir}'
            )
            Execute(
                update_atlas_simple_authz_command,
                only_if=format("test -e {update_atlas_simple_authz_script}"),
                user=params.metadata_user)
            atlas_simple_auth_policy_file = os.path.join(
                format('{conf_dir}'), 'atlas-simple-authz-policy.json')
            File(atlas_simple_auth_policy_file,
                 group=params.user_group,
                 owner=params.metadata_user,
                 only_if=format("test -e {atlas_simple_auth_policy_file}"),
                 mode=0644)