If I have a template file, that I need to get a value only when it’s changed, how do I set that up in the recipe? For example: script “get_appserverval” interpreter “bash” cwd “/tmp” code <<-EOH SERVERURL=$1 SERVERPORT=$2 USERNAME=$3 PASSWORD=$4 URL="`wget" --user-agent="Mozilla/5.0 (Windows NT 6.1; U; en; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6" --keep-session-cookies --save-cookies=mycookie ${SERVERURL}:${SERVERPORT} -O - |grep "action/Login" | awk -Faction= '{print $2}' |awk '{print $1}' |sed "s/:80/:${SERVERPORT}/g"` BASEURL=`wget --user-agent="Mozilla/5.0 (Windows NT 6.1; U; en; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6" --keep-session-cookies --load-cookies=mycookie --save-cookies=mycookie2 ${URL} --post-data="UserName=${USERNAME}\&Password=${PASSWORD}\&F_LOCALE=en_us\&submitButton=\&page=submit" -O - | grep "var gBaseActionURL" | sed 's/\r//g' | sed "s/:80/:${SERVERPORT}/g" | awk -F= '{print $2}' |sed 's/ //g' | sed 's/\"//g' | sed 's/;//g'` APPSERVERVAL=`wget --user-agent="Mozilla/5.0 (Windows NT 6.1; U; en; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6" --keep-session-cookies --load-cookies=mycookie2 --save-cookies=mycookie3 ${BASEURL}Report.Open?F_REPORTID=11 -O - | grep APPSERVERVALUE |awk -FVALUE= '{print $2}' |sed 's/>//g' | sed 's/\"//g'` echo $APPSERVERVAL EOH end So I have a few problems: Need to pass some values to the script. Need to get a value from the script, to pass to a template resource. How do I run this script only if the affected template changes, or it’s a new deploy? This is a Java WebApp. I’m using application to deploy the war file. I modified the tomcat cookbook to take a parameter for Path to tell the deployment path, and the app[id] is set as the Context name. I also modified the application cookbook to allow me to override the db setup parameters, but I would like to know if there’s a better way to do it… I’ll post a diff shortly. So right now I have a role, which has a run list of application, and appname. This code would be called in the appname recipe, which copies over the supporting template files and restarts tomcat when done (each file has a restart tomcat notification, which works fine). Should I use the apps data bag, or use a different one? Thanks. -Matt |
Archive powered by MHonArc 2.6.16.