<commit_before>{% set version = pillar['java']['version'] -%}
{% set java_home = '/usr/lib/jvm/java-{0}-oracle'.format(version) -%}

oraclejdk_repo:
  pkgrepo.managed:
    - humanname: Oracle JDK PPA
    - name: ppa:webupd8team/java
    - file: /etc/apt/sources.list.d/oraclejdk.list

java_autoaccept:
  cmd.wait:
    - name: echo oracle-java{{ version }}-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
    - watch:
      - pkgrepo: oraclejdk_repo

jdk-pkg:
  pkg.installed:
    - names:
      - oracle-java{{ version }}-installer
      - oracle-java{{ version }}-set-default
    - require:
      - pkgrepo: oraclejdk_repo
      - cmd: java_autoaccept

java_alternatives_installation:
  cmd.wait:
    - name: update-java-alternatives -s java-{{ version }}-oracle
    - watch:
      - pkg: jdk-pkg

java_alternatives_setup:
  cmd.run:<commit_msg>Accepting license for both oracle jdk versions<commit_after>{% set version = pillar['java']['version'] -%}
{% set java_home = '/usr/lib/jvm/java-{0}-oracle'.format(version) -%}

oraclejdk_repo:
  pkgrepo.managed:
    - humanname: Oracle JDK PPA
    - name: ppa:webupd8team/java
    - file: /etc/apt/sources.list.d/oraclejdk.list

java_autoaccept:
  cmd.wait:
    - names: 
      - echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
      - echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
    - watch:
      - pkgrepo: oraclejdk_repo

jdk-pkg:
  pkg.installed:
    - names:
      - oracle-java{{ version }}-installer
      - oracle-java{{ version }}-set-default
    - require:
      - pkgrepo: oraclejdk_repo
      - cmd: java_autoaccept

java_alternatives_installation:
  cmd.wait:
    - name: update-java-alternatives -s java-{{ version }}-oracle
    - watch:
      - pkg: jdk-pkg

java_alternatives_setup:
  cmd.run:
{'fraction_non_alphanumeric': 0.1394504924831519, 'fraction_numerical': 0.006220839813374806, 'mean_word_length': 2.9148073022312375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '57939', 'n_tokens_mistral': 730, 'n_tokens_neox': 682, 'n_words': 125}