MCPcopy Create free account
hub / github.com/apache/cloudstack / run

Method run

python/lib/cloudutils/utilities.py:32–57  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

30 self.run()
31
32 def run(self):
33 class Alarm(Exception):
34 pass
35 def alarm_handler(signum, frame):
36 raise Alarm
37
38 try:
39 self.process = Popen(self.args, shell=True, stdout=PIPE, stderr=PIPE)
40 if self.timeout != -1:
41 signal(SIGALRM, alarm_handler)
42 alarm(self.timeout)
43
44 try:
45 self.stdout, self.stderr = self.process.communicate()
46 if self.timeout != -1:
47 alarm(0)
48 except Alarm:
49 os.kill(self.process.pid, SIGKILL)
50 raise CloudRuntimeException("Timeout during command execution")
51
52 self.success = self.process.returncode == 0
53 except:
54 raise CloudRuntimeException(formatExceptionInfo())
55
56 if not self.success:
57 logging.debug("Failed to execute:" + self.getErrMsg())
58
59 def isSuccess(self):
60 return self.success

Callers 1

__init__Method · 0.95

Calls 5

getErrMsgMethod · 0.95
formatExceptionInfoFunction · 0.85
killMethod · 0.80
debugMethod · 0.80

Tested by

no test coverage detected