Trap exception when trying to write csr

Trap the exception when trying to write the csr fails.
Fixes LP: #1092016

Change-Id: I05675c8c7b1d205a06d13dd3e62e06088d1b896d
Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short
2012-12-19 12:51:20 -06:00
parent cbf9d89738
commit 4bfce36096

View File

@@ -295,8 +295,12 @@ def _sign_csr(csr_text, ca_folder):
inbound = os.path.join(tmpdir, 'inbound.csr')
outbound = os.path.join(tmpdir, 'outbound.csr')
with open(inbound, 'w') as csrfile:
csrfile.write(csr_text)
try:
with open(inbound, 'w') as csrfile:
csrfile.write(csr_text)
except IOError:
LOG.exception(_('Failed to write inbound.csr'))
raise
LOG.debug(_('Flags path: %s'), ca_folder)
start = os.getcwd()