diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-09-11 10:37:48 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-09-11 10:37:48 -0400 |
commit | 65ca13feeef2f5257135f884ae1433fdbb2220ee (patch) | |
tree | 08e536c3e46275f17c53055e3f21f951b78e07d7 /src/sbin/bcfg2-crypt | |
parent | 36038284f045fd46a82fb97cad12126b01931323 (diff) | |
download | bcfg2-65ca13feeef2f5257135f884ae1433fdbb2220ee.tar.gz bcfg2-65ca13feeef2f5257135f884ae1433fdbb2220ee.tar.bz2 bcfg2-65ca13feeef2f5257135f884ae1433fdbb2220ee.zip |
bcfg2-crypt: handle bogus xpath expression gracefully
Diffstat (limited to 'src/sbin/bcfg2-crypt')
-rwxr-xr-x | src/sbin/bcfg2-crypt | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sbin/bcfg2-crypt b/src/sbin/bcfg2-crypt index a26bf61c8..a40bab994 100755 --- a/src/sbin/bcfg2-crypt +++ b/src/sbin/bcfg2-crypt @@ -270,6 +270,9 @@ class PropertiesEncryptor(Encryptor): xdata = lxml.etree.XML(data) if self.setup['xpath']: elements = xdata.xpath(self.setup['xpath']) + if not elements: + raise EncryptionChunkingError("XPath expression %s matched no " + "elements" % self.setup['xpath']) else: elements = xdata.xpath('//*[@encrypted]') if not elements: |