add --url support for __package_yum

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2014-05-20 07:43:11 +02:00
parent 066d0bf15a
commit bbd451433f
3 changed files with 16 additions and 2 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2011 Nico Schottelius (nico-cdist at schottelius.org) # 2011-2014 Nico Schottelius (nico-cdist at schottelius.org)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -27,6 +27,14 @@ else
name="$__object_id" name="$__object_id"
fi fi
# Support installing from an URL
if [ -f "$__object/parameter/url" ]; then
install_name="$(cat "$__object/parameter/url")"
else
install_name="$name"
fi
state_should="$(cat "$__object/parameter/state")" state_should="$(cat "$__object/parameter/state")"
if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then
@ -47,7 +55,7 @@ fi
case "$state_should" in case "$state_should" in
present) present)
echo yum $opts install \"$name\" echo yum $opts install \"$install_name\"
;; ;;
absent) absent)
echo yum $opts remove \"$name\" echo yum $opts remove \"$name\"

View file

@ -27,6 +27,8 @@ name::
state:: state::
Either "present" or "absent", defaults to "present" Either "present" or "absent", defaults to "present"
url::
URL to use for the package
EXAMPLES EXAMPLES
@ -41,6 +43,9 @@ __package_yum python --state present --name python2
# Remove obsolete package # Remove obsolete package
__package_yum puppet --state absent __package_yum puppet --state absent
__package epel-release-6-8 \
--url http://mirror.switch.ch/ftp/mirror/epel/6/i386/epel-release-6-8.noarch.rpm
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View file

@ -1,2 +1,3 @@
name name
state state
url