Skip to content
Snippets Groups Projects
Unverified Commit d40a6c5d authored by N's avatar N
Browse files

Only download archive if necessary

parent eb0431fb
No related branches found
No related tags found
No related merge requests found
...@@ -9,28 +9,24 @@ mysql-macos-extract-dirs: ...@@ -9,28 +9,24 @@ mysql-macos-extract-dirs:
file.directory: file.directory:
- name: {{ dl.tmpdir }} - name: {{ dl.tmpdir }}
- makedirs: True - makedirs: True
- clean: True
{%- for product, data in mysql.macos.products.items() if "enabled" in data and data.enabled %} {%- for product, data in mysql.macos.products.items() if "enabled" in data and data.enabled %}
{%- set archivefile = data.url.split('/')[-1] %} {%- set archivefile = data.url.split('/')[-1] %}
{%- set archiveformat = archivefile.split('.')[-1] %} {%- set archiveformat = archivefile.split('.')[-1] %}
{%- set archivename = archivefile|replace('.dmg', '')|replace('.tar.gz', '')|replace('.zip', '') %} {%- set archivename = archivefile|replace('.dmg', '')|replace('.tar.gz', '')|replace('.zip', '') %}
mysql-macos-remove-previous-{{ product }}-download-archive:
file.absent:
- name: {{ dl.tmpdir }}/{{ archivefile }}
- require_in:
- mysql-macos-download-{{ product }}-archive
mysql-macos-download-{{ product }}-archive: mysql-macos-download-{{ product }}-archive:
pkg.installed: pkg.installed:
- name: curl - name: curl
cmd.run: cmd.run:
- name: curl {{ dl.opts }} -o {{ dl.tmpdir }}/{{ archivefile }} {{ data.url }} - name: curl {{ dl.opts }} -o {{ dl.tmpdir }}/{{ archivefile }} {{ data.url }}
- unless: test -f {{ dl.tmpdir }}/{{ archivefile }}
{% if grains['saltversioninfo'] >= [2017, 7, 0] %} {% if grains['saltversioninfo'] >= [2017, 7, 0] %}
- retry: - retry:
attempts: {{ dl.retries }} attempts: {{ dl.retries }}
interval: {{ dl.interval }} interval: {{ dl.interval }}
until: True
splay: 10
{% endif %} {% endif %}
- require: - require:
- mysql-macos-extract-dirs - mysql-macos-extract-dirs
...@@ -41,8 +37,8 @@ mysql-macos-check-{{ product }}-archive-hash: ...@@ -41,8 +37,8 @@ mysql-macos-check-{{ product }}-archive-hash:
- name: file.check_hash - name: file.check_hash
- path: {{ dl.tmpdir }}/{{ archivefile }} - path: {{ dl.tmpdir }}/{{ archivefile }}
- file_hash: {{ data.sum }} - file_hash: {{ data.sum }}
- onchanges: - require:
- mysql-macos-download-{{ product }}-archive - cmd: mysql-macos-download-{{ product }}-archive
- require_in: - require_in:
- mysql-macos-{{ product }}-install - mysql-macos-{{ product }}-install
{%- endif %} {%- endif %}
...@@ -68,10 +64,7 @@ mysql-macos-{{ product }}-install: ...@@ -68,10 +64,7 @@ mysql-macos-{{ product }}-install:
- source_hash: {{ data.sum }} - source_hash: {{ data.sum }}
- onchanges: - onchanges:
- mysql-macos-download-{{ product }}-archive - mysql-macos-download-{{ product }}-archive
{%- endif %} {%- endif %}
- require_in:
- mysql-macos-tidyup-{{ product }}
{%- if "path" in data and data.path and "app" in data and data.app %} {%- if "path" in data and data.path and "app" in data and data.app %}
...@@ -100,12 +93,4 @@ mysql-macos-{{ product }}-desktop-shortcut-add: ...@@ -100,12 +93,4 @@ mysql-macos-{{ product }}-desktop-shortcut-add:
- file: mysql-macos-{{ product }}-desktop-shortcut-add - file: mysql-macos-{{ product }}-desktop-shortcut-add
{%- endif %} {%- endif %}
mysql-macos-tidyup-{{ product }}:
file.absent:
- name: {{ dl.tmpdir }}/{{ archivefile }}
- onchanges:
- mysql-macos-download-{{ product }}-archive
{% endfor %} {% endfor %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment