Revision d89168ff lib/objects.py

b/lib/objects.py
2039 2039
    "ext_reservations",
2040 2040
    ] + _TIMESTAMPS + _UUID
2041 2041

  
2042
  def HooksDict(self, prefix):
2043
    """Export a dictionary used by hooks with a network's information.
2044

  
2045
    @type prefix: String
2046
    @param prefix: Prefix to prepend to the dict entries
2047

  
2048
    """
2049
    result = {
2050
      "%sNETWORK" % prefix: self.name,
2051
      "%sNETWORK_UUID" % prefix: self.uuid,
2052
      "%sNETWORK_FAMILY" % prefix: str(self.family),
2053
      "%sNETWORK_TAGS" % prefix: " ".join(self.tags),
2054
    }
2055
    if self.network:
2056
      result["%sNETWORK_SUBNET" % prefix] = self.network
2057
    if self.gateway:
2058
      result["%sNETWORK_GATEWAY" % prefix] = self.gateway
2059
    if self.network6:
2060
      result["%sNETWORK_SUBNET6" % prefix] = self.network6
2061
    if self.gateway6:
2062
      result["%sNETWORK_GATEWAY6" % prefix] = self.gateway6
2063
    if self.mac_prefix:
2064
      result["%sNETWORK_MAC_PREFIX" % prefix] = self.mac_prefix
2065
    if self.network_type:
2066
      result["%sNETWORK_TYPE" % prefix] = self.network_type
2067

  
2068
    return result
2069

  
2042 2070

  
2043 2071
class SerializableConfigParser(ConfigParser.SafeConfigParser):
2044 2072
  """Simple wrapper over ConfigParse that allows serialization.

Also available in: Unified diff