From: Greg Price Date: Fri, 25 Jul 2008 01:42:18 +0000 (-0400) Subject: fix another race in remctl interface X-Git-Tag: sipb-xen-remote-server/0.4~6 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/commitdiff_plain/8a6059dce20caaceec16d4773f883aa2ddbe5ce3?hp=ed614b555de876687a667457ac9541e9feca497b fix another race in remctl interface This had caused some 500s with a message 'Error: Domain <...> does not exist.' svn path=/trunk/packages/sipb-xen-remote-server/; revision=721 --- diff --git a/files/usr/sbin/sipb-xen-remote-control b/files/usr/sbin/sipb-xen-remote-control index 1ad8721..e61cb72 100755 --- a/files/usr/sbin/sipb-xen-remote-control +++ b/files/usr/sbin/sipb-xen-remote-control @@ -23,10 +23,18 @@ def main(argv): if machine_name not in vms: print >>sys.stderr, "machine '%s' is not on" % machine_name - return 2 + return 1 host = vms[machine_name]['host'] - return call(['remctl', host, 'remote', 'control'] + argv[1:]) + p = Popen(['remctl', host, 'remote', 'control'] + argv[1:], + stdout=PIPE, stderr=PIPE) + (out, err) = p.communicate() + if p.returncode == 1: + print >>sys.stderr, "machine '%s' is not on" % machine_name + return 1 + sys.stderr.write(err) + sys.stdout.write(out) + return p.returncode if __name__ == '__main__': sys.exit(main(sys.argv))