if there are two roles for one chef-client, the script couldn't assign the

roles to the node. fixed it.
This commit is contained in:
jjhua 2013-12-26 12:41:15 -05:00
parent b12771ab54
commit 921d251301

View File

@ -206,11 +206,18 @@ then
exit 1
fi
roles=`echo $roles | sed -e 's/ /,/g'`
r="";
for onerole in $roles
do
r+="role[$onerole],"
done
# assign the role for the chef node
knife node run_list add $c_fullname "role[$roles]"
knife node run_list add $c_fullname "$r"
if [ $? != 0 ]
then
errmsg="Failed to run knife node run_list add $client 'role[$roles]' on the chef-server $NODE."
errmsg="Failed to run knife node run_list add $client '$r' on the chef-server $NODE."
logger -t xcat -p local4.err $errmsg
echo $errmsg
exit 1