Merge pull request #447 from sleemburg/master

Add openvz/lxc discovery
This commit is contained in:
Nico Schottelius 2016-06-30 10:51:18 +09:00 committed by GitHub
commit 55cd9963db
24 changed files with 40 additions and 20 deletions

View file

@ -22,6 +22,17 @@
# FIXME: other system types (not linux ...) # FIXME: other system types (not linux ...)
if [ -d "/proc/vz" -a ! -d "/proc/bc" ]; then
echo openvz
exit
fi
if [ -e "/proc/1/environ" ] &&
cat "/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container='; then
echo lxc
exit
fi
if [ -r /proc/cpuinfo ]; then if [ -r /proc/cpuinfo ]; then
# this should only exist on virtual guest machines, # this should only exist on virtual guest machines,
# tested on vmware, xen, kvm # tested on vmware, xen, kvm

View file

@ -72,6 +72,11 @@ if [ -f /etc/owl-release ]; then
fi fi
### Redhat and derivatives ### Redhat and derivatives
if grep -q ^Scientific /etc/redhat-release 2>/dev/null; then
echo scientific
exit 0
fi
if grep -q ^CentOS /etc/redhat-release 2>/dev/null; then if grep -q ^CentOS /etc/redhat-release 2>/dev/null; then
echo centos echo centos
exit 0 exit 0

View file

@ -54,7 +54,7 @@ case "$($__explorer/os)" in
owl) owl)
cat /etc/owl-release cat /etc/owl-release
;; ;;
redhat|centos|mitel) redhat|centos|mitel|scientific)
cat /etc/redhat-release cat /etc/redhat-release
;; ;;
slackware) slackware)

View file

@ -23,7 +23,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
centos|redhat|ubuntu|debian|archlinux|gentoo) scientific|centos|redhat|ubuntu|debian|archlinux|gentoo)
# any linux should work # any linux should work
: :
;; ;;

View file

@ -23,7 +23,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
centos|debian|redhat|ubuntu) scientific|centos|debian|redhat|ubuntu)
# whitelist safeguard # whitelist safeguard
: :
;; ;;

View file

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
centos|redhat) scientific|centos|redhat)
# whitelist safeguard # whitelist safeguard
service_onchange='service consul-template status >/dev/null && service consul-template reload || true' \ service_onchange='service consul-template status >/dev/null && service consul-template reload || true' \
;; ;;

View file

@ -40,7 +40,7 @@ case "$os" in
exit 0 exit 0
fi fi
;; ;;
centos) scientific|centos)
if [ "$name_sysconfig" = "$name_should" -a "$name_running" = "$name_should" ]; then if [ "$name_sysconfig" = "$name_should" -a "$name_running" = "$name_should" ]; then
exit 0 exit 0
fi fi

View file

@ -38,7 +38,7 @@ case "$os" in
# handled in gencode-remote # handled in gencode-remote
: :
;; ;;
centos) scientific|centos)
__key_value sysconfig-hostname \ __key_value sysconfig-hostname \
--file /etc/sysconfig/network \ --file /etc/sysconfig/network \
--delimiter '=' \ --delimiter '=' \

View file

@ -30,7 +30,7 @@ case "$os" in
# Debian needs a seperate package # Debian needs a seperate package
__package locales --state present __package locales --state present
;; ;;
archlinux|suse|ubuntu|centos) archlinux|suse|ubuntu|scientific|centos)
: :
;; ;;
*) *)

View file

@ -30,7 +30,7 @@ else
# By default determine package manager based on operating system # By default determine package manager based on operating system
os="$(cat "$__global/explorer/os")" os="$(cat "$__global/explorer/os")"
case "$os" in case "$os" in
amazon|centos|fedora|redhat) type="yum" ;; amazon|scientific|centos|fedora|redhat) type="yum" ;;
archlinux) type="pacman" ;; archlinux) type="pacman" ;;
debian|ubuntu|devuan) type="apt" ;; debian|ubuntu|devuan) type="apt" ;;
freebsd) freebsd)

View file

@ -29,7 +29,7 @@ else
# By default determine package manager based on operating system # By default determine package manager based on operating system
os="$(cat "$__global/explorer/os")" os="$(cat "$__global/explorer/os")"
case "$os" in case "$os" in
amazon|centos|fedora|redhat) type="yum" ;; amazon|scientific|centos|fedora|redhat) type="yum" ;;
debian|ubuntu|devuan) type="apt" ;; debian|ubuntu|devuan) type="apt" ;;
archlinux) type="pacman" ;; archlinux) type="pacman" ;;
*) *)

View file

@ -30,7 +30,7 @@ else
# By default determine package manager based on operating system # By default determine package manager based on operating system
os="$(cat "$__global/explorer/os")" os="$(cat "$__global/explorer/os")"
case "$os" in case "$os" in
amazon|centos|fedora|redhat) type="yum" ;; amazon|scientific|centos|fedora|redhat) type="yum" ;;
debian|ubuntu|devuan) type="apt" ;; debian|ubuntu|devuan) type="apt" ;;
archlinux) type="pacman" ;; archlinux) type="pacman" ;;
*) *)

