Revision dffa96d6 lib/tools/prepare_node_join.py

b/lib/tools/prepare_node_join.py
150 150
    _verify_fn(cert)
151 151

  
152 152

  
153
def _VerifyClusterName(name, _ss_cluster_name_file=None):
154
  """Verifies cluster name against a local cluster name.
155

  
156
  @type name: string
157
  @param name: Cluster name
158

  
159
  """
160
  if _ss_cluster_name_file is None:
161
    _ss_cluster_name_file = \
162
      ssconf.SimpleStore().KeyToFilename(constants.SS_CLUSTER_NAME)
163

  
164
  try:
165
    local_name = utils.ReadOneLineFile(_ss_cluster_name_file)
166
  except EnvironmentError, err:
167
    if err.errno != errno.ENOENT:
168
      raise
169

  
170
    logging.debug("Local cluster name was not found (file %s)",
171
                  _ss_cluster_name_file)
172
  else:
173
    if name != local_name:
174
      raise JoinError("Current cluster name is '%s'" % local_name)
175

  
176

  
177
def VerifyClusterName(data, _verify_fn=_VerifyClusterName):
153
def VerifyClusterName(data, _verify_fn=ssconf.VerifyClusterName):
178 154
  """Verifies cluster name.
179 155

  
180 156
  @type data: dict

Also available in: Unified diff