Revision 5f6d1b42 qa/qa_utils.py

b/qa/qa_utils.py
434 434
  return result
435 435

  
436 436

  
437
def _ResolveName(cmd, key):
438
  """Helper function.
439

  
440
  """
441
  master = qa_config.GetMasterNode()
442

  
443
  output = GetCommandOutput(master.primary, utils.ShellQuoteArgs(cmd))
444
  for line in output.splitlines():
445
    (lkey, lvalue) = line.split(":", 1)
446
    if lkey == key:
447
      return lvalue.lstrip()
448
  raise KeyError("Key not found")
449

  
450

  
451 437
def ResolveInstanceName(instance):
452 438
  """Gets the full name of an instance.
453 439

  
......
463 449
  """Gets the full name of a node.
464 450

  
465 451
  """
466
  return _ResolveName(["gnt-node", "info", node.primary],
467
                      "Node name")
452
  info = GetObjectInfo(["gnt-node", "info", node.primary])
453
  return info[0]["Node name"]
468 454

  
469 455

  
470 456
def GetNodeInstances(node, secondaries=False):

Also available in: Unified diff