Merge pull request #381 from acatton/cleanup-default-parameters

Types default values handeling cleanup
This commit is contained in:
Nico Schottelius 2015-03-19 15:44:37 +09:00
commit 057f4c1be7
30 changed files with 31 additions and 84 deletions

View file

@ -27,11 +27,9 @@ if [ -f "$__object/parameter/distribution" ]; then
else else
distribution="$(cat "$__global/explorer/lsb_codename")" distribution="$(cat "$__global/explorer/lsb_codename")"
fi fi
if [ -f "$__object/parameter/component" ]; then
component="$(cat "$__object/parameter/component")" component="$(cat "$__object/parameter/component")"
else
component=""
fi
if [ -f "$__object/parameter/arch" ]; then if [ -f "$__object/parameter/arch" ]; then
forcedarch="[arch=$(cat "$__object/parameter/arch")]" forcedarch="[arch=$(cat "$__object/parameter/arch")]"
else else

View file

@ -19,19 +19,11 @@
# #
# The marker file is established in the docs, but it isn't obligatory. # The marker file is established in the docs, but it isn't obligatory.
if [ -f "$__object/parameter/destination" ]; then destination="$(cat "$__object/parameter/destination")"
destination="$(cat "$__object/parameter/destination")"
else
destination='/etc/cdist-configured'
fi
# The basic output of date is usually good enough, but variety is the # The basic output of date is usually good enough, but variety is the
# spice of life... # spice of life...
if [ -f "$__object/parameter/format" ]; then format="$(cat "$__object/parameter/format")"
format="$(cat "$__object/parameter/format")"
else
format='-u'
fi
# Dump the timestamp in UTC to the marker # Dump the timestamp in UTC to the marker
echo "date $format > $destination" echo "date $format > $destination"

View file

@ -0,0 +1 @@
/etc/cdist-configured

View file

@ -0,0 +1 @@
-u

View file

@ -45,7 +45,6 @@ if [ -f "$__object/parameter/user" ]; then
EOF EOF
EOFF EOFF
else else
password=""
cat <<-EOFF cat <<-EOFF
mysql -u root <<-EOF mysql -u root <<-EOF
GRANT ALL PRIVILEGES ON $database.* to '$user'@'localhost'; GRANT ALL PRIVILEGES ON $database.* to '$user'@'localhost';

View file

@ -27,11 +27,7 @@ else
name="$__object_id" name="$__object_id"
fi fi
if [ -f "$__object/parameter/state" ]; then state_should="$(cat "$__object/parameter/state")"
state_should="$(cat "$__object/parameter/state")"
else
state_should="present"
fi
if [ -f "$__object/parameter/target-release" ]; then if [ -f "$__object/parameter/target-release" ]; then
target_release="--target-release $(cat "$__object/parameter/target-release")" target_release="--target-release $(cat "$__object/parameter/target-release")"

View file

@ -0,0 +1 @@
present

View file

@ -29,11 +29,7 @@ else
name="$__object_id" name="$__object_id"
fi fi
if [ -f "$__object/parameter/state" ]; then state_should="$(cat "$__object/parameter/state")"
state_should="$(cat "$__object/parameter/state")"
else
state_should="present"
fi
if grep -q "(installed)" "$__object/explorer/pkg_status"; then if grep -q "(installed)" "$__object/explorer/pkg_status"; then
state_is="present" state_is="present"

View file

@ -0,0 +1 @@
present

View file

@ -28,11 +28,7 @@ else
name="$__object_id" name="$__object_id"
fi fi
if [ -f "$__object/parameter/state" ]; then state_should="$(cat "$__object/parameter/state")"
state_should="$(cat "$__object/parameter/state")"
else
state_should="present"
fi
state_is="$(cat "$__object/explorer/pkg_status")" state_is="$(cat "$__object/explorer/pkg_status")"
case "$state_is" in case "$state_is" in

View file

@ -0,0 +1 @@
present

View file

