v.licheni.net
/
stack
/
cam.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add 'verify' subcommand
[stack/cam.git]
/
cam
/
openssl_wrap.py
diff --git
a/cam/openssl_wrap.py
b/cam/openssl_wrap.py
index
db44f26
..
ab94225
100644
(file)
--- a/
cam/openssl_wrap.py
+++ b/
cam/openssl_wrap.py
@@
-1,4
+1,5
@@
import logging
import logging
+import os
import subprocess
log = logging.getLogger(__name__)
import subprocess
log = logging.getLogger(__name__)
@@
-8,11
+9,13
@@
class CommandError(Exception):
pass
pass
-def run(*args):
+def run(*args
, **env_vars
):
cmd = ['openssl']
cmd.extend(args)
cmd = ['openssl']
cmd.extend(args)
+ env = dict(os.environ)
+ env.update(env_vars)
log.debug('executing "%s"' % ' '.join(cmd))
log.debug('executing "%s"' % ' '.join(cmd))
- pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ pipe = subprocess.Popen(cmd,
env=env,
stdout=subprocess.PIPE)
stdout, _ = pipe.communicate()
if pipe.returncode != 0:
raise CommandError('openssl exited with status %d' % (
stdout, _ = pipe.communicate()
if pipe.returncode != 0:
raise CommandError('openssl exited with status %d' % (
@@
-20,7
+23,8
@@
def run(*args):
return stdout
return stdout
-def run_with_config(config_file, *args):
+def run_with_config(c
aroot, c
onfig_file, *args):
cmd = args[0]
args = args[1:]
cmd = args[0]
args = args[1:]
- return run(cmd, '-config', config_file, '-batch', *args)
+ caroot = os.path.abspath(caroot)
+ return run(cmd, '-config', config_file, '-batch', *args, CAROOT=caroot)