Merge pull request #381 from acatton/cleanup-default-parameters
Types default values handeling cleanup
This commit is contained in:
commit
057f4c1be7
30 changed files with 31 additions and 84 deletions
|
@ -27,11 +27,9 @@ if [ -f "$__object/parameter/distribution" ]; then
|
|||
else
|
||||
distribution="$(cat "$__global/explorer/lsb_codename")"
|
||||
fi
|
||||
if [ -f "$__object/parameter/component" ]; then
|
||||
|
||||
component="$(cat "$__object/parameter/component")"
|
||||
else
|
||||
component=""
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/arch" ]; then
|
||||
forcedarch="[arch=$(cat "$__object/parameter/arch")]"
|
||||
else
|
||||
|
|
0
cdist/conf/type/__apt_source/parameter/default/component
Normal file
0
cdist/conf/type/__apt_source/parameter/default/component
Normal file
|
@ -19,19 +19,11 @@
|
|||
#
|
||||
|
||||
# The marker file is established in the docs, but it isn't obligatory.
|
||||
if [ -f "$__object/parameter/destination" ]; then
|
||||
destination="$(cat "$__object/parameter/destination")"
|
||||
else
|
||||
destination='/etc/cdist-configured'
|
||||
fi
|
||||
|
||||
# The basic output of date is usually good enough, but variety is the
|
||||
# spice of life...
|
||||
if [ -f "$__object/parameter/format" ]; then
|
||||
format="$(cat "$__object/parameter/format")"
|
||||
else
|
||||
format='-u'
|
||||
fi
|
||||
|
||||
# Dump the timestamp in UTC to the marker
|
||||
echo "date $format > $destination"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/etc/cdist-configured
|
1
cdist/conf/type/__cdistmarker/parameter/default/format
Normal file
1
cdist/conf/type/__cdistmarker/parameter/default/format
Normal file
|
@ -0,0 +1 @@
|
|||
-u
|
|
@ -45,7 +45,6 @@ if [ -f "$__object/parameter/user" ]; then
|
|||
EOF
|
||||
EOFF
|
||||
else
|
||||
password=""
|
||||
cat <<-EOFF
|
||||
mysql -u root <<-EOF
|
||||
GRANT ALL PRIVILEGES ON $database.* to '$user'@'localhost';
|
||||
|
|
|
@ -27,11 +27,7 @@ else
|
|||
name="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state_should="present"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/target-release" ]; then
|
||||
target_release="--target-release $(cat "$__object/parameter/target-release")"
|
||||
|
|
1
cdist/conf/type/__package_apt/parameter/default/state
Normal file
1
cdist/conf/type/__package_apt/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -29,11 +29,7 @@ else
|
|||
name="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state_should="present"
|
||||
fi
|
||||
|
||||
if grep -q "(installed)" "$__object/explorer/pkg_status"; then
|
||||
state_is="present"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -28,11 +28,7 @@ else
|
|||
name="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state_should="present"
|
||||
fi
|
||||
|
||||
state_is="$(cat "$__object/explorer/pkg_status")"
|
||||
case "$state_is" in
|
||||
|
|
1
cdist/conf/type/__package_opkg/parameter/default/state
Normal file
1
cdist/conf/type/__package_opkg/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -31,11 +31,7 @@ else
|
|||
name="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state_should="present"
|
||||
fi
|
||||
|
||||
pkg_version="$(cat "$__object/explorer/pkg_version")"
|
||||
if [ -z "$pkg_version" ]; then
|
||||
|
|
1
cdist/conf/type/__package_pacman/parameter/default/state
Normal file
1
cdist/conf/type/__package_pacman/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -22,11 +22,7 @@
|
|||
#
|
||||
|
||||
state_is=$(cat "$__object/explorer/state")
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state_should="present"
|
||||
fi
|
||||
|
||||
[ "$state_is" = "$state_should" ] && exit 0
|
||||
|
||||
|
|
1
cdist/conf/type/__package_pip/parameter/default/state
Normal file
1
cdist/conf/type/__package_pip/parameter/default/state
Normal file
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -51,23 +51,10 @@ else
|
|||
name="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/flavor" ]; then
|
||||
flavor="$(cat "$__object/parameter/flavor")"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/version" ]; then
|
||||
version="$(cat "$__object/parameter/version")"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/pkgsite" ]; then
|
||||
pkgsite="$(cat "$__object/parameter/pkgsite")"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state="present"
|
||||
fi
|
||||
curr_version="$(cat "$__object/explorer/pkg_version")"
|
||||
add_cmd="pkg_add"
|
||||
rm_cmd="pkg_delete"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -42,11 +42,7 @@ else
|
|||
name="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state_should="present"
|
||||
fi
|
||||
|
||||
pkg_version="$(cat "$__object/explorer/pkg_version")"
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -31,13 +31,8 @@ else
|
|||
name="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/flavor" ]; then
|
||||
flavor="$(cat "$__object/parameter/flavor")"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/version" ]; then
|
||||
version="$(cat "$__object/parameter/version")"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/upgrade" ]; then
|
||||
upgrade="true"
|
||||
|
@ -45,15 +40,8 @@ else
|
|||
upgrade="false"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/repo" ]; then
|
||||
repo="$(cat "$__object/parameter/repo")"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state="present"
|
||||
fi
|
||||
curr_version="$(cat "$__object/explorer/pkg_version")"
|
||||
add_cmd="pkg install -y"
|
||||
rm_cmd="pkg delete -y"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
present
|
|
@ -27,11 +27,7 @@ else
|
|||
name="$__object_id"
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/state" ]; then
|
||||
state_should="$(cat "$__object/parameter/state")"
|
||||
else
|
||||
state_should="present"
|
||||
fi
|
||||
|
||||
if grep -q true "$__object/explorer/pkg_status"; then
|
||||
state_is="present"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
present
|
Loading…
Reference in a new issue