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

Function execute

systemvm/debian/opt/cloud/bin/cs/CsHelper.py:194–210  ·  view source on GitHub ↗

Execute command

(command)

Source from the content-addressed store, hash-verified

192
193
194def execute(command):
195 """ Execute command """
196 returncode = -1
197 try:
198 logging.info("Executing: %s" % command)
199 result = subprocess.check_output(command, shell=True)
200 returncode = 0
201
202 logging.debug("Command [%s] has the result [%s]" % (command, result))
203 return result.decode().splitlines()
204 except subprocess.CalledProcessError as e:
205 logging.error(e)
206 returncode = e.returncode
207 finally:
208 logging.debug("Executed: %s - exitstatus=%s " % (command, returncode))
209
210 return list()
211
212
213def save_iptables(command, iptables_file):

Callers 11

reconfigure_interfacesFunction · 0.70
is_mountedFunction · 0.70
mount_tmpfsFunction · 0.70
umount_tmpfsFunction · 0.70
get_device_infoFunction · 0.70
get_deviceFunction · 0.70
get_ipFunction · 0.70
save_iptablesFunction · 0.70
serviceFunction · 0.70
hup_dnsmasqFunction · 0.70
mainFunction · 0.50

Calls 5

check_outputMethod · 0.80
debugMethod · 0.80
infoMethod · 0.45
decodeMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected