Fixed prd869 (hard coded 10.20.0.0 for admin network)

This commit is contained in:
Vladimir Kozhukalov 2013-06-02 18:29:37 +04:00 committed by default
parent d11b2bdac4
commit e240998fb7
6 changed files with 27 additions and 10 deletions

View File

@ -5,9 +5,9 @@
"fields": {
"name": "fuelweb_admin",
"access": "admin",
"cidr": "10.20.0.0/24",
"netmask": "255.255.255.0",
"network_size": "256",
"cidr": "{{settings.ADMIN_NETWORK['cidr']}}",
"netmask": "{{settings.ADMIN_NETWORK['netmask']}}",
"network_size": "{{settings.ADMIN_NETWORK['size']}}",
"vlan_start": "1"
}
},
@ -25,7 +25,7 @@
"name": "fuelweb_admin",
"access": "admin",
"network_group": 1,
"cidr": "10.20.0.0/24",
"cidr": "{{settings.ADMIN_NETWORK['cidr']}}",
"vlan_id": 1
}
},
@ -34,8 +34,8 @@
"model": "nailgun.i_p_addr_range",
"fields": {
"network_group": 1,
"first": "10.20.0.128",
"last": "10.20.0.254"
"first": "{{settings.ADMIN_NETWORK['first']}}",
"last": "{{settings.ADMIN_NETWORK['last']}}"
}
}
]

View File

@ -6,6 +6,8 @@ import Queue
import os.path
import itertools
from datetime import datetime
import jinja2
import StringIO
import sqlalchemy.types
from nailgun.settings import settings
@ -139,6 +141,13 @@ def upload_fixture(fileobj):
db.commit()
def template_fixture(fileobj, config=None):
if not config:
config = settings
t = jinja2.Template(fileobj.read())
return StringIO.StringIO(t.render(settings=config))
def upload_fixtures():
fns = []
for path in settings.FIXTURES_TO_UPLOAD:
@ -149,7 +158,7 @@ def upload_fixtures():
for fn in fns:
with open(fn, "r") as fileobj:
upload_fixture(fileobj)
upload_fixture(template_fixture(fileobj))
logger.info("Fixture has been uploaded from file: %s" % fn)

View File

@ -39,9 +39,11 @@ NET_EXCLUDE:
- "10.20.0.0/24"
ADMIN_NETWORK:
first: "10.20.0.128"
last: "10.20.0.254"
cidr: "10.20.0.0/24"
netmask: "255.255.255.0"
size: "256"
first: "10.20.0.129"
last: "10.20.0.254"
VLANS_RANGE_START: "100"
VLANS_RANGE_END: "1000"

View File

@ -66,6 +66,9 @@ class nailgun::venv(
$exclude_network = ipcalc_network_by_address_netmask($ipaddress, $netmask)
$exclude_cidr = ipcalc_network_cidr_by_netmask($netmask)
$admin_network = ipcalc_network_by_address_netmask($ipaddress, $netmask)
$admin_network_cidr = ipcalc_network_cidr_by_netmask($netmask)
$admin_network_size = ipcalc_network_count_addresses($ipaddress, $netmask)
$first_in_second_half = ipcalc_network_count_addresses($ipaddress, $netmask) / 2 + 1
$admin_network_first = ipcalc_network_nth_address($ipaddress, $netmask, $first_in_second_half)
$admin_network_last = ipcalc_network_nth_address($ipaddress, $netmask, "last")

View File

@ -26,9 +26,11 @@ NET_EXCLUDE:
- "<%= @exclude_network %>/<%= @exclude_cidr %>"
ADMIN_NETWORK:
cidr: "<%= @admin_network %>/<%= @admin_network_cidr %>"
netmask: "<%= @admin_network_netmask %>"
size: "<%= @admin_network_size %>"
first: "<%= @admin_network_first %>"
last: "<%= @admin_network_last %>"
netmask: "<%= @admin_network_netmask %>"
VLANS_RANGE_START: "100"
VLANS_RANGE_END: "1000"

View File

@ -1,3 +1,4 @@
Jinja2==2.7
Paste==1.7.5.1
PyYAML==3.10
SQLAlchemy==0.7.8