forked from ungleich-public/cdist
switch the __rvm type to the new present/absent state scheme
This commit is contained in:
parent
196fb7e656
commit
5c70018411
15 changed files with 41 additions and 41 deletions
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
user="$__object_id"
|
user="$__object_id"
|
||||||
if su - $user -c "[ -d \"\$HOME/.rvm\" ]" ; then
|
if su - $user -c "[ -d \"\$HOME/.rvm\" ]" ; then
|
||||||
echo "installed"
|
echo "present"
|
||||||
else
|
else
|
||||||
echo "removed"
|
echo "absent"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -23,12 +23,12 @@ state_is="$(cat "$__object/explorer/state")"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
if [ "$state_is" != "$state_should" ]; then
|
if [ "$state_is" != "$state_should" ]; then
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
installed)
|
present)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - $user -c "curl -L get.rvm.io | bash -s stable"
|
su - $user -c "curl -L get.rvm.io | bash -s stable"
|
||||||
DONE
|
DONE
|
||||||
;;
|
;;
|
||||||
removed)
|
absent)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - $user -c "rm -Rf \"\\\$HOME/.rvm\";
|
su - $user -c "rm -Rf \"\\\$HOME/.rvm\";
|
||||||
sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" > \"\\\$HOME/.bashrc.cdist-tmp\"
|
sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" > \"\\\$HOME/.bashrc.cdist-tmp\"
|
||||||
|
|
|
@ -16,7 +16,7 @@ RVM is the Ruby enVironment Manager for the Ruby programming language.
|
||||||
REQUIRED PARAMETERS
|
REQUIRED PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
state::
|
state::
|
||||||
Either "installed" or "removed".
|
Either "present" or "absent".
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
|
@ -24,10 +24,10 @@ EXAMPLES
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
# Install rvm for user billie
|
# Install rvm for user billie
|
||||||
__rvm billie --state installed
|
__rvm billie --state present
|
||||||
|
|
||||||
# Remove rvm
|
# Remove rvm
|
||||||
__rvm billie --state removed
|
__rvm billie --state absent
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
||||||
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
|
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
|
||||||
user="$(cat "$__object/parameter/user")"
|
user="$(cat "$__object/parameter/user")"
|
||||||
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||||
echo "removed"
|
echo "absent"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
|
@ -32,8 +32,8 @@ rvm list | grep -q $ruby"; then
|
||||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname &&
|
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname &&
|
||||||
rvm use $gemset > /dev/null && gem list | grep -q $gem"; then
|
rvm use $gemset > /dev/null && gem list | grep -q $gem"; then
|
||||||
echo "installed"
|
echo "present"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "removed"
|
echo "absent"
|
||||||
|
|
|
@ -27,13 +27,13 @@ user="$(cat "$__object/parameter/user")"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
if [ "$state_is" != "$state_should" ]; then
|
if [ "$state_is" != "$state_should" ]; then
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
installed)
|
present)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm use $gemset; gem install $gem"
|
rvm use $gemset; gem install $gem"
|
||||||
DONE
|
DONE
|
||||||
;;
|
;;
|
||||||
removed)
|
absent)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm use $gemset; gem uninstall $gem"
|
rvm use $gemset; gem uninstall $gem"
|
||||||
|
|
|
@ -20,7 +20,7 @@ user::
|
||||||
gemset::
|
gemset::
|
||||||
The gemset to use
|
The gemset to use
|
||||||
state::
|
state::
|
||||||
Either "installed" or "removed".
|
Either "present" or "absent".
|
||||||
|
|
||||||
OPTIONAL PARAMETERS
|
OPTIONAL PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -32,14 +32,14 @@ EXAMPLES
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
# Install the rails gem in gemset ruby-1.9.3-p0@myset for user bill
|
# Install the rails gem in gemset ruby-1.9.3-p0@myset for user bill
|
||||||
__rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill --state installed
|
__rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill --state present
|
||||||
|
|
||||||
# Do the same and also make ruby-1.9.3-p0@myset the default gemset
|
# Do the same and also make ruby-1.9.3-p0@myset the default gemset
|
||||||
__rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill \
|
__rvm_gemset rails --gemset ruby-1.9.3-p0@myset --user bill \
|
||||||
--state installed --default yes
|
--state present --default yes
|
||||||
|
|
||||||
# Remove it
|
# Remove it
|
||||||
__rvm_ruby rails --gemset ruby-1.9.3-p0@myset --user bill --state removed
|
__rvm_ruby rails --gemset ruby-1.9.3-p0@myset --user bill --state absent
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ else
|
||||||
echo $default > "$__object/parameter/default"
|
echo $default > "$__object/parameter/default"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
__rvm "$user" --state installed
|
__rvm "$user" --state present
|
||||||
require="__rvm/$user" \
|
require="__rvm/$user" \
|
||||||
__rvm_ruby $ruby --user "$user" --state installed --default $default
|
__rvm_ruby $ruby --user "$user" --state present --default $default
|
||||||
require="__rvm_ruby/$ruby" \
|
require="__rvm_ruby/$ruby" \
|
||||||
__rvm_gemset $gemset --user "$user" --state installed --default $default
|
__rvm_gemset $gemset --user "$user" --state present --default $default
|
||||||
|
|
|
@ -23,15 +23,15 @@ ruby="$(echo "$gemset" | cut -d '@' -f 1)"
|
||||||
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
|
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
|
||||||
user="$(cat "$__object/parameter/user")"
|
user="$(cat "$__object/parameter/user")"
|
||||||
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||||
echo "removed"
|
echo "absent"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm list | grep -q $ruby"; then
|
rvm list | grep -q $ruby"; then
|
||||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname"; then
|
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname"; then
|
||||||
echo "installed"
|
echo "present"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "removed"
|
echo "absent"
|
||||||
|
|
|
@ -27,7 +27,7 @@ default="$(cat "$__object/parameter/default")"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
if [ "$state_is" != "$state_should" ]; then
|
if [ "$state_is" != "$state_should" ]; then
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
installed)
|
present)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm $gemset --create"
|
rvm $gemset --create"
|
||||||
|
@ -43,7 +43,7 @@ DONE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
removed)
|
absent)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm use $ruby; rvm --force gemset delete $gemsetname"
|
rvm use $ruby; rvm --force gemset delete $gemsetname"
|
||||||
|
|
|
@ -18,7 +18,7 @@ REQUIRED PARAMETERS
|
||||||
user::
|
user::
|
||||||
The remote user account to use
|
The remote user account to use
|
||||||
state::
|
state::
|
||||||
Either "installed" or "removed".
|
Either "present" or "absent".
|
||||||
|
|
||||||
OPTIONAL PARAMETERS
|
OPTIONAL PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -30,13 +30,13 @@ EXAMPLES
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
# Install the gemset @myset for user charles on based on ruby-1.9.3-0
|
# Install the gemset @myset for user charles on based on ruby-1.9.3-0
|
||||||
__rvm_gemset ruby-1.9.3-p0@myset --user charles --state installed
|
__rvm_gemset ruby-1.9.3-p0@myset --user charles --state present
|
||||||
|
|
||||||
# Do the same and make ruby-1.9.3-p0@myset the default gemset
|
# Do the same and make ruby-1.9.3-p0@myset the default gemset
|
||||||
__rvm_gemset ruby-1.9.3-p0@myset --user charles --state installed --default yes
|
__rvm_gemset ruby-1.9.3-p0@myset --user charles --state present --default yes
|
||||||
|
|
||||||
# Remove the gemset @myset for user john
|
# Remove the gemset @myset for user john
|
||||||
__rvm_ruby ruby-1.9.3-p0@myset --user john --state removed
|
__rvm_ruby ruby-1.9.3-p0@myset --user john --state absent
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ else
|
||||||
echo $default > "$__object/parameter/default"
|
echo $default > "$__object/parameter/default"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
__rvm "$user" --state installed
|
__rvm "$user" --state present
|
||||||
require="__rvm/$user" \
|
require="__rvm/$user" \
|
||||||
__rvm_ruby $ruby --user "$user" --state installed --default $default
|
__rvm_ruby $ruby --user "$user" --state present --default $default
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
ruby="$__object_id"
|
ruby="$__object_id"
|
||||||
user="$(cat "$__object/parameter/user")"
|
user="$(cat "$__object/parameter/user")"
|
||||||
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
|
||||||
echo "removed"
|
echo "absent"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
|
||||||
rvm list | grep -q $ruby"; then
|
rvm list | grep -q $ruby"; then
|
||||||
echo "installed"
|
echo "present"
|
||||||
else
|
else
|
||||||
echo "removed"
|
echo "absent"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -25,7 +25,7 @@ default="$(cat "$__object/parameter/default")"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
if [ "$state_is" != "$state_should" ]; then
|
if [ "$state_is" != "$state_should" ]; then
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
installed)
|
present)
|
||||||
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||||
"rvm install $ruby\""
|
"rvm install $ruby\""
|
||||||
case "$default" in
|
case "$default" in
|
||||||
|
@ -37,7 +37,7 @@ if [ "$state_is" != "$state_should" ]; then
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
removed)
|
absent)
|
||||||
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
|
||||||
"rvm remove $ruby\""
|
"rvm remove $ruby\""
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -18,7 +18,7 @@ REQUIRED PARAMETERS
|
||||||
user::
|
user::
|
||||||
The remote user account to use
|
The remote user account to use
|
||||||
state::
|
state::
|
||||||
Either "installed" or "removed".
|
Either "present" or "absent".
|
||||||
|
|
||||||
OPTIONAL PARAMETERS
|
OPTIONAL PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -30,13 +30,13 @@ EXAMPLES
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
# Install ruby 1.9.3 through rvm for user thelonious
|
# Install ruby 1.9.3 through rvm for user thelonious
|
||||||
__rvm_ruby ruby-1.9.3-p0 --user thelonious --state installed
|
__rvm_ruby ruby-1.9.3-p0 --user thelonious --state present
|
||||||
|
|
||||||
# Install ruby 1.9.3 through rvm for user ornette and make it the default
|
# Install ruby 1.9.3 through rvm for user ornette and make it the default
|
||||||
__rvm_ruby ruby-1.9.3-p0 --user ornette --state installed --default yes
|
__rvm_ruby ruby-1.9.3-p0 --user ornette --state present --default yes
|
||||||
|
|
||||||
# Remove ruby 1.9.3 for user john
|
# Remove ruby 1.9.3 for user john
|
||||||
__rvm_ruby ruby-1.9.3-p0 --user john --state removed
|
__rvm_ruby ruby-1.9.3-p0 --user john --state absent
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,6 @@ case "$ruby" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
deps=$(eval echo \$$deps_list)
|
deps=$(eval echo \$$deps_list)
|
||||||
for p in $deps; do __package_${type} $p --state installed; done
|
for p in $deps; do __package_${type} $p --state present; done
|
||||||
|
|
||||||
__rvm "$user" --state installed
|
__rvm "$user" --state present
|
||||||
|
|
Loading…
Reference in a new issue