From e370479b0b2bf03fdce2d01f10b97ac1dd07ef65 Mon Sep 17 00:00:00 2001 From: Ante Karamatic Date: Tue, 4 Feb 2014 08:41:13 +0200 Subject: [PATCH 1/3] Install base64 decoded certificate --- hooks/quantum_hooks.py | 5 ++++- revision | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hooks/quantum_hooks.py b/hooks/quantum_hooks.py index 10f7d3a2..df47e6c4 100755 --- a/hooks/quantum_hooks.py +++ b/hooks/quantum_hooks.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from base64 import b64decode + from charmhelpers.core.hookenv import ( log, ERROR, WARNING, config, @@ -125,7 +127,8 @@ def db_amqp_changed(): def nm_changed(): CONFIGS.write_all() if relation_get('ca_cert'): - install_ca_cert(relation_get('ca_cert')) + ca_crt = b64decode(relation_get('ca_cert')) + install_ca_cert(ca_crt) @hooks.hook("cluster-relation-departed") diff --git a/revision b/revision index 04f9fe46..abdfb053 100644 --- a/revision +++ b/revision @@ -1 +1 @@ -59 +60 From f5f906687f547cac2b505d9ad535598fcb697eff Mon Sep 17 00:00:00 2001 From: Ante Karamatic Date: Tue, 4 Feb 2014 13:52:56 +0200 Subject: [PATCH 2/3] Fix tests for cert --- unit_tests/test_quantum_hooks.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/unit_tests/test_quantum_hooks.py b/unit_tests/test_quantum_hooks.py index dae751b1..5f811759 100644 --- a/unit_tests/test_quantum_hooks.py +++ b/unit_tests/test_quantum_hooks.py @@ -36,8 +36,12 @@ TO_PATCH = [ 'execd_preinstall', 'lsb_release', 'stop_services', + 'b64decode', ] +def passthrough(value): + return value + class TestQuantumHooks(CharmTestCase): @@ -47,6 +51,7 @@ class TestQuantumHooks(CharmTestCase): self.test_config.set('openstack-origin', 'cloud:precise-havana') self.test_config.set('plugin', 'ovs') self.lsb_release.return_value = {'DISTRIB_CODENAME': 'precise'} + self.b64decode.side_effect = passthrough def _call_hook(self, hookname): hooks.hooks.execute([ From b6d446bfb082190d4311506c2dacc9a62347e4e5 Mon Sep 17 00:00:00 2001 From: Ante Karamatic Date: Tue, 4 Feb 2014 13:54:16 +0200 Subject: [PATCH 3/3] Add missing newline --- unit_tests/test_quantum_hooks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/unit_tests/test_quantum_hooks.py b/unit_tests/test_quantum_hooks.py index 5f811759..78d1a4f7 100644 --- a/unit_tests/test_quantum_hooks.py +++ b/unit_tests/test_quantum_hooks.py @@ -39,6 +39,7 @@ TO_PATCH = [ 'b64decode', ] + def passthrough(value): return value