Skip to content

Commit

Permalink
Like voxpupuli#46, fix puppet/facter voxpupuli#45, but w/rpm
Browse files Browse the repository at this point in the history
instead of yum and dpkg-query instead of `dpkg|awk`.
  • Loading branch information
wcooley committed Apr 30, 2015
1 parent d6d56de commit 5520b31
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions files/rundeck_version
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Ask puppet what version of rundeck is installed.
# Will return the version or if not available: "absent".
puppet resource package rundeck | grep ensure | awk '{print $NF}' | sed "s/'//g;s/,//g"
#!/bin/bash

# dpkg-query will print "no packages found matching rundeck" on stderr if not installed, so
# all that needs to be done is redirect stderr
if $(command -v dpkg-query >/dev/null); then
dpkg-query -W -f 'rundeck_version=${Version}\n' rundeck 2>/dev/null
fi

# rpm will produce "package rundeck is not installed" on stdout if not installed, so you must
# either silently check for existence or pipe the output to `grep -v`
if $(command -v rpm >/dev/null && rpm --quiet -q rundeck); then
rpm -q --qf 'rundeck_version=%{VERSION}\n' rundeck
fi

0 comments on commit 5520b31

Please sign in to comment.