-
Notifications
You must be signed in to change notification settings - Fork 51
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): tarball archives & linux alternatives
- Loading branch information
Showing
49 changed files
with
1,236 additions
and
369 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 |
---|---|---|
|
@@ -42,7 +42,6 @@ provisioner: | |
base: | ||
'*': | ||
- prometheus | ||
- prometheus.exporters | ||
pillars: | ||
top.sls: | ||
base: | ||
|
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] %} | ||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %} | ||
{%- if grains.kernel|lower == 'linux' and p.linux.altpriority|int > 0 %} | ||
{%- for name in p.wanted %} | ||
{%- set bundle = name + '-%s.%s-%s'|format(p.pkg[name]['archive_version'], p.kernel, p.arch) %} | ||
prometheus-archive-remove-{{ name }}-home-alternatives-remove: | ||
alternatives.remove: | ||
- name: prometheus-{{ name }}-home | ||
- path: {{ p.dir.basedir }}/{{ bundle }} | ||
- onlyif: update-alternatives --get-selections |grep ^prometheus-{{ name }}-home | ||
{% for b in p.pkg[name]['binaries'] %} | ||
prometheus-archive-remove-{{ name }}-alternatives-remove-{{ b }}: | ||
alternatives.remove: | ||
- name: prometheus-{{ name }}-{{ b }} | ||
- path: {{ p.dir.basedir }}/{{ bundle }}/{{ b }} | ||
- onlyif: update-alternatives --get-selections |grep ^prometheus-{{ name }}-{{ b }} | ||
{% endfor %} | ||
{% 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,79 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %} | ||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} | ||
{%- set sls_archive_install = tplroot ~ '.archive' %} | ||
{%- if grains.kernel|lower in ('linux',) and p.linux.altpriority|int > 0 %} | ||
include: | ||
- {{ sls_archive_install }} | ||
{%- for name in p.wanted %} | ||
{%- set bundle = name + '-%s.%s-%s'|format(p.pkg[name]['archive_version'], p.kernel, p.arch) %} | ||
{%- if grains.os_family == 'Suse' %} | ||
prometheus-archive-alternatives-install-{{ name }}-home-cmd-run: | ||
cmd.run: | ||
- name: update-alternatives --install {{ p.dir.basedir }}/{{ name }} prometheus-{{ name }}-home {{ p.dir.basedir }}/{{ bundle }} {{p.linux.altpriority}} | ||
- watch: | ||
- archive: prometheus-archive-install-{{ name }}-archive-extracted | ||
{%- else %} | ||
prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install: | ||
alternatives.install: | ||
- name: prometheus-{{ name }}-home | ||
- link: {{ p.dir.basedir }}/{{ name }} | ||
- path: {{ p.dir.basedir }}/{{ bundle }} | ||
- priority: {{ p.linux.altpriority }} | ||
- order: 10 | ||
- watch: | ||
- archive: prometheus-archive-install-{{ name }}-archive-extracted | ||
- onlyif: {{ grains.os_family not in ('Suse',) }} | ||
prometheus-archive-alternatives-install-{{ name }}-home-alternatives-set: | ||
alternatives.set: | ||
- name: prometheus-{{ name }}-home | ||
- path: {{ p.dir.basedir }}/{{ bundle }} | ||
- require: | ||
- cmd: prometheus-archive-alternatives-install-{{ name }}-home-cmd-run | ||
- alternatives: prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install | ||
{%- endif %} | ||
{% for b in p.pkg[name]['binaries'] %} | ||
{%- if grains.os_family == 'Suse' %} | ||
prometheus-archive-alternatives-install-{{ name }}-cmd-run-{{ b }}-alternative: | ||
cmd.run: | ||
- onlyif: {{ grains.os_family in ('Suse',) }} | ||
- name: update-alternatives --install /usr/local/bin/{{ b }} prometheus-{{ name }}-{{ b }} {{ p.dir.basedir }}/{{ bundle }}/{{ b }} {{ p.linux.altpriority }} | ||
- require: | ||
- cmd: prometheus-archive-alternatives-install-{{ name }}-home-cmd-run | ||
{%- else %} | ||
prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }}: | ||
alternatives.install: | ||
- name: prometheus-{{ name }}-{{ b }} | ||
- link: /usr/local/bin/{{ b }} | ||
- path: {{ p.dir.basedir }}/{{ bundle }}/{{ b }} | ||
- priority: {{ p.linux.altpriority }} | ||
- order: 10 | ||
- require: | ||
- alternatives: prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install | ||
prometheus-archive-alternatives-install-{{ name }}-alternatives-set-{{ b }}: | ||
alternatives.set: | ||
- name: prometheus-{{ name }}-{{ b }} | ||
- path: {{ p.dir.basedir }}/{{ bundle }}/{{ b }} | ||
- require: | ||
- alternatives: prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }} | ||
{%- endif %} | ||
{% endfor %} | ||
{% 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,35 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %} | ||
{%- set sls_alternatives_clean = tplroot ~ '.archive.alternatives.clean' %} | ||
{%- set sls_users_clean = tplroot ~ '.config.users.clean' %} | ||
{%- set sls_service_clean = tplroot ~ '.service.clean' %} | ||
include: | ||
- {{ sls_users_clean }} | ||
- {{ sls_service_clean }} | ||
- {{ sls_alternatives_clean }} | ||
{%- for name in p.wanted %} | ||
prometheus-archive-clean-{{ name }}-file-absent: | ||
file.absent: | ||
- names: | ||
- {{ p.dir.basedir }}/{{ name + '-%s.%s-%s'|format(p.pkg[name]['archive_version'], p.kernel, p.arch) }} | ||
prometheus-archive-clean-{{ name }}-user-absent: | ||
user.absent: | ||
- name: {{ name }} | ||
group.absent: | ||
- name: {{ name }} | ||
- require: | ||
- user: prometheus-archive-clean-{{ name }}-user-absent | ||
{%- endfor %} | ||
prometheus-archive-clean-basedir-file-directory: | ||
file.absent: | ||
- name: {{ p.dir.basedir }} |
Oops, something went wrong.