Add Standard available state

The assess status functions in charms_openstack look for an
interface to have emitted a state named {relation_name}.available
to show it is complete. This patch adds that state.

Change-Id: I7dff0f5821c9feed306c98e3fa730a3642f78a11
This commit is contained in:
Liam Young 2016-09-14 15:52:33 +00:00
parent 808d490e45
commit 47d11526ea
4 changed files with 49 additions and 3 deletions

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/charm-interface-odl-controller-api.git

View File

@ -12,14 +12,14 @@ class ControllerAPIRequires(RelationBase):
def changed(self):
self.set_state('{relation_name}.connected')
if self.connection():
self.set_state('{relation_name}.access.available')
self.set_state('{relation_name}.available')
else:
self.remove_state('{relation_name}.access.available')
self.remove_state('{relation_name}.available')
@hook('{requires:odl-controller-api}-relation-broken')
def broken(self):
self.remove_state('{relation_name}.connected')
self.remove_state('{relation_name}.access.available')
self.remove_state('{relation_name}.available')
def connection(self):
"""OpenDayLight Controller Access Details

2
test-requirements.txt Normal file
View File

@ -0,0 +1,2 @@
flake8>=2.2.4,<=2.4.1
os-testr>=0.4.1

40
tox.ini Normal file
View File

@ -0,0 +1,40 @@
[tox]
envlist = pep8,py27,py34,py35
skipsdist = True
skip_missing_interpreters = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
install_command =
pip install --allow-unverified python-apt {opts} {packages}
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: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}
[testenv:venv]
commands = {posargs}
[flake8]
ignore = E402,E226