Bug fix for ctl.conf generator.

Ticket: #5244

Before this change only the first portal ip was getting
listed in the config file.