summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-22 10:00:38 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-22 10:00:38 -0400
commitd59c274547b6aecb3bcbfb99d1b874d403c51bea (patch)
tree7d83406c21f1825a7ec24675f2b6f86123a62da0 /src/sbin
parent2c86f67fa234406ee0007a3f77cc1aa9f45ed746 (diff)
downloadbcfg2-d59c274547b6aecb3bcbfb99d1b874d403c51bea.tar.gz
bcfg2-d59c274547b6aecb3bcbfb99d1b874d403c51bea.tar.bz2
bcfg2-d59c274547b6aecb3bcbfb99d1b874d403c51bea.zip
fixed lxml.etree.tostring invocations
Diffstat (limited to 'src/sbin')
-rwxr-xr-xsrc/sbin/bcfg2-build-reports6
-rwxr-xr-xsrc/sbin/bcfg2-crypt2
-rwxr-xr-xsrc/sbin/bcfg2-info3
3 files changed, 6 insertions, 5 deletions
diff --git a/src/sbin/bcfg2-build-reports b/src/sbin/bcfg2-build-reports
index e49446385..318e9de5d 100755
--- a/src/sbin/bcfg2-build-reports
+++ b/src/sbin/bcfg2-build-reports
@@ -110,7 +110,7 @@ def rss(reportxml, delivery, report):
for item in items:
channel.append(item)
- tree = tostring(rssdata, encoding='unicode')
+ tree = tostring(rssdata, xml_declaration=False).decode('UTF-8')
fil.write(tree)
fil.close()
@@ -260,7 +260,7 @@ if __name__ == '__main__':
# Apply XSLT, different ones based on report type, and options
if deliverymechanism == 'null-operator': # Special Cases
- fileout(tostring(ElementTree(procnodereport).getroot(), encoding='unicode'), deliv)
+ fileout(tostring(ElementTree(procnodereport).getroot(), xml_declaration=False).decode('UTF-8'), deliv)
break
transform = delivtype + '-' + deliverymechanism + '.xsl'
@@ -312,7 +312,7 @@ if __name__ == '__main__':
(toastring, socket.getfqdn(), outputstring)
mail(outputstring, c) #call function to send
else:
- outputstring = tostring(stylesheet.apply(ElementTree(procnodereport)).getroot(), encoding='unicode')
+ outputstring = tostring(stylesheet.apply(ElementTree(procnodereport)).getroot(), xml_declaration=False).decode('UTF-8')
if deliverymechanism == 'rss':
rss(outputstring, deliv, reprt)
else: # Must be deliverymechanism == 'www':
diff --git a/src/sbin/bcfg2-crypt b/src/sbin/bcfg2-crypt
index 9da4a25d1..9ce21da82 100755
--- a/src/sbin/bcfg2-crypt
+++ b/src/sbin/bcfg2-crypt
@@ -255,7 +255,7 @@ class PropertiesEncryptor(Encryptor):
while xdata.getparent() != None:
xdata = xdata.getparent()
xdata.set("encryption", "true")
- return lxml.etree.tostring(xdata, encoding='unicode')
+ return lxml.etree.tostring(xdata, xml_declaration=False).decode('UTF-8')
def _get_passphrase(self, chunk):
pname = chunk.get("encrypted") or chunk.get("encryption")
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index 3f7f33344..7fd00032d 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -395,7 +395,8 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.BaseCore):
try:
metadata = self.build_metadata(client)
self.Bind(entry, metadata)
- data = lxml.etree.tostring(entry, encoding="unicode")
+ data = lxml.etree.tostring(entry,
+ xml_declaration=False).decode('UTF-8')
if outfile:
open(outfile, 'w').write(data)
else: