Revision d9c02ca6 lib/cmdlib.py

b/lib/cmdlib.py
182 182
  HTYPE = None
183 183

  
184 184

  
185
def _AddHostToEtcHosts(hostname):
186
  """Wrapper around utils.SetEtcHostsEntry.
187

  
188
  """
189
  hi = utils.HostInfo(name=hostname)
190
  utils.SetEtcHostsEntry(constants.ETC_HOSTS, hi.ip, hi.name, [hi.ShortName()])
191

  
192

  
193
def _RemoveHostFromEtcHosts(hostname):
194
  """Wrapper around utils.RemoveEtcHostsEntry.
195

  
196
  """
197
  hi = utils.HostInfo(name=hostname)
198
  utils.RemoveEtcHostsEntry(constants.ETC_HOSTS, hi.name)
199
  utils.RemoveEtcHostsEntry(constants.ETC_HOSTS, hi.ShortName())
200

  
201

  
202 185
def _GetWantedNodes(lu, nodes):
203 186
  """Returns list of checked and expanded node names.
204 187

  
......
556 539
      f.close()
557 540
    sshkey = sshline.split(" ")[1]
558 541

  
559
    _AddHostToEtcHosts(hostname.name)
542
    utils.AddHostToEtcHosts(hostname.name)
560 543
    _InitSSHSetup(hostname.name)
561 544

  
562 545
    # init of cluster config file
......
1491 1474

  
1492 1475
    self.cfg.RemoveNode(node.name)
1493 1476

  
1494
    _RemoveHostFromEtcHosts(node.name)
1477
    utils.RemoveHostFromEtcHosts(node.name)
1495 1478

  
1496 1479

  
1497 1480
class LUQueryNodes(NoHooksLU):
......
1853 1836
      raise errors.OpExecError("Cannot transfer ssh keys to the new node")
1854 1837

  
1855 1838
    # Add node to our /etc/hosts, and add key to known_hosts
1856
    _AddHostToEtcHosts(new_node.name)
1839
    utils.AddHostToEtcHosts(new_node.name)
1857 1840

  
1858 1841
    if new_node.secondary_ip != new_node.primary_ip:
1859 1842
      if not rpc.call_node_tcp_ping(new_node.name,

Also available in: Unified diff