Exemplo n.º 1
0
    def _populate_jdk_configs(self, properties, jdk_num):
        if properties.has_key(JDK_RELEASES):
            jdk_names = properties[JDK_RELEASES].split(',')
            jdk_names = filter(None, jdk_names)
            jdks = []
            for jdk_name in jdk_names:
                jdkR = JDKRelease.from_properties(properties, jdk_name)
                jdks.append(jdkR)
        else:
            jdks = self.JDK_DEFAULT_CONFIGS

        n_config = 1
        jdk_choice_prompt = ''
        jdk_choices = ''
        for jdk in jdks:
            jdk_choice_prompt += self.JDK_PROMPT.format(n_config, jdk.desc)
            jdk_choices += str(n_config)
            n_config += 1

        jdk_choice_prompt += self.JDK_CUSTOM_CHOICE_PROMPT.format(
            n_config, jdk_num)
        jdk_valid_choices = self.JDK_VALID_CHOICES.format(
            jdk_choices, n_config)

        return jdks, jdk_choice_prompt, jdk_valid_choices, n_config - 1
Exemplo n.º 2
0
  def _populate_jdk_configs(self, properties, jdk_num, ambariOnly = False):
    def remove_jdk_condition(name):
      """
      Removes jdk1.7 from the default choices.
      This method can be removed if JDK 7 support (for stack services) will be dropped.
      """
      if name != "jdk1.7":
        return True
      else:
       print "JDK 7 detected. Removed from choices."
       return False
    if properties.has_key(JDK_RELEASES):
      jdk_names = properties[JDK_RELEASES].split(',')
      jdk_names = filter(None, jdk_names)
      if ambariOnly:
        jdk_names = filter(lambda x : remove_jdk_condition(x), jdk_names)
      jdks = []
      for jdk_name in jdk_names:
        jdkR = JDKRelease.from_properties(properties, jdk_name)
        jdks.append(jdkR)
    else:
      jdks = self.JDK_DEFAULT_CONFIGS

    n_config = 1
    jdk_choice_prompt = ''
    jdk_choices = ''
    for jdk in jdks:
      jdk_choice_prompt += self.JDK_PROMPT.format(n_config, jdk.desc)
      jdk_choices += str(n_config)
      n_config += 1

    jdk_choice_prompt += self.JDK_CUSTOM_CHOICE_PROMPT.format(n_config, jdk_num)
    jdk_valid_choices = self.JDK_VALID_CHOICES.format(jdk_choices, n_config)

    return jdks, jdk_choice_prompt, jdk_valid_choices, n_config - 1
Exemplo n.º 3
0
  def _populate_jdk_configs(self, properties, jdk_num):
    if properties.has_key(JDK_RELEASES):
      jdk_names = properties[JDK_RELEASES].split(',')
      jdks = []
      for jdk_name in jdk_names:
        jdkR = JDKRelease.from_properties(properties, jdk_name)
        jdks.append(jdkR)
    else:
      jdks = self.JDK_DEFAULT_CONFIGS

    n_config = 1
    jdk_choice_prompt = ''
    jdk_choices = ''
    for jdk in jdks:
      jdk_choice_prompt += self.JDK_PROMPT.format(n_config, jdk.desc)
      jdk_choices += str(n_config)
      n_config += 1

    jdk_choice_prompt += self.JDK_CUSTOM_CHOICE_PROMPT.format(n_config, jdk_num)
    jdk_valid_choices = self.JDK_VALID_CHOICES.format(jdk_choices, n_config)

    return jdks, jdk_choice_prompt, jdk_valid_choices, n_config - 1