if cacert: options += ('--cacert', cacert)
if postdata: options += ('--data', '@-')
if timeout: options += ('--max-time', str(timeout))
- p = Popen(options + (url,), stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ p = Popen(options + (url,), stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
if postdata: p.stdin.write(postdata)
p.stdin.close()
data = p.stdout.read()
def log_call(*args):
log('running command %s' % ' '.join(args))
- try: subprocess.call(args)
+ try: subprocess.call(args, close_fds=True)
except: log_exc()
def log_exc():
def __init__(self, rec):
try:
vserver.VServer.__init__(self, rec['name'])
- except vserver.NoSuchVServer:
+ except Exception, err:
+ if not isinstance(err, vserver.NoSuchVServer):
+ # Probably a bad vserver or vserver configuration file
+ logger.log_exc()
+ logger.log('%s: recreating bad vserver' % rec['name'])
+ self.destroy(rec['name'])
self.create(rec['name'], rec['vref'])
vserver.VServer.__init__(self, rec['name'])
def _popen_gpg(*args):
"""Return a Popen object to GPG."""
- return Popen((GPG, '--batch', '--no-tty') + args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ return Popen((GPG, '--batch', '--no-tty') + args, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)