Revision a33848a5 lib/ssconf.py

b/lib/ssconf.py
79 79
  def GetNodeList(self):
80 80
    return self._config_data["nodes"].keys()
81 81

  
82
  @classmethod
83
  def FromDict(cls, val, cfg_file=constants.CLUSTER_CONF_FILE):
84
    """Alternative construction from a dictionary.
85

  
86
    """
87
    obj = SimpleConfigReader.__new__(cls)
88
    obj._config_data = val
89
    obj._file_name = cfg_file
90
    return obj
91

  
92

  
93
class SimpleConfigWriter(SimpleConfigReader):
94
  """Simple class to write configuration file.
95

  
96
  """
97
  def Save(self):
98
    """Writes configuration file.
99

  
100
    Warning: Doesn't take care of locking or synchronizing with other
101
    processes.
102

  
103
    """
104
    utils.WriteFile(self._file_name,
105
                    data=serializer.Dump(self._config_data),
106
                    mode=0600)
107

  
108 82

  
109 83
class SimpleStore(object):
110 84
  """Interface to static cluster data.

Also available in: Unified diff