Exemplo n.º 1
0
def mainBody():
    parser = optparse.OptionParser(
        usage="usage: %prog [options] action [stack_id os]", )
    init_parser_options(parser)
    (options, args) = parser.parse_args()

    # check if only silent key set
    default_options = parser.get_default_values()
    silent_options = default_options
    silent_options.silent = True

    if options == silent_options:
        options.only_silent = True
    else:
        options.only_silent = False

    # set verbose
    set_verbose(options.verbose)
    if options.verbose:
        main(options, args, parser)
    else:
        try:
            main(options, args, parser)
        except Exception as e:
            print_error_msg("Unexpected {0}: {1}".format((e).__class__.__name__, str(e)) +\
            "\nFor more info run ambari-server with -v or --verbose option")
            sys.exit(1)
Exemplo n.º 2
0
def mainBody():
  parser = optparse.OptionParser(usage="usage: %prog [options] action [stack_id os]",)
  init_parser_options(parser)
  (options, args) = parser.parse_args()

  # check if only silent key set
  default_options = parser.get_default_values()
  silent_options = default_options
  silent_options.silent = True

  if options == silent_options:
    options.only_silent = True
  else:
    options.only_silent = False

  # set verbose
  set_verbose(options.verbose)
  if options.verbose:
    main(options, args, parser)
  else:
    try:
      main(options, args, parser)
    except Exception as e:
      print_error_msg("Unexpected {0}: {1}".format((e).__class__.__name__, str(e)) +\
      "\nFor more info run ambari-server with -v or --verbose option")
      sys.exit(1)     
Exemplo n.º 3
0
    def SvcDoRun(self):
        from ambari_server_main import server_process_main

        scmStatus = SvcStatusCallback(self)

        properties = get_ambari_properties()
        self.options.verbose = get_value_from_properties(
            properties, VERBOSE_OUTPUT_KEY, False)
        self.options.debug = get_value_from_properties(properties,
                                                       DEBUG_MODE_KEY, False)
        self.options.suspend_start = get_value_from_properties(
            properties, SUSPEND_START_MODE_KEY, False)

        # set verbose
        set_verbose(self.options.verbose)

        self.redirect_output_streams()

        childProc = server_process_main(self.options, scmStatus)

        if not self._StopOrWaitForChildProcessToFinish(childProc):
            return

        pid_file_path = os.path.join(configDefaults.PID_DIR, PID_NAME)
        remove_file(pid_file_path)
        pass
Exemplo n.º 4
0
def mainBody():
  parser = optparse.OptionParser(usage="usage: %prog action [options]",)
  action = sys.argv[1]

  if action == "setup-ldap":
    print "setup-ldap action is deprecated. Please configure LDAP integration from the Ambari UI"
    sys.exit(0)

  init_action_parser(action, parser)
  (options, args) = parser.parse_args()

  # check if only silent key set
  default_options = parser.get_default_values()
  silent_options = default_options
  silent_options.silent = True

  if options == silent_options:
    options.only_silent = True
  else:
    options.only_silent = False

  # set verbose
  set_verbose(options.verbose)
  if options.verbose:
    main(options, args, parser)
  else:
    try:
      main(options, args, parser)
    except Exception as e:
      print_error_msg("Unexpected {0}: {1}".format((e).__class__.__name__, str(e)) +\
      "\nFor more info run ambari-server with -v or --verbose option")
      sys.exit(1)     
Exemplo n.º 5
0
def mainBody():
  parser = optparse.OptionParser(usage="usage: %prog [options] action [stack_id os]",)
  init_parser_options(parser)
  (options, args) = parser.parse_args()

  # set verbose
  set_verbose(options.verbose)
  if options.verbose:
    main(options, args, parser)
  else:
    try:
      main(options, args, parser)
    except Exception as e:
      print_error_msg("Unexpected {0}: {1}".format((e).__class__.__name__, str(e)) +\
      "\nFor more info run ambari-server with -v or --verbose option")
      sys.exit(1)     
Exemplo n.º 6
0
def mainBody():
  parser = optparse.OptionParser(usage="usage: %prog [options] action [stack_id os]",)
  init_parser_options(parser)
  (options, args) = parser.parse_args()

  # set verbose
  set_verbose(options.verbose)
  if options.verbose:
    main(options, args, parser)
  else:
    try:
      main(options, args, parser)
    except Exception as e:
      print_error_msg("Unexpected {0}: {1}".format((e).__class__.__name__, str(e)) +\
      "\nFor more info run tbds-server with -v or --verbose option")
      sys.exit(1)
def switch_addon_services(config_file):

    old_verbose_level = get_verbose()
    set_verbose(True)
    if not os.path.exists(config_file):
        print_error_msg(
            'Configuration file {0} does not exist!'.format(config_file))
        set_verbose(old_verbose_level)
        return 1

    print_info_msg(
        "Switching addon services using config file {0}".format(config_file))
    stack_location, extension_location, service_definitions_location, mpacks_staging_location, dashboard_location = get_mpack_properties(
    )
    mpack_metadata = _named_dict(json.load(open(config_file, "r")))
    if not mpack_metadata:
        print_error_msg('Malformed configuration file {0}'.format(config_file))
        set_verbose(old_verbose_level)
        return 1

    mpack_name = mpack_metadata.name
    mpack_version = mpack_metadata.version
    mpack_dirname = mpack_name + "-" + mpack_version
    mpack_staging_dir = os.path.join(mpacks_staging_location, mpack_dirname)

    options = _named_dict(
        ast.literal_eval("{'force' : True, 'verbose' : True}"))
    for artifact in mpack_metadata.artifacts:
        # Artifact name (Friendly name)
        artifact_name = artifact.name
        # Artifact type (stack-definitions, extension-definitions, service-definitions, etc)
        artifact_type = artifact.type
        # Artifact directory with contents of the artifact
        artifact_source_dir = os.path.join(mpack_staging_dir,
                                           artifact.source_dir)

        # Artifact directory with contents of the artifact
        artifact_source_dir = os.path.join(mpack_staging_dir,
                                           artifact.source_dir)
        print_info_msg("Processing artifact {0} of type {1} in {2}".format(
            artifact_name, artifact_type, artifact_source_dir))
        if artifact.type == STACK_ADDON_SERVICE_DEFINITIONS_ARTIFACT_NAME:
            process_stack_addon_service_definitions_artifact(
                artifact, artifact_source_dir, options)

    print_info_msg(
        "Successfully switched addon services using config file {0}".format(
            config_file))
    set_verbose(old_verbose_level)
    return 0
  def SvcDoRun(self):
    from ambari_server_main import server_process_main

    scmStatus = SvcStatusCallback(self)

    properties = get_ambari_properties()
    self.options.verbose = get_value_from_properties(properties, VERBOSE_OUTPUT_KEY, False)
    self.options.debug = get_value_from_properties(properties, DEBUG_MODE_KEY, False)
    self.options.suspend_start = get_value_from_properties(properties, SUSPEND_START_MODE_KEY, False)

    # set verbose
    set_verbose(self.options.verbose)

    self.redirect_output_streams()

    childProc = server_process_main(self.options, scmStatus)

    if not self._StopOrWaitForChildProcessToFinish(childProc):
      return

    pid_file_path = os.path.join(configDefaults.PID_DIR, PID_NAME)
    remove_file(pid_file_path)
    pass