Skip to content
Snippets Groups Projects
Commit ee6079ed authored by Michael Loipführer's avatar Michael Loipführer
Browse files

fix string int shenaninganery

parent 672244cf
No related branches found
No related tags found
No related merge requests found
...@@ -93,25 +93,25 @@ def next_ip_address(config_file, name): ...@@ -93,25 +93,25 @@ def next_ip_address(config_file, name):
continue continue
ip_h = container.get('ip_address_host').split('/')[0].split('.') ip_h = container.get('ip_address_host').split('/')[0].split('.')
ip_c = container.get('ip_address_container').split('/')[0].split('.') ip_c = container.get('ip_address_container').split('/')[0].split('.')
if ip_h[2] > ip_host[2]: if int(ip_h[2]) > ip_host[2]:
ip_host = ip_h ip_host = int(ip_h)
ip_host[3] += 1 ip_host[3] += 1
elif ip_h[2] == ip_host[2] and ip_h[3] > ip_host[3]: elif int(ip_h[2]) == ip_host[2] and int(ip_h[3]) > ip_host[3]:
if ip_h[3] == 254: if int(ip_h[3]) == 254:
ip_host[2] += 1 ip_host[2] += 1
ip_host[3] = 1 ip_host[3] = 1
else: else:
ip_host[3] = ip_h[3] + 1 ip_host[3] = int(ip_h[3]) + 1
if ip_c[2] > ip_container[2]: if int(ip_c[2]) > ip_container[2]:
ip_container = ip_c ip_container = int(ip_c)
ip_container[3] += 1 ip_container[3] += 1
elif ip_c[2] == ip_container[2] and ip_c[3] > ip_container[3]: elif int(ip_c[2]) == ip_container[2] and int(ip_c[3]) > ip_container[3]:
if ip_c[3] == 254: if int(ip_c[3]) == 254:
ip_container[2] += 1 ip_container[2] += 1
ip_container[3] = 1 ip_container[3] = 1
else: else:
ip_container[3] = ip_c[3] + 1 ip_container[3] = int(ip_c[3]) + 1
return ('.'.join(str(x) for x in ip_host), '.'.join(str(x) for x in ip_container)) return ('.'.join(str(x) for x in ip_host), '.'.join(str(x) for x in ip_container))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment