pullapply: learn PPG_NOTLAZY to disable lazyness
[puppet-git.git] / ppg-functions
blob56d1fb126823413ceb4d1c27615c6d2939080682
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}"