Force a non-lazy run if global.ini has changed
[puppet-git.git] / ppg-functions
blob204c79dbcdb99a51b0945d8201f2fae8790da327
1 # functions 
3 hostnametoint() {
4     # read the md5 as a sequence of unsigned ints
5     ints=$( echo -n $(xhostname) | openssl dgst -md5 -binary | od -d -N32 -w32 | head -n1 | cut -f2- -d' ')
7     sum=0
8     for val in $ints; do
9         sum=$(( $sum + $val ))
10     done
11     echo $sum
14 xhostname() {
15         if [ -x /usr/bin/facter ]; then
16                 hostname=$(/usr/bin/facter fqdn)
17         fi
18         if [ -z "$hostname" ]; then
19                 hostname=$(/bin/hostname --fqdn)
20         fi
21         echo "${hostname}"
24 ppg_lastgood_cleanup() {
25         # this cleanup is needed in the ppg v0.20->v0.21
26         # upgrade path. overhead is trivially minimal so
27         # we can carry it for a while...
28         #
29         # verify against the "full" name with the doubled-up
30         # refs/heads; that's the want we need to cleanup...
31         if git rev-parse --verify --quiet refs/heads/refs/heads/ppg/lastgood 1>/dev/null ; then
32                 # use branch mv/rename to preserve reflog
33                 # oddly enough, the rename fails when using the "full"
34                 # refname, so we use the short refname instead
35                 git branch -m refs/heads/ppg/lastgood ppg/lastgood
36         fi