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
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

View 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
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"

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
EOFF
else
password=""
cat <<-EOFF
mysql -u root <<-EOF
GRANT ALL PRIVILEGES ON $database.* to '$user'@'localhost';

View file

@ -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")"

View file

@ -0,0 +1 @@
present

View file

@ -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"

View file

@ -0,0 +1 @@
present

View file

@ -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

View file

@ -0,0 +1 @@
present

View file

@ -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

View file

@ -0,0 +1 @@
present

View file

@ -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

View file

@ -0,0 +1 @@
present

View file

@ -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"

View file

@ -0,0 +1 @@
present

View file

@ -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")"

View file

@ -0,0 +1 @@
present

View file

@ -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"

View file

@ -0,0 +1 @@
present

View file

@ -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"

View file

@ -0,0 +1 @@
present