Revision 5d640672 qa/qa_utils.py

b/qa/qa_utils.py
96 96
    return p.stdout.read().strip()
97 97
  finally:
98 98
    f.close()
99
# }}}
99

  
100

  
101
def ResolveInstanceName(instance):
102
  """Gets the full name of an instance.
103

  
104
  """
105
  master = qa_config.GetMasterNode()
106

  
107
  info_cmd = utils.ShellQuoteArgs(['gnt-instance', 'info', instance['name']])
108
  sed_cmd = utils.ShellQuoteArgs(['sed', '-n', '-e', 's/^Instance name: *//p'])
109

  
110
  cmd = '%s | %s' % (info_cmd, sed_cmd)
111
  ssh_cmd = GetSSHCommand(master['primary'], cmd)
112
  p = subprocess.Popen(ssh_cmd, shell=False, stdout=subprocess.PIPE)
113
  AssertEqual(p.wait(), 0)
114

  
115
  return p.stdout.read().strip()

Also available in: Unified diff