Confusion with Template Syntax in Webinar

In the first part of the Chef fundamentals webinar it shows an example of template use with HAProxy. The template uses the following text:

<% @pool_members.each do |member| -%>
server <% member[:hostname] %> <%= member[:ipaddress] %>:> weight 1 maxconn 1 check
<% end -%>

I am having difficulty understand what the :> operator does in this code. I can’t find any mention in Eruby, ERB, Chef, or Ruby documentation. Is this a typo? Does it have meaning?


the :> is out of any <% %> block, so it will be rendered as is. I assume it’s a typo and the line should be:

server <% member[:hostname] %>:<%= member[:ipaddress] %> weight 1 maxconn 1 check

The : moved between hostname and port and the > removed.

That’s actually hostname then the IP address, not port. I still agree that it is a typo though, but I don’t have enough knowledge with templates to test the output. I keep getting odd errors with chef-apply.

I am going to review more Eruby documentation and see if I can sort this out further.

Thanks Tensibai!

aww indeed, misread the conf

I think it’s the port which is missing after the : in orignal line, so more:

server <% member[:hostname] %> <%= member[:ipaddress] %>:<%= member[:port] %> weight 1 maxconn 1 check

That makes perfect sense. I haven’t worked with HAProxy enough to notice they were missing ports.

Thanks again Tensibai!