On Wed, Mar 30, 2016 at 5:33 PM, Barak Korren <bkorren(a)redhat.com> wrote:
>
>
> Keeping the IP fixed should be an option, not mandatory.
> The reason I need it is that I have an input file that needs the IP
addresses of the hosts I'm running.
> Theoretically it should have supported host names, practically, it
doesn't seem to work well with it :(
> Y.
>
Maybe we can live-generate the file from the lago status output?
Indeed...
<ugly-hack-not-tested-yet>
with open('../robo.conf.in') as f:
robo_conf_in = f.read()
replacements = {
'@HOST0@':
prefix.virt_env.get_vm(_get_prefixed_name('host0').ip(),
'@HOST1@':
prefix.virt_env.get_vm(_get_prefixed_name('host1').ip(),
'@HOST2@':
prefix.virt_env.get_vm(_get_prefixed_name('host2').ip(),
}
for k, v in replacements.items():
robo_conf_out = robo_conf_in.replace(k, v, 1)
with open('../robo.conf', 'w') as out:
out.write(robo_conf_out)
out.close()
</ugly-hack-not-tested-yet>