summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorCalen Pennington <cpennington@wgen.net>2011-09-09 15:52:30 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-13 11:49:33 -0500
commitb3bb4a985fa23305f79c9eb390bcfda4db5069f5 (patch)
tree1a6dda1512333212e2ebf7b833c7ff33153693eb /src/sbin
parentf32c180d4c28ddffb235a24cb49763141e0e1b97 (diff)
downloadbcfg2-b3bb4a985fa23305f79c9eb390bcfda4db5069f5.tar.gz
bcfg2-b3bb4a985fa23305f79c9eb390bcfda4db5069f5.tar.bz2
bcfg2-b3bb4a985fa23305f79c9eb390bcfda4db5069f5.zip
Use native elementtree call to write configuration to disk
This simplifies the logic, although it doesn't have any measurable performance improvements.
Diffstat (limited to 'src/sbin')
-rwxr-xr-xsrc/sbin/bcfg2-info5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index c73efa23e..de4e95102 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -204,12 +204,9 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core):
if not ofile.startswith('/tmp') and not path_force:
print("Refusing to write files outside of /tmp without -f option")
return
- output = open(ofile, 'w')
- data = lxml.etree.tostring(self.BuildConfiguration(client),
+ lxml.etree.ElementTree(self.BuildConfiguration(client)).write(ofile,
encoding='UTF-8', xml_declaration=True,
pretty_print=True)
- output.write(data)
- output.close()
else:
print('Usage: build [-f] <hostname> <output file>')