summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Encryption.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-12-09 09:38:04 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-12-09 09:38:04 -0500
commit7497f20a4821515fc9c8dadf85d3c4f3b47245eb (patch)
treebe129aa775852ed70bac6be82af719b9bfc7901f /src/lib/Bcfg2/Server/Encryption.py
parenteff366a0c3b9ba87f3ee06f90dccdd242579b7b1 (diff)
parentbf2ee31f956447fa42ae85dc69820405eda8c490 (diff)
downloadbcfg2-7497f20a4821515fc9c8dadf85d3c4f3b47245eb.tar.gz
bcfg2-7497f20a4821515fc9c8dadf85d3c4f3b47245eb.tar.bz2
bcfg2-7497f20a4821515fc9c8dadf85d3c4f3b47245eb.zip
Merge branch 'maint'
Conflicts: doc/appendix/guides/fedora.txt misc/bcfg2.spec schemas/types.xsd src/lib/Bcfg2/Encryption.py src/lib/Bcfg2/Options.py src/lib/Bcfg2/Server/Admin/Client.py src/lib/Bcfg2/Server/Core.py src/lib/Bcfg2/Server/Lint/Validate.py src/lib/Bcfg2/Server/Plugin/helpers.py src/lib/Bcfg2/Server/Plugins/Bundler.py src/lib/Bcfg2/Server/Plugins/Cfg/CfgEncryptedGenerator.py src/lib/Bcfg2/Server/Plugins/Probes.py src/sbin/bcfg2-crypt testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgEncryptedGenerator.py testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py testsuite/common.py testsuite/install.sh
Diffstat (limited to 'src/lib/Bcfg2/Server/Encryption.py')
-rwxr-xr-xsrc/lib/Bcfg2/Server/Encryption.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/Bcfg2/Server/Encryption.py b/src/lib/Bcfg2/Server/Encryption.py
index f8b602d90..c96e7ad21 100755
--- a/src/lib/Bcfg2/Server/Encryption.py
+++ b/src/lib/Bcfg2/Server/Encryption.py
@@ -233,6 +233,10 @@ class DecryptError(Exception):
""" Exception raised when decryption fails. """
+class EncryptError(Exception):
+ """ Exception raised when encryption fails. """
+
+
class CryptoTool(object):
""" Generic decryption/encryption interface base object """
@@ -428,8 +432,7 @@ class PropertiesEncryptor(Encryptor, PropertiesCryptoMixin):
try:
pname, passphrase = self._get_element_passphrase(elt)
except PassphraseError:
- self.logger.error(str(sys.exc_info()[1]))
- return False
+ raise EncryptError(str(sys.exc_info()[1]))
self.logger.debug("Encrypting %s" % print_xml(elt))
elt.text = ssl_encrypt(elt.text, passphrase).strip()
elt.set("encrypted", pname)
@@ -640,9 +643,9 @@ class CLI(object):
if data is None:
try:
data = getattr(tool, mode)()
- except DecryptError:
- self.logger.error("Failed to %s %s, skipping" % (mode,
- fname))
+ except (EncryptError, DecryptError):
+ self.logger.error("Failed to %s %s, skipping: %s" %
+ (mode, fname, sys.exc_info()[1]))
continue
if Bcfg2.Options.setup.stdout:
if len(Bcfg2.Options.setup.files) > 1: