From 86a7e70a49332af81434e6f7ede4d4e3d8b6731a Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 11 Sep 2012 10:35:41 -0400 Subject: bcfg2-info: fixed bug when building an entry for buildfile raised IOError --- src/sbin/bcfg2-info | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index f188131f0..9ee02fd71 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -388,6 +388,11 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.BaseCore): self.Bind(entry, metadata) data = lxml.etree.tostring(entry, xml_declaration=False).decode('UTF-8') + except Exception: + print("Failed to build entry %s for host %s: %s" % + (fname, client, traceback.format_exc().splitlines()[-1])) + raise + try: if outfile: open(outfile, 'w').write(data) else: @@ -396,10 +401,6 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.BaseCore): err = sys.exc_info()[1] print("Could not write to %s: %s" % (outfile, err)) print(data) - except Exception: - print("Failed to build entry %s for host %s: %s" % - (fname, client, traceback.format_exc().splitlines()[-1])) - raise def do_buildbundle(self, args): """Render a bundle for client.""" -- cgit v1.2.3-1-g7c22