-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from noelmcloughlin/archives
feat(archives): introduce support for archive files
- Loading branch information
Showing
26 changed files
with
457 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import grafana with context %} | ||
grafana-cli-package-archive-clean-file-absent: | ||
file.absent: | ||
- names: | ||
- {{ grafana.pkg.archive.name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#.-*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
include: | ||
- .install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import grafana with context %} | ||
{%- from tplroot ~ "/jinja/macros.jinja" import format_kwargs with context %} | ||
{%- if grafana.pkg.use_upstream_archive %} | ||
grafana-package-archive-install-file-directory: | ||
file.directory: | ||
- name: {{ grafana.pkg.archive.name }} | ||
- user: root | ||
- group: root | ||
- mode: 755 | ||
- makedirs: True | ||
- require_in: | ||
- archive: grafana-package-archive-install-archive-extracted | ||
- recurse: | ||
- user | ||
- group | ||
- mode | ||
grafana-package-archive-install-archive-extracted: | ||
archive.extracted: | ||
{{- format_kwargs(grafana.pkg.archive) }} | ||
- retry: | ||
attempts: 3 | ||
until: True | ||
interval: 60 | ||
splay: 10 | ||
- user: root | ||
- group: root | ||
- recurse: | ||
- user | ||
- group | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ include: | |
- .service.clean | ||
- .config.clean | ||
- .package.clean | ||
- .archive.clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import grafana with context %} | ||
{%- set sls_archive_clean = tplroot ~ '.archive.clean' %} | ||
{%- set sls_package_clean = tplroot ~ '.package.clean' %} | ||
{%- if grains.kernel|lower == 'linux' and grafana.linux.altpriority|int > 0 %} | ||
include: | ||
- {{ sls_archive_clean if grafana.pkg.use_upstream_archive else sls_package_clean }} | ||
grafana-package-archive-remove-home-alternative-remove: | ||
alternatives.remove: | ||
- name: grafana-home | ||
- path: {{ grafana.pkg.archive.name }} | ||
- onlyif: update-alternatives --get-selections |grep ^grafana-home | ||
- require: | ||
- sls: {{ sls_archive_clean if grafana.pkg.use_upstream_archive else sls_package_clean }} | ||
{% for i in ['grafana-cli', 'grafana-server'] %} | ||
grafana-package-archive-remove-{{ i }}-alternative-remove: | ||
alternatives.remove: | ||
- name: link-{{ i }} | ||
- path: {{ grafana.pkg.archive.name }}/bin/{{ i }} | ||
- onlyif: update-alternatives --get-selections |grep ^link-{{ i }} | ||
- require: | ||
- sls: {{ sls_archive_clean if grafana.pkg.use_upstream_archive else sls_package_clean }} | ||
{% endfor %} | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
include: | ||
- .install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import grafana with context %} | ||
{%- set sls_archive_install = tplroot ~ '.archive.install' %} | ||
{%- if grafana.pkg.use_upstream_archive %} | ||
{%- if grains.kernel|lower == 'linux' and grafana.linux.altpriority|int > 0 %} | ||
include: | ||
- {{ sls_archive_install }} | ||
grafana-package-archive-install-home-alternative-install: | ||
cmd.run: | ||
- name: update-alternatives --install {{ grafana.dir }} grafana-home {{ grafana.pkg.archive.name }} {{grafana.linux.altpriority}} | ||
- watch: | ||
- archive: grafana-package-archive-install-archive-extracted | ||
- require: | ||
- sls: {{ sls_archive_install }} | ||
- onlyif: {{ grains.os_family in ('Suse',) }} | ||
alternatives.install: | ||
- name: grafana-home | ||
- link: {{ grafana.dir }} | ||
- path: {{ grafana.pkg.archive.name }} | ||
- priority: {{ grafana.linux.altpriority }} | ||
- order: 10 | ||
- watch: | ||
- archive: grafana-package-archive-install-archive-extracted | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
- require: | ||
- sls: {{ sls_archive_install }} | ||
grafana-package-archive-install-home-alternative-set: | ||
alternatives.set: | ||
- name: grafana-home | ||
- path: {{ grafana.pkg.archive.name }} | ||
- require: | ||
- alternatives: grafana-package-archive-install-home-alternative-install | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
{% for i in ['grafana-cli', 'grafana-server'] %} | ||
grafana-package-archive-install-{{ i }}-alternative-install: | ||
cmd.run: | ||
- name: update-alternatives --install /usr/bin/{{i}} link-{{i}} {{ grafana.pkg.archive.name }}/bin/{{i}} {{grafana.linux.altpriority}} | ||
- require: | ||
- cmd: grafana-package-archive-install-home-alternative-install | ||
- onlyif: {{ grains.os_family in ('Suse',) }} | ||
alternatives.install: | ||
- name: link-{{ i }} | ||
- link: /usr/bin/{{ i }} | ||
- path: {{ grafana.pkg.archive.name }}/bin/{{ i }} | ||
- priority: {{ grafana.linux.altpriority }} | ||
- order: 10 | ||
- require: | ||
- alternatives: grafana-package-archive-install-home-alternative-install | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
grafana-package-archive-install-{{ i }}-alternative-set: | ||
alternatives.set: | ||
- name: link-{{ i }} | ||
- path: {{ grafana.pkg.archive.name }}/bin/{{ i }} | ||
- require: | ||
- alternatives: grafana-package-archive-install-{{ i }}-alternative-install | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
{% endfor %} | ||
{%- endif %} | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- set sls_archive_install = tplroot ~ '.archive.install' %} | ||
{%- set sls_package_install = tplroot ~ '.package.install' %} | ||
{%- from tplroot ~ "/map.jinja" import grafana with context %} | ||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} | ||
include: | ||
- {{ sls_archive_install if grafana.pkg.use_upstream_archive else sls_package_install }} | ||
grafana-config-file-file-managed-environ_file: | ||
file.managed: | ||
- name: {{ grafana.environ_file }} | ||
- source: {{ files_switch(['grafana.sh.jinja'], | ||
lookup='grafana-config-file-file-managed-environ_file' | ||
) | ||
}} | ||
- mode: 640 | ||
- user: root | ||
- group: {{ grafana.rootgroup if grafana.pkg.use_upstream_archive else grafana.group }} | ||
- makedirs: True | ||
- template: jinja | ||
- context: | ||
config: {{ grafana.environ|json }} | ||
- require: | ||
- sls: {{ sls_archive_install if grafana.pkg.use_upstream_archive else sls_package_install }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
|
||
include: | ||
- .file | ||
- .environ | ||
- .alternatives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
######################################################################## | ||
# File managed by Salt at <{{ source }}>. | ||
# Your changes will be overwritten. | ||
######################################################################## | ||
|
||
{%- for item in config %} | ||
{{ item }} | ||
{%- endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import grafana with context %} | ||
include: | ||
- .package | ||
- {{ '.archive' if grafana.pkg.use_upstream_archive else '.package' }} | ||
- .config | ||
- .service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.