Generl tidy, docstrings, copyright, tox.ini etc
This commit is contained in:
parent
365cd84af0
commit
2b795745e1
|
@ -0,0 +1 @@
|
|||
.tox
|
20
copyright
20
copyright
|
@ -2,8 +2,20 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0
|
|||
|
||||
Files: *
|
||||
Copyright: 2015, Canonical Ltd.
|
||||
License: GPL-3
|
||||
License: Apache-2.0
|
||||
|
||||
License: GPL-3
|
||||
On Debian GNU/Linux system you can find the complete text of the
|
||||
GPL-3 license in '/usr/share/common-licenses/GPL-3'
|
||||
License: Apache-2.0
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
.
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
.
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
.
|
||||
On Debian-based systems the full text of the Apache version 2.0 license
|
||||
can be found in `/usr/share/common-licenses/Apache-2.0'.
|
||||
|
|
36
provides.py
36
provides.py
|
@ -9,17 +9,49 @@ from charms.reactive import scopes
|
|||
class NeutronPluginAPISubordinate(RelationBase):
|
||||
scope = scopes.GLOBAL
|
||||
|
||||
@hook('{provides:neutron-plugin-api-subordinate}-relation-{joined,changed}')
|
||||
@hook(
|
||||
'{provides:neutron-plugin-api-subordinate}-relation-{joined,changed}')
|
||||
def changed(self):
|
||||
"""Set connected state"""
|
||||
self.set_state('{relation_name}.connected')
|
||||
|
||||
@hook('{provides:neutron-plugin-api-subordinate}-relation-{broken,departed}')
|
||||
@hook(
|
||||
'{provides:neutron-plugin-api-subordinate}-relation-{broken,departed}')
|
||||
def broken(self):
|
||||
"""Remove connected state"""
|
||||
self.remove_state('{relation_name}.connected')
|
||||
|
||||
def configure_plugin(self, neutron_plugin=None, core_plugin=None,
|
||||
neutron_plugin_config=None, service_plugins=None,
|
||||
subordinate_configuration=None):
|
||||
"""Send principle plugin information
|
||||
|
||||
:param neutron_plugin: str Neutron plugin name eg odl
|
||||
:param core_plugin: str eg neutron.plugins.ml2.plugin.Ml2Plugin
|
||||
:param neutron-plugin-config: str /etc/neutron/plugins/ml2/ml2_conf.ini
|
||||
:param service-plugins str: Comma delimited list of service plugins eg
|
||||
router,firewall,lbaas,vpnaas,metering
|
||||
:param subordinate_configuration dict: Configuration for the principle
|
||||
to inject into a configuration
|
||||
file it is managing eg:
|
||||
# Add sections and tuples to insert values into neutron-server's
|
||||
# neutron.conf e.g.
|
||||
# {
|
||||
# "neutron-api": {
|
||||
# "/etc/neutron/neutron.conf": {
|
||||
# "sections": {
|
||||
# 'DEFAULT': [
|
||||
# ('key1', 'val1')
|
||||
# ('key2', 'val2')
|
||||
# ],
|
||||
# 'agent': [
|
||||
# ('key3', 'val3')
|
||||
# ],
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
"""
|
||||
conversation = self.conversation()
|
||||
relation_info = {
|
||||
'neutron-plugin': neutron_plugin,
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
flake8>=2.2.4,<=2.4.1
|
||||
os-testr>=0.4.1
|
|
@ -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
|
Loading…
Reference in New Issue