Fix Snakeoil to return expiration timestamp in string format
The method strip() was being called on a datetime object. The Snakeoil plugin was passing in a timestamp object, instead of a string. This commit fixes the plugin to use the correct format. Co-Authored-By: Dave McCowan <dmccowan@cisco.com> Change-Id: I271cff2fc32c51157e2237a504dc5dce075f367c Closes-Bug: #1498542
This commit is contained in:
parent
4d3f206a06
commit
ae37c32e01
@ -439,7 +439,7 @@ class SnakeoilCACertificatePlugin(cert_manager.CertificatePluginBase):
|
||||
cert_manager.INFO_NAME: new_ca.name,
|
||||
cert_manager.INFO_CA_SIGNING_CERT: crypto.dump_certificate(
|
||||
crypto.FILETYPE_PEM, new_ca.cert),
|
||||
cert_manager.INFO_EXPIRATION: expiration,
|
||||
cert_manager.INFO_EXPIRATION: expiration.isoformat(),
|
||||
cert_manager.INFO_INTERMEDIATES: new_ca.pkcs7,
|
||||
cert_manager.PLUGIN_CA_ID: new_ca_id
|
||||
}
|
||||
@ -455,7 +455,7 @@ class SnakeoilCACertificatePlugin(cert_manager.CertificatePluginBase):
|
||||
cert_manager.INFO_CA_SIGNING_CERT: crypto.dump_certificate(
|
||||
crypto.FILETYPE_PEM, ca.cert),
|
||||
cert_manager.INFO_INTERMEDIATES: ca.pkcs7,
|
||||
cert_manager.INFO_EXPIRATION: expiration
|
||||
cert_manager.INFO_EXPIRATION: expiration.isoformat()
|
||||
}
|
||||
ret[ca_id] = ca_info
|
||||
|
||||
|
@ -418,6 +418,7 @@ class SnakeoilCAPluginTestCase(BaseTestCase):
|
||||
self.assertIsNotNone(ca_dict)
|
||||
self.assertEqual(self.plugin.ca.name, ca_dict.get(cm.INFO_NAME))
|
||||
self.assertIsNotNone(ca_dict.get(cm.INFO_CA_SIGNING_CERT))
|
||||
self.assertEqual(str, type(ca_dict.get(cm.INFO_EXPIRATION)))
|
||||
|
||||
def test_get_ca_info_with_subca(self):
|
||||
subca_dict = self._create_subca()
|
||||
@ -425,3 +426,4 @@ class SnakeoilCAPluginTestCase(BaseTestCase):
|
||||
ca_info = self.plugin.get_ca_info()
|
||||
self.assertIn(subca_id, ca_info.keys())
|
||||
self.assertIn(self.plugin.get_default_ca_name(), ca_info.keys())
|
||||
self.assertEqual(str, type(subca_dict.get(cm.INFO_EXPIRATION)))
|
||||
|
Loading…
Reference in New Issue
Block a user