View file

@ -37,7 +37,7 @@ fi
state_should="$(cat "$__object/parameter/state")" state_should="$(cat "$__object/parameter/state")"
if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then if grep -q -E "(scientific|centos|redhat|amazon)" "$__global/explorer/os"; then
opts="-y --quiet" opts="-y --quiet"
else else
opts="--assumeyes --quiet" opts="--assumeyes --quiet"

View file

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
ubuntu|debian|archlinux|suse|centos|devuan) ubuntu|debian|archlinux|suse|scientific|centos|devuan)
__package postfix --state present __package postfix --state present
;; ;;
*) *)

View file

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
ubuntu|debian|archlinux|centos|devuan) ubuntu|debian|archlinux|scientific|centos|devuan)
: :
;; ;;
*) *)

View file

@ -22,7 +22,7 @@
os=$("$__explorer/os") os=$("$__explorer/os")
case "$os" in case "$os" in
ubuntu|debian|archlinux|suse|centos|devuan) ubuntu|debian|archlinux|suse|scientific|centos|devuan)
: :
;; ;;
*) *)

View file

@ -21,7 +21,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
ubuntu|debian|archlinux|suse|centos|devuan) ubuntu|debian|archlinux|suse|scientific|centos|devuan)
: :
;; ;;
*) *)

View file

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
ubuntu|debian|archlinux|centos|devuan) ubuntu|debian|archlinux|scientific|centos|devuan)
echo "postfix reload" echo "postfix reload"
;; ;;
*) *)

View file

@ -47,7 +47,7 @@ else
[ -f "/etc/init/${name}.conf" ] && state="present" [ -f "/etc/init/${name}.conf" ] && state="present"
;; ;;
amazon|centos|fedora|owl|redhat) amazon|scientific|centos|fedora|owl|redhat)
state=$(chkconfig --level "$runlevel" "$name" || echo absent) state=$(chkconfig --level "$runlevel" "$name" || echo absent)
[ "$state" ] || state="present" [ "$state" ] || state="present"
;; ;;

View file

@ -59,7 +59,7 @@ case "$state_should" in
echo rc-update add \"$name\" \"$target_runlevel\" echo rc-update add \"$name\" \"$target_runlevel\"
;; ;;
amazon|centos|fedora|owl|redhat|suse) amazon|scientific|centos|fedora|owl|redhat|suse)
echo chkconfig \"$name\" on echo chkconfig \"$name\" on
;; ;;

View file

@ -38,7 +38,7 @@ case "$os" in
# whitelist # whitelist
: :
;; ;;
centos) scientific|centos)
__package tzdata --state present __package tzdata --state present
export require="__package/tzdata" export require="__package/tzdata"
__file /etc/sysconfig/clock \ __file /etc/sysconfig/clock \

View file

@ -22,7 +22,7 @@ os=$(cat "$__global/explorer/os")
state="$(cat "$__object/parameter/state")" state="$(cat "$__object/parameter/state")"
case "$os" in case "$os" in
centos) scientific|centos)
repo_name="$__object_id" repo_name="$__object_id"
export repo_name export repo_name
repo_file="/etc/yum.repos.d/${repo_name}.repo" repo_file="/etc/yum.repos.d/${repo_name}.repo"

View file

@ -10,6 +10,9 @@ next:
* New type: __jail_freebsd9: Handle jail management on FreeBSD <= 9.X (Jake Guffey) * New type: __jail_freebsd9: Handle jail management on FreeBSD <= 9.X (Jake Guffey)
* New type: __jail_freebsd10: Handle jail management on FreeBSD >= 10.0 (Jake Guffey) * New type: __jail_freebsd10: Handle jail management on FreeBSD >= 10.0 (Jake Guffey)
* Type __jail: Dynamically select the correct jail subtype based on target host OS (Jake Guffey) * Type __jail: Dynamically select the correct jail subtype based on target host OS (Jake Guffey)
* Explorer __machine_type: add openvz and lxc
* Explorer __os __os_version: add scientific
* Type various: add scientific
4.1.0: 2016-05-27 4.1.0: 2016-05-27
* Documentation: Migrate to reStructuredText format and sphinx (Darko Poljak) * Documentation: Migrate to reStructuredText format and sphinx (Darko Poljak)

View file

@ -5,6 +5,7 @@ cdist was tested or is know to run on at least
* [Archlinux](http://www.archlinux.org/) * [Archlinux](http://www.archlinux.org/)
* [Debian](http://www.debian.org/) * [Debian](http://www.debian.org/)
* [CentOS](http://www.centos.org/) * [CentOS](http://www.centos.org/)
* [Scientific](https://www.scientificlinux.org/)
* [Fedora](http://fedoraproject.org/) * [Fedora](http://fedoraproject.org/)
* [FreeBSD](http://www.freebsd.org) * [FreeBSD](http://www.freebsd.org)
* [Gentoo](http://www.gentoo.org/) * [Gentoo](http://www.gentoo.org/)