Revision 523170de

b/lib/objects.py
2159 2159
    return obj
2160 2160

  
2161 2161

  
2162
class SerializableConfigParser(ConfigParser.SafeConfigParser):
2162
# need to inherit object in order to use super()
2163
class SerializableConfigParser(ConfigParser.SafeConfigParser, object):
2163 2164
  """Simple wrapper over ConfigParse that allows serialization.
2164 2165

  
2165 2166
  This class is basically ConfigParser.SafeConfigParser with two
......
2181 2182
    cfp.readfp(buf)
2182 2183
    return cfp
2183 2184

  
2185
  def get(self, section, option, **kwargs):
2186
    value = None
2187
    try:
2188
      value = super(SerializableConfigParser, self).get(section, option,
2189
                                                        **kwargs)
2190
      if value.lower() == constants.VALUE_NONE:
2191
        value = None
2192
    except ConfigParser.NoOptionError:
2193
      r = re.compile(r"(disk|nic)\d+_name")
2194
      match = r.match(option)
2195
      if match:
2196
        pass
2197
      else:
2198
        raise
2199

  
2200
    return value
2201

  
2184 2202

  
2185 2203
class LvmPvInfo(ConfigObject):
2186 2204
  """Information about an LVM physical volume (PV).

Also available in: Unified diff