Fix loguserdata output to file issue

Fixes bug #1191685

Change-Id: I2a02b490e45c3cb838243b9dad62cc52b609b336
changes/76/38276/2
guohliu 10 years ago
parent 3e4e007685
commit dc41655176

@ -35,14 +35,15 @@ def call(args):
def write(self, data):
LOG.info(data)
def __getattr__(self, attr):
return getattr(sys.stdout, attr)
LOG.info('%s\n' % ' '.join(args))
try:
ls = LogStream()
p = subprocess.Popen(args, stdout=ls, stderr=ls)
p.wait()
p = subprocess.Popen(args, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
data = p.communicate()
if data:
for x in data:
ls.write(x)
except OSError as ex:
if ex.errno == errno.ENOEXEC:
LOG.error('Userdata empty or not executable: %s\n' % str(ex))

@ -34,6 +34,9 @@ class FakePOpen():
def wait(self):
pass
def communicate(self, input=None):
pass
class LoguserdataTest(HeatTestCase):

Loading…
Cancel
Save