Bringing Anchor project setup inline with OpenStack
- Adding scaffolding for testing (PEP8 mostly disabled for now) - Adding requirments lists Change-Id: I7b585a1e30c473df089ba508099af159e432cc78
This commit is contained in:
parent
8b35b34542
commit
9eada1323e
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,7 +1,6 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
temp-*.crt
|
temp-*.crt
|
||||||
config.cfg
|
config.cfg
|
||||||
ephemeral_ca.egg-info
|
|
||||||
.venv
|
.venv
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
certs/*.crt
|
certs/*.crt
|
||||||
@ -11,3 +10,12 @@ CA/*.crt
|
|||||||
dist/*
|
dist/*
|
||||||
build/*
|
build/*
|
||||||
.tox/*
|
.tox/*
|
||||||
|
.DS_Store
|
||||||
|
*.egg
|
||||||
|
*.egg-info
|
||||||
|
.testrepository
|
||||||
|
build/*
|
||||||
|
cover/*
|
||||||
|
.cover
|
||||||
|
|
||||||
|
|
||||||
|
7
.testr.conf
Normal file
7
.testr.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||||
|
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||||
|
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||||
|
${PYTHON:-python} -m subunit.run discover -t ./ ./tests $LISTOPT $IDOPTION
|
||||||
|
test_id_option=--load-list $IDFILE
|
||||||
|
test_list_option=--list
|
32
README.md
32
README.md
@ -17,37 +17,17 @@ For virtual environment run:
|
|||||||
virtualenv .venv
|
virtualenv .venv
|
||||||
. .venv/bin/activate
|
. .venv/bin/activate
|
||||||
|
|
||||||
Currently Anchor requires a modified varient of M2Crypto, which must be
|
|
||||||
installed manually. Prior to installing M2Crypto, SWIG must be
|
|
||||||
installed if this is not already present on your system. Test with:
|
|
||||||
|
|
||||||
swig
|
|
||||||
|
|
||||||
If this results with 'command not found' or similar, then install swig
|
|
||||||
by downloading from http://www.swig.org/download.html or using your
|
|
||||||
preferred package manager. Download and install the modified M2crypto:
|
|
||||||
|
|
||||||
git clone https://github.com/viraptor/M2Crypto.git
|
|
||||||
cd M2Crypto
|
|
||||||
python setup.py build && python setup.py install
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
Depending on your platform, you may need to add a link between the
|
|
||||||
location of your openssl libraries and the path used by swig:
|
|
||||||
(/usr/include)
|
|
||||||
|
|
||||||
To install a development version of Anchor, run:
|
To install a development version of Anchor, run:
|
||||||
|
|
||||||
pip install -e '.[develop]'
|
python setup.py develop
|
||||||
|
pip install watchdog
|
||||||
|
|
||||||
To install a production version with some authentication backend, run
|
Note that watchdog is needed only when running with the --reload option used
|
||||||
(where `auth_xxx` may be `auth_keystone` and/or `auth_ldap`):
|
later. To install a production version, run:
|
||||||
|
|
||||||
pip install '.[auth_xxx]'
|
python setup.py install
|
||||||
|
|
||||||
The chosen authentication backend is only enabled if it's defined in
|
The config file should be copied from `config.py` with any details updated.
|
||||||
the config file. The config file should be copied from `config.py` with
|
|
||||||
any details updated.
|
|
||||||
|
|
||||||
Anchor requires you to provide a CA signing certificate and private key
|
Anchor requires you to provide a CA signing certificate and private key
|
||||||
which is stored in the CA subdirectory by default (as specified in
|
which is stored in the CA subdirectory by default (as specified in
|
||||||
|
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
cryptography>=0.4
|
||||||
|
pecan>=0.8.0
|
||||||
|
Paste
|
||||||
|
netaddr>=0.7.12
|
||||||
|
|
29
setup.cfg
Normal file
29
setup.cfg
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
[metadata]
|
||||||
|
name = anchor
|
||||||
|
summary = webservice to auto-sign certificates for short amount of time
|
||||||
|
description-file =
|
||||||
|
README.md
|
||||||
|
author = Hewlett Packard
|
||||||
|
author-email = openstack-dev@lists.openstack.org
|
||||||
|
home-page = https://wiki.openstack.org/wiki/Security/Projects/Anchor
|
||||||
|
classifier =
|
||||||
|
Environment :: OpenStack
|
||||||
|
Intended Audience :: Information Technology
|
||||||
|
Intended Audience :: System Administrators
|
||||||
|
Intended Audience :: Developers
|
||||||
|
License :: OSI Approved :: Apache Software License
|
||||||
|
Operating System :: POSIX :: Linux
|
||||||
|
Operating System :: MacOS :: MacOS X
|
||||||
|
Programming Language :: Python
|
||||||
|
Programming Language :: Python :: 2
|
||||||
|
Programming Language :: Python :: 2.7
|
||||||
|
Programming Language :: Python :: 3
|
||||||
|
Programming Language :: Python :: 3.3
|
||||||
|
Topic :: Security
|
||||||
|
|
||||||
|
[files]
|
||||||
|
packages =
|
||||||
|
anchor
|
||||||
|
scripts =
|
||||||
|
bin/anchor_production
|
||||||
|
bin/anchor_debug
|
43
setup.py
43
setup.py
@ -1,27 +1,22 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
from setuptools import setup
|
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||||
|
import setuptools
|
||||||
|
|
||||||
setup(
|
setuptools.setup(
|
||||||
name="anchor",
|
setup_requires=['pbr'],
|
||||||
description="webservice to auto-sign certificates for short amount of time",
|
pbr=True)
|
||||||
version="1.0.0",
|
|
||||||
packages=['anchor'],
|
|
||||||
include_package_data=True,
|
|
||||||
install_requires=[
|
|
||||||
'pecan',
|
|
||||||
'paste',
|
|
||||||
'setuptools>=1.0',
|
|
||||||
'netaddr',
|
|
||||||
],
|
|
||||||
extras_require={
|
|
||||||
'auth_ldap': ['python-ldap'],
|
|
||||||
'auth_keystone': ['requests'],
|
|
||||||
'develop': ['watchdog'],
|
|
||||||
'production': ['uwsgi'],
|
|
||||||
},
|
|
||||||
setup_requires=[
|
|
||||||
'setuptools>=1.0',
|
|
||||||
],
|
|
||||||
zip_safe=False
|
|
||||||
)
|
|
||||||
|
9
test-requirements.txt
Normal file
9
test-requirements.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
coverage>=3.6
|
||||||
|
discover
|
||||||
|
fixtures>=0.3.14
|
||||||
|
hacking>=0.9.2,<0.10
|
||||||
|
python-subunit>=0.0.18
|
||||||
|
testrepository>=0.0.18
|
||||||
|
testscenarios>=0.4
|
||||||
|
testtools>=0.9.34
|
||||||
|
|
15
tests/__init__.py
Normal file
15
tests/__init__.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# 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.
|
31
tests/test_basic.py
Normal file
31
tests/test_basic.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
class BasicTests(unittest.TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(BasicTests, self).setUp()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_testing(self):
|
||||||
|
self.assertTrue(True)
|
35
tox.ini
35
tox.ini
@ -1,11 +1,34 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = pep8
|
minversion = 1.6
|
||||||
|
envlist = py27,py33,pypy,pep8
|
||||||
|
skipsdist = True
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
usedevelop = True
|
||||||
|
install_command = pip install -U {opts} {packages}
|
||||||
|
setenv =
|
||||||
|
VIRTUAL_ENV={envdir}
|
||||||
|
deps = -r{toxinidir}/requirements.txt
|
||||||
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
deps = flake8
|
commands = flake8 {posargs} anchor
|
||||||
sitepackages = False
|
|
||||||
commands = flake8 {posargs}
|
[testenv:venv]
|
||||||
|
commands = {posargs}
|
||||||
|
|
||||||
|
[testenv:cover]
|
||||||
|
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 160
|
# E123, E125 skipped as they are invalid PEP-8.
|
||||||
exclude = .git,.tox,.venv
|
# H303 no wild card imports
|
||||||
|
# F403 unable to detect undefined names
|
||||||
|
# H104 file contains nothing but comments
|
||||||
|
# H302 import only modules
|
||||||
|
|
||||||
|
show-source = True
|
||||||
|
ignore = E123,E125,H303,F403,H104,H302,E501,H301,H305,H405,H404,H306,E226,H904,H307,F401
|
||||||
|
builtins = _
|
||||||
|
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user