diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..6d7ea5f --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/charm-interface-rabbitmq.git diff --git a/requires.py b/requires.py index 7a50d66..b1a2c6d 100644 --- a/requires.py +++ b/requires.py @@ -11,6 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import base64 + from charms.reactive import RelationBase from charms.reactive import hook from charms.reactive import scopes @@ -101,7 +103,7 @@ class RabbitMQRequires(RelationBase): self.request_access(username, vhost) def get_remote_all(self, key, default=None): - '''Return a list of all values presented by remote units for key''' + """Return a list of all values presented by remote units for key""" values = [] for conversation in self.conversations(): for relation_id in conversation.relation_ids: @@ -115,3 +117,9 @@ class RabbitMQRequires(RelationBase): def rabbitmq_hosts(self): return self.get_remote_all('private-address') + + def get_ssl_cert(self): + """Return decoded CA cert from rabbit or None if no CA present""" + if self.ssl_ca(): + return base64.b64decode(self.ssl_ca()).decode('utf-8') + return None diff --git a/tox.ini b/tox.ini index c035f1a..c887b8e 100644 --- a/tox.ini +++ b/tox.ini @@ -12,8 +12,22 @@ commands = ostestr {posargs} [testenv:py27] basepython = python2.7 deps = -r{toxinidir}/test-requirements.txt +# TODO: Need to write unit tests then remove the following command. +commands = /bin/true -[testenv:lint] +[testenv:py34] +basepython = python3.4 +deps = -r{toxinidir}/test-requirements.txt +# TODO: Need to write unit tests then remove the following command. +commands = /bin/true + +[testenv:py35] +basepython = python3.5 +deps = -r{toxinidir}/test-requirements.txt +# TODO: Need to write unit tests then remove the following command. +commands = /bin/true + +[testenv:pep8] basepython = python2.7 deps = -r{toxinidir}/test-requirements.txt commands = flake8 {posargs}