From f8413af9168adc0ad7c730b9adea9eba67949ba5 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 22 Jun 2012 23:26:50 -0700 Subject: 1. Move the getkeybyid function back here but add some slight adjustments a. Instead of executing a bash string, write out a temporary file and then just execute '/bin/sh' on that file with the right arguments instead. 2. Rename util.SilentTemporaryFile to util.ExtendedTemporaryFile and update the usages of the previous name accordingly, this better reflects what this temp file is. 3. More teenie pep8 line length fixings --- cloudinit/util.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'cloudinit/util.py') diff --git a/cloudinit/util.py b/cloudinit/util.py index baa3def1..6cdf9ff3 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -157,7 +157,7 @@ class MountFailedError(Exception): pass -def SilentTemporaryFile(**kwargs): +def ExtendedTemporaryFile(**kwargs): fh = tempfile.NamedTemporaryFile(**kwargs) # Replace its unlink with a quiet version # that does not raise errors when the @@ -517,26 +517,6 @@ def del_dir(path): shutil.rmtree(path) -# get gpg keyid from keyserver -def getkeybyid(keyid, keyserver): - # TODO fix this... - shcmd = """ - k=${1} ks=${2}; - exec 2>/dev/null - [ -n "$k" ] || exit 1; - armour=$(gpg --list-keys --armour "${k}") - if [ -z "${armour}" ]; then - gpg --keyserver ${ks} --recv $k >/dev/null && - armour=$(gpg --export --armour "${k}") && - gpg --batch --yes --delete-keys "${k}" - fi - [ -n "${armour}" ] && echo "${armour}" - """ - args = ['sh', '-c', shcmd, "export-gpg-keyid", keyid, keyserver] - (stdout, _stderr) = subp(args) - return stdout - - def runparts(dirp, skip_no_exist=True): if skip_no_exist and not os.path.isdir(dirp): return -- cgit v1.2.3