-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(linux): alternatives support & updated unit tests
- Loading branch information
1 parent
b074bd3
commit 36b3e62
Showing
16 changed files
with
232 additions
and
104 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,34 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import prometheus with context %} | ||
{%- set sls_archive_clean = tplroot ~ '.archive.clean' %} | ||
{%- set sls_package_clean = tplroot ~ '.package.clean' %} | ||
{%- if grains.kernel|lower == 'linux' and prometheus.linux.altpriority|int > 0 %} | ||
include: | ||
- {{ sls_archive_clean if prometheus.pkg.use_upstream_archive else sls_package_clean }} | ||
prometheus-package-archive-remove-home-alternative-remove: | ||
alternatives.remove: | ||
- name: prometheus-home | ||
- path: {{ prometheus.base_dir }} | ||
- onlyif: update-alternatives --get-selections |grep ^prometheus-home | ||
- require: | ||
- sls: {{ sls_archive_clean if prometheus.pkg.use_upstream_archive else sls_package_clean }} | ||
{% for i in ['prometheus', 'promtool'] %} | ||
prometheus-package-archive-remove-{{ i }}-alternative-remove: | ||
alternatives.remove: | ||
- name: link-{{ i }} | ||
- path: {{ prometheus.base_dir }}/{{ i }} | ||
- onlyif: update-alternatives --get-selections |grep ^link-{{ i }} | ||
- require: | ||
- sls: {{ sls_archive_clean if prometheus.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,70 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import prometheus with context %} | ||
{%- set sls_archive_install = tplroot ~ '.archive.install' %} | ||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} | ||
{%- if grains.kernel|lower == 'linux' and prometheus.linux.altpriority|int > 0 %} | ||
include: | ||
- {{ sls_archive_install }} | ||
prometheus-package-archive-install-home-alternative-install: | ||
cmd.run: | ||
- name: update-alternatives --install {{ prometheus.dir }} prometheus-home {{ prometheus.base_dir }} {{prometheus.linux.altpriority}} | ||
- watch: | ||
- archive: prometheus-package-archive-install-archive-extracted | ||
- require: | ||
- sls: {{ sls_archive_install }} | ||
- onlyif: {{ grains.os_family in ('Suse',) }} | ||
alternatives.install: | ||
- name: prometheus-home | ||
- link: {{ prometheus.dir }} | ||
- path: {{ prometheus.base_dir }} | ||
- priority: {{ prometheus.linux.altpriority }} | ||
- order: 10 | ||
- watch: | ||
- archive: prometheus-package-archive-install-archive-extracted | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
- require: | ||
- sls: {{ sls_archive_install }} | ||
prometheus-package-archive-install-home-alternative-set: | ||
alternatives.set: | ||
- name: prometheus-home | ||
- path: {{ prometheus.base_dir }} | ||
- require: | ||
- alternatives: prometheus-package-archive-install-home-alternative-install | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
{% for i in ['prometheus', 'promtool'] %} | ||
prometheus-package-archive-install-{{ i }}-alternative-install: | ||
cmd.run: | ||
- name: update-alternatives --install /usr/bin/{{i}} link-{{i}} {{ prometheus.base_dir }}/{{i}} {{prometheus.linux.altpriority}} | ||
- require: | ||
- cmd: prometheus-package-archive-install-home-alternative-install | ||
- onlyif: {{ grains.os_family in ('Suse',) }} | ||
alternatives.install: | ||
- name: link-{{ i }} | ||
- link: /usr/bin/{{ i }} | ||
- path: {{ prometheus.base_dir }}/{{ i }} | ||
- priority: {{ prometheus.linux.altpriority }} | ||
- order: 10 | ||
- require: | ||
- alternatives: prometheus-package-archive-install-home-alternative-install | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
prometheus-package-archive-install-{{ i }}-alternative-set: | ||
alternatives.set: | ||
- name: link-{{ i }} | ||
- path: {{ prometheus.base_dir }}/{{ i }} | ||
- require: | ||
- alternatives: prometheus-package-archive-install-{{ i }}-alternative-install | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
{% 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
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 |
---|---|---|
@@ -1,70 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import golang with context %} | ||
{%- set sls_archive_install = tplroot ~ '.archive.install' %} | ||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} | ||
{%- if grains.kernel|lower == 'linux' and golang.linux.altpriority|int > 0 %} | ||
include: | ||
- {{ sls_archive_install }} | ||
golang-package-archive-install-home-alternative-install: | ||
cmd.run: | ||
- name: update-alternatives --install {{ golang.go_root }} golang-home {{ golang.base_dir }}/go {{ golang.linux.altpriority }} | ||
- watch: | ||
- archive: golang-package-archive-install-archive-extracted | ||
- require: | ||
- sls: {{ sls_archive_install }} | ||
- onlyif: {{ grains.os_family in ('Suse',) }} | ||
alternatives.install: | ||
- name: golang-home | ||
- link: {{ golang.go_root }} | ||
- path: {{ golang.base_dir }}/go | ||
- priority: {{ golang.linux.altpriority }} | ||
- order: 10 | ||
- watch: | ||
- archive: golang-package-archive-install-archive-extracted | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
- require: | ||
- sls: {{ sls_archive_install }} | ||
golang-package-archive-install-home-alternative-set: | ||
alternatives.set: | ||
- name: golang-home | ||
- path: {{ golang.base_dir }}/go | ||
- require: | ||
- alternatives: golang-package-archive-install-home-alternative-install | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
{% for i in ['go', 'godoc', 'gofmt'] %} | ||
golang-package-archive-install-{{ i }}-alternative-install: | ||
cmd.run: | ||
- name: update-alternatives --install /usr/bin/{{i}} link-{{i}} {{ golang.base_dir }}/go/bin/{{i}} {{golang.linux.altpriority}} | ||
- require: | ||
- cmd: golang-package-archive-install-home-alternative-install | ||
- onlyif: {{ grains.os_family in ('Suse',) }} | ||
alternatives.install: | ||
- name: link-{{ i }} | ||
- link: /usr/bin/{{ i }} | ||
- path: {{ golang.base_dir }}/go/bin/{{ i }} | ||
- priority: {{ golang.linux.altpriority }} | ||
- order: 10 | ||
- require: | ||
- alternatives: golang-package-archive-install-home-alternative-install | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
golang-package-archive-install-{{ i }}-alternative-set: | ||
alternatives.set: | ||
- name: link-{{ i }} | ||
- path: {{ golang.base_dir }}/go/bin/{{ i }} | ||
- require: | ||
- alternatives: golang-package-archive-install-{{ i }}-alternative-install | ||
- unless: {{ grains.os_family in ('Suse',) }} | ||
{% endfor %} | ||
{%- endif %} | ||
- .args | ||
- .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
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
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
Oops, something went wrong.