From 16a886c007a20e73527bf95c19b2ef9a83d2c4d7 Mon Sep 17 00:00:00 2001 From: Adam Harwell Date: Mon, 16 Mar 2015 15:13:28 -0500 Subject: [PATCH] Fix secret-store empty-key filtering bug The "secret store" action filters out empty keys too early in the process, which can cause None to be passed as the content-encoding in some cases. Change-Id: I2bee838f9f9e9c4cf51109083f7e4dc8068f6711 --- barbicanclient/secrets.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/barbicanclient/secrets.py b/barbicanclient/secrets.py index fca7dd06..a92edd13 100644 --- a/barbicanclient/secrets.py +++ b/barbicanclient/secrets.py @@ -249,13 +249,13 @@ class Secret(SecretFormatter): Stores the Secret in Barbican. New Secret objects are not persisted in Barbican until this method is called. """ - secret_dict = base.filter_null_keys({ + secret_dict = { 'name': self.name, 'algorithm': self.algorithm, 'mode': self.mode, 'bit_length': self.bit_length, 'expiration': self.expiration - }) + } if self.payload_content_type: """ @@ -286,6 +286,8 @@ class Secret(SecretFormatter): secret_dict['payload'] = self.payload secret_dict['payload_content_type'] = u'text/plain' + secret_dict = base.filter_null_keys(secret_dict) + LOG.debug("Request body: {0}".format(secret_dict)) # Save, store secret_ref and return