<commit_before>{% from "influxdb/map.jinja" import influxdb_settings with context %}

{% if influxdb_settings['version'] is defined %}
  {% set influxdb_version = salt['pillar.get']('influxdb:version') %}
  {% set major, minor = influxdb_version.split('.')[:2] %}

  {% if major == '0' and minor|int < 10 %}
    {% set base_url = 'http://s3.amazonaws.com/influxdb' %}
    {% if grains['os_family'] == 'Debian' %}
      {% set filename = "influxdb_" + influxdb_settings['version'] + "_" + grains['osarch'] + ".deb" %}
    {% elif grains['os_family'] == 'RedHat' %}
      {% set filename = "influxdb-" + influxdb_settings['version'] + "-1." + grains['osarch'] + ".rpm" %}
    {% endif %}
  {% elif major == '0' and minor|int >= 10 and minor|int < 13 %}
    {% set base_url = 'http://s3.amazonaws.com/influxdb' %}
    {% if grains['os_family'] == 'Debian' %}
      {% set filename = "influxdb_" + influxdb_settings['version'] + "-1_" + grains['osarch'] + ".deb" %}
    {% elif grains['os_family'] == 'RedHat' %}
      {% set filename = "influxdb-" + influxdb_settings['version'] + "-1." + grains['osarch'] + ".rpm" %}
    {% endif %}
  {% else %}
    {% set base_url = 'https://dl.influxdata.com/influxdb/releases' %}
    {% if grains['os_family'] == 'Debian' %}
      {% set filename = "influxdb_" + influxdb_settings['version'] + "_" + grains['osarch'] + ".deb" %}
    {% elif grains['os_family'] == 'RedHat' %}
      {% set filename = "influxdb-" + influxdb_settings['version'] + "." + grains['osarch'] + ".rpm" %}
    {% endif %}
  {% endif %}
{% endif %}

{% if influxdb_settings['use_wget_on_install'] == True %}
influxdb_package:
  cmd.run:
    - name: wget -qO /tmp/{{ filename }} {{ base_url }}/{{ filename }}
    - unless: test -f /tmp/{{ filename }}

influxdb_remove_broken_download:
  file.absent:
    - name: /tmp/{{ filename }}
    - onfail:
      - cmd: influxdb_package


influxdb_install:<commit_msg>fix(states): use curl instead of wget (not installed everywhere)<commit_after>{% from "influxdb/map.jinja" import influxdb_settings with context %}

{% if influxdb_settings['version'] is defined %}
  {% set influxdb_version = salt['pillar.get']('influxdb:version') %}
  {% set major, minor = influxdb_version.split('.')[:2] %}

  {% if major == '0' and minor|int < 10 %}
    {% set base_url = 'http://s3.amazonaws.com/influxdb' %}
    {% if grains['os_family'] == 'Debian' %}
      {% set filename = "influxdb_" + influxdb_settings['version'] + "_" + grains['osarch'] + ".deb" %}
    {% elif grains['os_family'] == 'RedHat' %}
      {% set filename = "influxdb-" + influxdb_settings['version'] + "-1." + grains['osarch'] + ".rpm" %}
    {% endif %}
  {% elif major == '0' and minor|int >= 10 and minor|int < 13 %}
    {% set base_url = 'http://s3.amazonaws.com/influxdb' %}
    {% if grains['os_family'] == 'Debian' %}
      {% set filename = "influxdb_" + influxdb_settings['version'] + "-1_" + grains['osarch'] + ".deb" %}
    {% elif grains['os_family'] == 'RedHat' %}
      {% set filename = "influxdb-" + influxdb_settings['version'] + "-1." + grains['osarch'] + ".rpm" %}
    {% endif %}
  {% else %}
    {% set base_url = 'https://dl.influxdata.com/influxdb/releases' %}
    {% if grains['os_family'] == 'Debian' %}
      {% set filename = "influxdb_" + influxdb_settings['version'] + "_" + grains['osarch'] + ".deb" %}
    {% elif grains['os_family'] == 'RedHat' %}
      {% set filename = "influxdb-" + influxdb_settings['version'] + "." + grains['osarch'] + ".rpm" %}
    {% endif %}
  {% endif %}
{% endif %}

{% if influxdb_settings['use_wget_on_install'] == True %}
influxdb_package:
  cmd.run:
    - name: curl -s --output /tmp/{{ filename }} {{ base_url }}/{{ filename }}
    - unless: test -f /tmp/{{ filename }}

influxdb_remove_broken_download:
  file.absent:
    - name: /tmp/{{ filename }}
    - onfail:
      - cmd: influxdb_package


influxdb_install:
{'fraction_non_alphanumeric': 0.21636223308464111, 'fraction_numerical': 0.0072034988422948285, 'mean_word_length': 3.5, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4693300', 'n_tokens_mistral': 1543, 'n_tokens_neox': 1321, 'n_words': 270}