@ -31,11 +31,7 @@ else
name="$__object_id" name="$__object_id"
fi fi
if [ -f "$__object/parameter/state" ]; then state_should="$(cat "$__object/parameter/state")"
state_should="$(cat "$__object/parameter/state")"
else
state_should="present"
fi
pkg_version="$(cat "$__object/explorer/pkg_version")" pkg_version="$(cat "$__object/explorer/pkg_version")"
if [ -z "$pkg_version" ]; then if [ -z "$pkg_version" ]; then

View file

@ -0,0 +1 @@
present

View file

@ -22,11 +22,7 @@
# #
state_is=$(cat "$__object/explorer/state") state_is=$(cat "$__object/explorer/state")
if [ -f "$__object/parameter/state" ]; then state_should="$(cat "$__object/parameter/state")"
state_should="$(cat "$__object/parameter/state")"
else
state_should="present"
fi
[ "$state_is" = "$state_should" ] && exit 0 [ "$state_is" = "$state_should" ] && exit 0

View file

@ -0,0 +1 @@
present

View file

@ -51,23 +51,10 @@ else
name="$__object_id" name="$__object_id"
fi fi
if [ -f "$__object/parameter/flavor" ]; then flavor="$(cat "$__object/parameter/flavor")"
flavor="$(cat "$__object/parameter/flavor")" version="$(cat "$__object/parameter/version")"
fi pkgsite="$(cat "$__object/parameter/pkgsite")"
state="$(cat "$__object/parameter/state")"
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")" curr_version="$(cat "$__object/explorer/pkg_version")"
add_cmd="pkg_add" add_cmd="pkg_add"
rm_cmd="pkg_delete" rm_cmd="pkg_delete"

View file

@ -0,0 +1 @@
present

View file

@ -42,11 +42,7 @@ else
name="$__object_id" name="$__object_id"
fi fi
if [ -f "$__object/parameter/state" ]; then state_should="$(cat "$__object/parameter/state")"
state_should="$(cat "$__object/parameter/state")"
else
state_should="present"
fi
pkg_version="$(cat "$__object/explorer/pkg_version")" pkg_version="$(cat "$__object/explorer/pkg_version")"

View file

@ -0,0 +1 @@
present

View file

@ -31,13 +31,8 @@ else
name="$__object_id" name="$__object_id"
fi fi
if [ -f "$__object/parameter/flavor" ]; then flavor="$(cat "$__object/parameter/flavor")"
flavor="$(cat "$__object/parameter/flavor")" version="$(cat "$__object/parameter/version")"
fi
if [ -f "$__object/parameter/version" ]; then
version="$(cat "$__object/parameter/version")"
fi
if [ -f "$__object/parameter/upgrade" ]; then if [ -f "$__object/parameter/upgrade" ]; then
upgrade="true" upgrade="true"
@ -45,15 +40,8 @@ else
upgrade="false" upgrade="false"
fi fi
if [ -f "$__object/parameter/repo" ]; then repo="$(cat "$__object/parameter/repo")"
repo="$(cat "$__object/parameter/repo")" state="$(cat "$__object/parameter/state")"
fi
if [ -f "$__object/parameter/state" ]; then
state="$(cat "$__object/parameter/state")"
else
state="present"
fi
curr_version="$(cat "$__object/explorer/pkg_version")" curr_version="$(cat "$__object/explorer/pkg_version")"
add_cmd="pkg install -y" add_cmd="pkg install -y"
rm_cmd="pkg delete -y" rm_cmd="pkg delete -y"

View file

@ -0,0 +1 @@
present

View file

@ -27,11 +27,7 @@ else
name="$__object_id" name="$__object_id"
fi fi
if [ -f "$__object/parameter/state" ]; then state_should="$(cat "$__object/parameter/state")"
state_should="$(cat "$__object/parameter/state")"
else
state_should="present"
fi
if grep -q true "$__object/explorer/pkg_status"; then if grep -q true "$__object/explorer/pkg_status"; then
state_is="present" state_is="present"

View file

@ -0,0 +1 @@
present