D. Christopher Dale wrote:
I am trying to auto generate my host file for a grid deployment.
The following works well if I actually put a number in the of the for
loop. I have tried quite a few variations on this theme but cannot seem
to identify a working solution. Any ideas?
b_grid=$grid
let b_grid_size=$grid_size
let b_final_oct=$first_grid_node_final_oct
let b_grid_size=$grid_size
b_pub_sub_net=$pub_sub_net
b_priv_sub_net=$priv_sub_net
> I'm not sure I grok the "let" stuff, but if the issue is you have a
> variable stored in Cobbler as a string and you want the Python range
> function to work, that should be easy enough.
> Try something simple to cast the string back into an int and range
> should work fine.
> #set $mysize = int($mysize)
> In general, more of a Cheetah question, so you may also like to see
>
cheetahtemplate.org for other docs/info.
> --Michael
#for $cur_node in $range( $b_grid_size )
let b_vip=$b_final_oct+20
awk -v pub_sub_net="$b_pub_sub_net" -v cur_oct="$b_final_oct" -v
grid="$b_grid" -v cur_node="$cur_node" 'BEGIN {printf("%s%s
%s%02s.%s.gesi %s%02s\n", pub_sub_net, cur_oct, grid, cur_node, grid,
grid, cur_node)}' >> /etc/hosts
awk -v pub_sub_net="$b_pub_sub_net" -v grid="$b_grid" -v
vip="$b_vip"
-v cur_node="$cur_node" 'BEGIN {printf("%s%s %s%02s-vip\n",
pub_sub_net, vip, grid, cur_node)}' >> /etc/hosts
awk -v priv_sub_net="$b_priv_sub_net" -v grid="$b_grid" -v
cur_oct="$b_final_oct" -v cur_node="$cur_node" 'BEGIN
{printf("%s%s
%s%02s-priv\n", priv_sub_net, cur_oct, grid, cur_node)}' >> /etc/hosts
let b_final_oct+=1
#end for
Thanks Michael. That's a winner. let... I guess that is from scripting
past of some sort. Thanks for the