Add missing tox.ini and .gitreview

Change-Id: I7892d1699afe921feeb1257fda05e3a4e54a68fb
This commit is contained in:
Mathieu Mitchell 2018-06-26 22:24:38 -04:00
parent dbe5e66513
commit a026003de1
6 changed files with 71 additions and 15 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.tox
*.pyc
build

6
.gitreview Normal file
View File

@ -0,0 +1,6 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/charm-ironic.git
defaultbranch=master

View File

@ -10,11 +10,9 @@ from charmhelpers.core.hookenv import (
relation_get,
relation_ids,
related_units,
unit_get,
log,
INFO,
)
from netaddr import IPNetwork, IPAddress
import constants
import os
import netifaces
@ -51,11 +49,14 @@ class GlanceSwiftBackendContext(context.OSContextGenerator):
for unit in related_units(rid):
ctxt = {
'glance_swift_account':
config('swift-account') or 'AUTH_%s' % identity_ctxt['admin_tenant_id'],
config('swift-account') or
'AUTH_%s' % identity_ctxt['admin_tenant_id'],
'glance_swift_container':
config('swift-container') or relation_get('swift-container', rid=rid, unit=unit),
config('swift-container') or
relation_get('swift-container', rid=rid, unit=unit),
'glance_swift_temp_url_key':
config('swift-temp-url-key') or relation_get('swift-temp-url-key', rid=rid, unit=unit),
config('swift-temp-url-key') or
relation_get('swift-temp-url-key', rid=rid, unit=unit),
'glance_swift_temp_url_duration':
config('swift-temp-url-duration')
}
@ -99,9 +100,10 @@ class NeutronContext(context.OSContextGenerator):
class IronicContext(context.OSContextGenerator):
def __call__(self):
uefi_pxe_bootfile_name = config('uefi-pxe-bootfile-name') or \
'bootx64.efi'
uefi_pxe_config_template = config('uefi-pxe-config-template') or \
uefi_pxe_bootfile_name = \
config('uefi-pxe-bootfile-name') or 'bootx64.efi'
uefi_pxe_config_template = \
config('uefi-pxe-config-template') or \
'$pybasedir/drivers/modules/pxe_grub_config.template'
pxe_bootfile_name = config('pxe-bootfile-name')
@ -141,7 +143,9 @@ class IronicContext(context.OSContextGenerator):
'ipxe_boot_script': ipxe_boot_script,
'uefi_pxe_bootfile_name': uefi_pxe_bootfile_name,
'uefi_pxe_config_template': uefi_pxe_config_template,
'ipa_api_url': "http://{}:{}".format(resolve_address(DEPLOY), constants.API_PORTS['ironic-api'])
'ipa_api_url': "http://{}:{}".format(resolve_address(DEPLOY),
constants.API_PORTS[
'ironic-api'])
}
return ctxt

View File

@ -48,12 +48,11 @@ def resource_map():
database=config('database'),
ssl_dir=constants.IRONIC_CONF_DIR),
context.ImageServiceContext(),
context.IdentityServiceContext(
service='ironic',
service_user='ironic'),
context.IdentityServiceContext(service='ironic',
service_user='ironic'),
NeutronContext(),
context.AMQPContext(
ssl_dir=constants.IRONIC_CONF_DIR),
ssl_dir=constants.IRONIC_CONF_DIR),
IronicContext(),
NginxContext(),
ObjectStoreContext(),
@ -82,8 +81,8 @@ def register_configs():
'''
release = os_release('ironic-common')
configs = templating.OSConfigRenderer(
templates_dir=constants.TEMPLATES_DIR,
openstack_release=release)
templates_dir=constants.TEMPLATES_DIR,
openstack_release=release)
for cfg, d in resource_map().iteritems():
configs.register(cfg, d['contexts'])

1
test-requirements.txt Normal file
View File

@ -0,0 +1 @@
flake8>=2.2.4,<=2.4.1

43
tox.ini Normal file
View File

@ -0,0 +1,43 @@
# Source charm: ./tox.ini
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos.
[tox]
envlist = pep8,py27
skipsdist = True
skip_missing_interpreters = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
TERM=linux
LAYER_PATH={toxinidir}/layers
INTERFACE_PATH={toxinidir}/interfaces
JUJU_REPOSITORY={toxinidir}/build
passenv = http_proxy https_proxy
install_command =
pip install {opts} {packages}
[testenv:build]
basepython = python2.7
commands =
charm-build --log-level DEBUG -o {toxinidir}/build src {posargs}
[testenv:py27]
basepython = python2.7
# Reactive source charms are Python3-only, but a py27 unit test target
# is required by OpenStack Governance. Remove this shim as soon as
# permitted. http://governance.openstack.org/reference/cti/python_cti.html
whitelist_externals = true
commands = true
[testenv:pep8]
basepython = python3.5
deps = -r{toxinidir}/test-requirements.txt
commands = flake8 {posargs} hooks
[testenv:venv]
commands = {posargs}
[flake8]
ignore = E402,E226
exclude = */charmhelpers