diff --git a/conf/type/__package_pkg_openbsd/gencode-remote b/conf/type/__package_pkg_openbsd/gencode-remote index 0cf27a93..97f3f101 100755 --- a/conf/type/__package_pkg_openbsd/gencode-remote +++ b/conf/type/__package_pkg_openbsd/gencode-remote @@ -29,7 +29,6 @@ os_version="$(cat "$__global/explorer/os_version")" machine="$(cat "$__global/explorer/machine")" - if [ -f "$__object/parameter/flavor" ]; then flavor="$(cat "$__object/parameter/flavor")" fi diff --git a/conf/type/__package_rubygem/gencode-remote b/conf/type/__package_rubygem/gencode-remote index daaba524..b48874c7 100755 --- a/conf/type/__package_rubygem/gencode-remote +++ b/conf/type/__package_rubygem/gencode-remote @@ -21,31 +21,42 @@ # Manage Rubygem packages # - if [ -f "$__object/parameter/name" ]; then - name="$(cat "$__object/parameter/name")" + name="$(cat "$__object/parameter/name")" +else + name="$__object_id" +fi + +state_should="$(cat "$__object/parameter/state")" +# Correct pre 2.1 naming - FIXME in 2.1 +case "$state_should" in + installed) + echo "WARNING: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 + state_should="present" + ;; + removed) + echo "WARNING: $state_should is deprecated and will be removed in cdist 2.1. Please change to present/absent." >&2 + state_should="absent" + ;; +esac + +if grep -q true "$__object/explorer/pkg_status"; then + state_is="present" else - name="$__object_id" + state_is="absent" fi -state="$(cat "$__object/parameter/state")" -is_installed="$(grep "true" "$__object/explorer/pkg_status" || true)" +[ "$state_is" = "$state_should ] && exit 0 -case "$state" in - installed) - # Install only if non-existent - if [ -z "$is_installed" ]; then - echo gem install \"$name\" --no-ri --no-rdoc - fi - ;; - removed) - # Remove only if existent - if [ -n "$is_installed" ]; then - echo gem uninstall \"$name\" - fi - ;; - *) - echo "Unknown state: $state" >&2 - exit 1 - ;; +case "$state_should" in + present) + echo gem install \"$name\" --no-ri --no-rdoc + ;; + absent) + echo gem uninstall \"$name\" + ;; + *) + echo "Unknown state: $state" >&2 + exit 1 + ;; esac