summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Brinker <chris.brinker@gmail.com>2014-04-24 14:58:15 -0700
committerChris Brinker <chris.brinker@gmail.com>2014-04-24 14:59:29 -0700
commit772255701d76f3f0865386b2ae1e9ae2cf14d2a9 (patch)
tree3461deeb3911fccd6b72ddb5dfbffa668faaa29f
parentd510e918e41b7b2b7b0b9351a40eab2794b49c83 (diff)
downloadbcfg2-772255701d76f3f0865386b2ae1e9ae2cf14d2a9.tar.gz
bcfg2-772255701d76f3f0865386b2ae1e9ae2cf14d2a9.tar.bz2
bcfg2-772255701d76f3f0865386b2ae1e9ae2cf14d2a9.zip
Default to only (En|De)crypt vars that need it
For both Encrypting and Decrypting of Properties files, we should by default only attempt to execute on elements that have an "encrypted" attribute defined. The code will already attempt to encrypt every element if nothing in the current document matches this xpath, which catches the case of a user trying to fully encrypt a completely new properties file.
-rwxr-xr-xsrc/lib/Bcfg2/Server/Encryption.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Server/Encryption.py b/src/lib/Bcfg2/Server/Encryption.py
index f7f636659..b60302871 100755
--- a/src/lib/Bcfg2/Server/Encryption.py
+++ b/src/lib/Bcfg2/Server/Encryption.py
@@ -372,7 +372,7 @@ class CfgDecryptor(Decryptor):
class PropertiesCryptoMixin(object):
""" Mixin to provide some common methods for Properties crypto """
- default_xpath = '//*'
+ default_xpath = '//*[@encrypted]'
def _get_elements(self, xdata):
""" Get the list of elements to encrypt or decrypt """
@@ -460,7 +460,6 @@ class PropertiesEncryptor(Encryptor, PropertiesCryptoMixin):
class PropertiesDecryptor(Decryptor, PropertiesCryptoMixin):
""" decryptor class for Properties files """
- default_xpath = '//*[@encrypted]'
def decrypt(self):
decrypted_any = False