- Timestamp:
- Mar 11, 2012, 12:52:55 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r10108 r10110 44 44 except ImportError: 45 45 from yaml import Loader, Dumper 46 47 from jinja2 import Template 46 48 47 49 import logging … … 268 270 def generate_rc_conf_local(datadump): 269 271 """ Generate configuration file '/etc/rc.conf.local' """ 272 datadump['ileiden_enable'] = 'yes' if datadump['ileiden'] else 'no' 273 270 274 output = generate_header("#"); 271 output += """\ 272 hostname='%(autogen_fqdn)s.%(domain)s' 273 location='%(location)s' 274 """ % datadump 275 276 # TProxy configuration 277 output += "\n" 278 try: 279 if datadump['tproxy']: 280 output += """\ 275 output += Template("""\ 276 hostname='{{ autogen_fqdn }}.{{ domain }}' 277 location='{{ location }}' 278 nodetype="{{ nodetype }}" 279 280 {% if tproxy -%} 281 281 tproxy_enable='YES' 282 tproxy_range='%(tproxy)s' 283 """ % datadump 284 except KeyError: 285 output += "tproxy_enable='NO'\n" 286 287 # Extra Proxy configuration 288 datadump['ileiden_enable'] = 'yes' if datadump['ileiden'] else 'no' 289 if datadump['nodetype'] == 'Proxy': 290 output += """ 282 tproxy_range='{{ tproxy }}' 283 {% else -%} 284 tproxy_enable='NO' 285 {% endif -%} 286 287 {% if nodetype == "Proxy" %} 291 288 # 292 289 # PROXY Configuration 293 290 # 294 291 sshtun_enable="YES" 295 sshtun_flags="-R 22 %(proxyid)02i:localhost:22"292 sshtun_flags="-R 22{{ "%02i"|format(proxyid) }}:localhost:22" 296 293 297 294 static_routes="wleiden" 298 route_wleiden="-net 172.16.0.0/12 %(internalroute)s" 299 defaultrouter="%(gateway)s" 300 301 internalif="%(internalif)s" 295 route_wleiden="-net 172.16.0.0/12 {{ internalroute }}" 296 {% if gateway -%} 297 defaultrouter="{{ gateway }}" 298 {% else -%} 299 #defaultrouter="NOTSET" 300 {% endif -%} 301 302 internalif="{{ internalif }}" 302 303 303 304 # PROXY iLeiden Configuration 304 ileiden_enable=" %(ileiden_enable)s"305 gateway_enable=" %(ileiden_enable)s"306 firewall_enable=" %(ileiden_enable)s"305 ileiden_enable="{{ ileiden_enable }}" 306 gateway_enable="{{ ileiden_enable }}" 307 firewall_enable="{{ ileiden_enable }}" 307 308 firewall_script="/etc/ipfw.sh" 308 firewall_nat_enable="%(ileiden_enable)s" 309 """ % datadump 310 311 if datadump['nodetype'] == 'CNode' and datadump['ileiden']: 312 output += """ 309 firewall_nat_enable="{{ ileiden_enable }}" 310 {% endif -%} 311 312 {% if nodetype == "CNode" %} 313 313 # NODE iLeiden Configuration 314 ileiden_enable="%(ileiden_enable)s"315 316 314 captive_portal_whitelist="" 317 captive_portal_interfaces="%(autogen_dhcp_interfaces)s" 318 """ % datadump 315 captive_portal_interfaces="{{ autogen_dhcp_interfaces }}" 316 {% endif %} 317 318 """).render(datadump) 319 319 320 320 # lo0 configuration:
Note:
See TracChangeset
for help on using the changeset viewer.