Changeset 10455 in genesis


Ignore:
Timestamp:
Apr 12, 2012, 7:32:33 PM (13 years ago)
Author:
rick
Message:

unit-test parameter exists for a reason...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r10436 r10455  
    364364  for iface_key in datadump['autogen_iface_keys']:
    365365    if not datadump[iface_key].has_key('comment'):
    366       datadump[iface_key]['comment'] = none
     366      datadump[iface_key]['comment'] = None
    367367    output += "## %(interface)s - %(desc)s - %(comment)s\n" % datadump[iface_key]
    368368
     
    411411  for iface_key in datadump['autogen_iface_keys']:
    412412    if not datadump[iface_key].has_key('comment'):
    413       datadump[iface_key]['comment'] = none
     413      datadump[iface_key]['comment'] = None
    414414    output += "## %(interface)s - %(desc)s - %(comment)s\n" % datadump[iface_key]
    415415
     
    433433def generate_rc_conf_local(datadump):
    434434  """ Generate configuration file '/etc/rc.conf.local' """
    435   datadump['autogen_ileiden_enable'] = 'yes' if datadump['ileiden'] else 'no'
     435  if not datadump.has_key('ileiden'):
     436    datadump['autogen_ileiden_enable'] = False
     437  else:
     438    datadump['autogen_ileiden_enable'] = datadump['ileiden']
    436439
    437440  ileiden_proxies = []
     
    479482pf_enable="yes"
    480483pf_rules="/etc/pf.conf"
    481 {% if autogen_ileiden_enable == "yes" -%}
     484{% if autogen_ileiden_enable -%}
    482485pf_flags="-D ext_if={{ externalif }} -D int_if={{ internalif }} -D publicnat={80,443}"
    483486lvrouted_enable="{{ autogen_ileiden_enable }}"
     
    11381141        datadumps[datadump['autogen_realname']] = datadump
    11391142
     1143
    11401144      for host,datadump in datadumps.iteritems():
     1145        # Convert all yes and no to boolean values
     1146        def fix_boolean(dump):
     1147          for key in dump.keys():
     1148            if type(dump[key]) == dict:
     1149              dump[key] = fix_boolean(dump[key])
     1150            elif str(dump[key]).lower() == "yes":
     1151              dump[key] = True
     1152            elif str(dump[key]).lower() == "no":
     1153              # Compass richting no (Noord Oost) is valid input
     1154              if key != "compass":
     1155                dump[key] = False
     1156          return dump
     1157        datadump = fix_boolean(datadump)
     1158
    11411159        if datadump['rdnap_x'] and datadump['rdnap_y']:
    11421160          datadump['latitude'], datadump['longitude'] = rdnap.rd2etrs(datadump['rdnap_x'], datadump['rdnap_y'])
Note: See TracChangeset for help on using the changeset viewer.