Commit 057f4c1b authored by Nico Schottelius's avatar Nico Schottelius

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

Types default values handeling cleanup
parents c2aa6014 a938468b
......@@ -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
component="$(cat "$__object/parameter/component")"
if [ -f "$__object/parameter/arch" ]; then
forcedarch="[arch=$(cat "$__object/parameter/arch")]"
else
......
......@@ -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
destination="$(cat "$__object/parameter/destination")"
# 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
format="$(cat "$__object/parameter/format")"
# Dump the timestamp in UTC to the marker
echo "date $format > $destination"
......@@ -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
state_should="$(cat "$__object/parameter/state")"
if [ -f "$__object/parameter/target-release" ]; then
target_release="--target-release $(cat "$__object/parameter/target-release")"
......
......@@ -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
state_should="$(cat "$__object/parameter/state")"
if grep -q "(installed)" "$__object/explorer/pkg_status"; then
state_is="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_should="$(cat "$__object/parameter/state")"
state_is="$(cat "$__object/explorer/pkg_status")"
case "$state_is" in
......
......@@ -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
state_should="$(cat "$__object/parameter/state")"
pkg_version="$(cat "$__object/explorer/pkg_version")"
if [ -z "$pkg_version" ]; then
......
......@@ -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_should="$(cat "$__object/parameter/state")"
[ "$state_is" = "$state_should" ] && exit 0
......
......@@ -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
flavor="$(cat "$__object/parameter/flavor")"
version="$(cat "$__object/parameter/version")"
pkgsite="$(cat "$__object/parameter/pkgsite")"
state="$(cat "$__object/parameter/state")"
curr_version="$(cat "$__object/explorer/pkg_version")"
add_cmd="pkg_add"
rm_cmd="pkg_delete"
......
......@@ -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
state_should="$(cat "$__object/parameter/state")"
pkg_version="$(cat "$__object/explorer/pkg_version")"
......
......@@ -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
flavor="$(cat "$__object/parameter/flavor")"
version="$(cat "$__object/parameter/version")"
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
repo="$(cat "$__object/parameter/repo")"
state="$(cat "$__object/parameter/state")"
curr_version="$(cat "$__object/explorer/pkg_version")"
add_cmd="pkg install -y"
rm_cmd="pkg delete -y"
......
......@@ -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
state_should="$(cat "$__object/parameter/state")"
if grep -q true "$__object/explorer/pkg_status"; then
state_is="present"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment