From 787f5237e5f3c274c94d7b647f874df14c9ccc71 Mon Sep 17 00:00:00 2001 From: Kamila Souckova Date: Sun, 11 Mar 2018 10:55:21 +0100 Subject: [PATCH] __prometheus_{server,alertmanager}: use os_version instead of lsb_release works without the `lsb-release` package and actually seems to be more reliable, even though it is inconsistent between debian and devuan --- .../conf/type/__prometheus_alertmanager/manifest | 16 ++++++---------- cdist/conf/type/__prometheus_server/manifest | 16 ++++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/cdist/conf/type/__prometheus_alertmanager/manifest b/cdist/conf/type/__prometheus_alertmanager/manifest index 8278170a..87546f47 100755 --- a/cdist/conf/type/__prometheus_alertmanager/manifest +++ b/cdist/conf/type/__prometheus_alertmanager/manifest @@ -17,22 +17,18 @@ storage_path="$(cat "$__object/parameter/storage-path")" require_pkg="" # what to require if I want to require "the package" if [ -f "$__object/parameter/install-from-backports" ]; then os=$(cat "$__global/explorer/os") - lsb_codename=$(cat "$__global/explorer/lsb_codename") + os_version=$(cat "$__global/explorer/os_version") case $os in devuan) - if [ -z "$lsb_codename" ]; then - echo "Command `lsb_release` not functional -- is package `lsb-release` installed?" >&2 - exit 1 - fi - [ "$lsb_codename" = "n/a" ] && lsb_codename='ascii' # TODO this is a devuan bug that should be fixed soon => remove when no longer needed - __apt_source backports --uri http://auto.mirror.devuan.org/merged --distribution $lsb_codename-backports --component main - require="$require __apt_source/backports" __package_apt prometheus-alertmanager --target-release $lsb_codename-backports + [ "$os_version" = "ascii/ceres" ] && os_version='ascii' # "ascii" used in the repo URLs + __apt_source backports --uri http://auto.mirror.devuan.org/merged --distribution $os_version-backports --component main + require="$require __apt_source/backports" __package_apt prometheus-alertmanager --target-release $os_version-backports require_pkg="__package_apt/prometheus-alertmanager" ;; *) - echo "--install-from-backports is only supported on Devuan -- ignoring" >&2 - echo "send a pull request if you require it" >&2 + echo "--install-from-backports is only supported on Devuan -- ignoring." >&2 + echo "Send a pull request if you require it." >&2 ;; esac else diff --git a/cdist/conf/type/__prometheus_server/manifest b/cdist/conf/type/__prometheus_server/manifest index a5c31b4e..a7ba7884 100755 --- a/cdist/conf/type/__prometheus_server/manifest +++ b/cdist/conf/type/__prometheus_server/manifest @@ -20,22 +20,18 @@ rule_files="$(cat "$__object/parameter/rule-files")" require_pkg="" # what to require if I want to require "the package" if [ -f "$__object/parameter/install-from-backports" ]; then os=$(cat "$__global/explorer/os") - lsb_codename=$(cat "$__global/explorer/lsb_codename") + os_version=$(cat "$__global/explorer/os_version") case $os in devuan) - if [ -z "$lsb_codename" ]; then - echo "Command `lsb_release` not functional -- is package `lsb-release` installed?" >&2 - exit 1 - fi - [ "$lsb_codename" = "n/a" ] && lsb_codename='ascii' # TODO this is a devuan bug that should be fixed soon => remove when no longer needed - __apt_source backports --uri http://auto.mirror.devuan.org/merged --distribution $lsb_codename-backports --component main - require="$require __apt_source/backports" __package_apt prometheus --target-release $lsb_codename-backports + [ "$os_version" = "ascii/ceres" ] && os_version='ascii' # "ascii" used in the repo URLs + __apt_source backports --uri http://auto.mirror.devuan.org/merged --distribution $os_version-backports --component main + require="$require __apt_source/backports" __package_apt prometheus --target-release $os_version-backports require_pkg="__package_apt/prometheus" ;; *) - echo "--install-from-backports is only supported on Devuan -- ignoring" >&2 - echo "send a pull request if you require it" >&2 + echo "--install-from-backports is only supported on Devuan -- ignoring." >&2 + echo "Send a pull request if you require it." >&2 ;; esac else