Merge remote-tracking branch 'upstream/master' into tox

This commit is contained in:
amitgandhinz 2014-08-07 17:06:06 -04:00
commit 0783c36df9
152 changed files with 1048 additions and 671 deletions

View File

@ -1,5 +1,5 @@
[run]
omit = *cdn/openstack*
omit = *poppy/openstack*
[report]
exclude_lines =

View File

@ -86,7 +86,7 @@ Template::
\n
{{third-party lib imports in human alphabetical order}}
\n
{{cdn imports in human alphabetical order}}
{{poppy imports in human alphabetical order}}
\n
\n
{{begin your code}}
@ -102,9 +102,9 @@ Example::
import eventlet
import cdn.common
from cdn import test
import cdn.storage.cassandra
import poppy.common
from poppy import test
import poppy.storage.cassandra
More Import Examples
@ -112,11 +112,11 @@ More Import Examples
**INCORRECT** ::
import cdn.transport.wsgi as wsgi
import poppy.transport.wsgi as wsgi
**CORRECT** ::
from cdn.transport import wsgi
from poppy.transport import wsgi
Docstrings
----------

View File

@ -1,16 +1,16 @@
CDN
Poppy
=======
Content Delivery Network Management as a Service
CDN Provider Management as a Service
Note: This is a work in progress and is not currently recommended for production use.
What is CDN
What is Poppy
============
Users have come to expect exceptional speed in their applications, websites, and video experiences. Because of this, using a CDN has become standard for companies, no matter their size.
CDN will take all the guess work out of the CDN market for our users. CDN will give them a consistently speedy experience from integrated partners, with an easy to use RESTful API.
Poppy will take all the guess work out of the CDN market for our users. Poppy will give them a consistently speedy experience from integrated partners, with an easy to use RESTful API.
Vendor lock-in to a particular CDN provider is removed by abstracting away the plethora of vendor API's available. This means that a customer only has to integrate with one CDN API, and reap the benefits of using multiple providers.
@ -39,10 +39,10 @@ Features
+ Set Restrictions on who can access cached content
What CDN is not
What Poppy is not
----------------------
CDN does not run its own Edge Cache or POP servers. This is purely a management API to abstract away the myriad of CDN providers on the market.
Poppy does not run its own Edge Cache or POP servers. This is purely a management API to abstract away the myriad of CDN providers on the market.
@ -53,38 +53,38 @@ Getting Started
not all of these steps are required. It is assumed you have `CassandraDB`
installed and running.
1. From your home folder create the ``~/.cdn`` folder and clone the repo::
1. From your home folder create the ``~/.poppy`` folder and clone the repo::
$ cd
$ mkdir .cdn
$ mkdir .poppy
$ git clone https://github.com/rackerlabs/cdn.git
2. Copy the CDN config files to the directory ``~/.cdn``::
2. Copy the Poppy config files to the directory ``~/.poppy``::
$ cp cdn/etc/cdn.conf ~/.cdn/cdn.conf
$ cp cdn/etc/logging.conf ~/.cdn/logging.conf
$ cp poppy/etc/poppy.conf ~/.poppy/poppy.conf
$ cp poppy/etc/logging.conf ~/.poppy/logging.conf
3. Find the ``[drivers:storage:cassandradb]`` section in
``~/.cdn/cdn.conf`` and modify the URI to point
``~/.poppy/poppy.conf`` and modify the URI to point
to your local casssandra cluster::
[drivers:storage:cassandra]
cluster = "localhost"
keyspace = cdn
keyspace = poppy
4. By using cassandra storage plugin, you will need to create the default
keyspace "cdn" on your cassandra host/cluster. So log into cqlsh, do::
keyspace "poppy" on your cassandra host/cluster. So log into cqlsh, do::
cqlsh> CREATE KEYSPACE cdn WITH REPLICATION = { 'class' : 'SimpleStrategy' , 'replication_factor' : 1} ;
cqlsh> CREATE KEYSPACE poppy WITH REPLICATION = { 'class' : 'SimpleStrategy' , 'replication_factor' : 1} ;
5. For logging, find the ``[DEFAULT]`` section in
``~/.cdn/cdn.conf`` and modify as desired::
``~/.poppy/poppy.conf`` and modify as desired::
log_file = server.log
6. Change directories back to your local copy of the repo::
$ cd cdn
$ cd poppy
7. Install general requirements::
@ -93,7 +93,7 @@ installed and running.
Install Requirements for each Provider configured::
$ pip install -r cdn/providers/fastly/requirements.txt
$ pip install -r poppy/providers/fastly/requirements.txt
Run the following so you can see the results of any changes you
make to the code without having to reinstall the package each time::
@ -101,14 +101,11 @@ installed and running.
$ pip install -e .
Installing the fastly client library may have issues. Copy the `README.md` file to `README` and try again.
8. Start the Poppy server::
$ poppy-server
8. Start the CDN server::
$ cdn-server
9. Test out that CDN is working by requesting the home doc (with a sample project ID)::
9. Test out that Poppy is working by requesting the home doc (with a sample project ID)::
$ curl -i -X GET http://0.0.0.0:8888/v1.0/123
@ -129,37 +126,38 @@ Installing Cassandra Locally
Mac OSX
-------
1. Update your Java SDK to the latest version (v7+)
1. Update your Java SDK to the latest version (v7+)::
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
You can check the version currently running with
You can check the version currently running with::
$java -version
2. Follow the instructions on the datastax site to install cassandra for Mac OSX
2. Follow the instructions on the datastax site to install cassandra for Mac OSX::
http://www.datastax.com/2012/01/working-with-apache-cassandra-on-mac-os-x
3. CREATE KEYSPACE cdn
WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
3. Create a Keyspace with Replication::
3. Import the Cassandra Schema to set up the required tables that CDN will need
CREATE KEYSPACE poppy WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
Open ./cqlsh and import the /cdn/storage/cassandra/schema.cql file
4. Import the Cassandra Schema to set up the required tables that CDN will need::
Open ./cqlsh and import the /poppy/storage/cassandra/schema.cql file
Running tests
-----------------------------
First install the additional requirements:
First install the additional requirements::
$ pip install tox
And then run tests:
And then run tests::
$ tox -e py27
$ tox
.. _`CassandraDB` : http://cassandra.apache.org

View File

@ -1,278 +0,0 @@
# Copyright (c) 2014 Rackspace, Inc.
#
# 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 unittest import TestCase
from stoplight import validation_function, Rule, validate
from stoplight.exceptions import ValidationFailed, ValidationProgrammingError
# TODO(tonytan4ever): We probably want to move this to a
# test helpers library
VALIDATED_STR = 'validated'
@validation_function
def is_upper(z):
"""Simple validation function for testing purposes
that ensures that input is all caps
"""
if z.upper() != z:
raise ValidationFailed('{0} no uppercase'.format(z))
error_count = 0
def abort(code):
global error_count
error_count = error_count + 1
other_vals = dict()
get_other_val = other_vals.get
class DummyRequest(object):
def __init__(self):
self.headers = dict(header1='headervalue1')
class DummyResponse(object):
pass
@validation_function
def is_request(candidate):
if not isinstance(candidate, DummyRequest):
raise ValidationFailed('Input must be a request')
@validation_function
def is_response(candidate):
if not isinstance(candidate, DummyResponse):
raise ValidationFailed('Input must be a response')
RequestRule = Rule(is_request(), lambda: abort(404))
ResponseRule = Rule(is_response(), lambda: abort(404))
UppercaseRule = Rule(is_upper(), lambda: abort(404))
class DummyEndpoint(object):
# This should throw a ValidationProgrammingError
# when called because the user did not actually
# call validate_upper.
# Note: the lambda in this function can never actually be
# called, so we use no cover here
@validate(value=Rule(is_upper, lambda: abort(404))) # pragma: no cover
def get_value_programming_error(self, value):
# This function body should never be
# callable since the validation error
# should not allow it to be called
assert False # pragma: no cover
@validate(
value1=Rule(is_upper(), lambda: abort(404)),
value2=Rule(is_upper(), lambda: abort(404)),
value3=Rule(is_upper(), lambda: abort(404))
) # pragma: no cover
def get_value_happy_path(self, value1, value2, value3):
return value1 + value2 + value3
@validate(
value1=Rule(is_upper(), lambda: abort(404)),
value2=Rule(is_upper(empty_ok=True), lambda: abort(404),
get_other_val),
) # pragma: no cover
def get_value_with_getter(self, value1):
global other_vals
return value1 + other_vals.get('value2')
# Falcon-style endpoint
@validate(
request=Rule(is_request(), lambda: abort(404)),
response=Rule(is_response(), lambda: abort(404)),
value=Rule(is_upper(), lambda: abort(404))
)
def get_falcon_style(self, request, response, value):
return value
# Falcon-style w/ declared rules
@validate(request=RequestRule, response=ResponseRule,
value=UppercaseRule)
def get_falcon_with_declared_rules(self, request, response, value):
return value
class TestValidationFunction(TestCase):
def test_empty_ok(self):
is_upper(empty_ok=True)('')
with self.assertRaises(ValidationFailed):
is_upper()('')
is_upper(none_ok=True)(None)
with self.assertRaises(ValidationFailed):
is_upper()(None)
class TestValidationDecorator(TestCase):
def setUp(self):
self.ep = DummyEndpoint()
def test_programming_error(self):
with self.assertRaises(ValidationProgrammingError):
self.ep.get_value_programming_error('AT_ME')
def test_falcon_style(self):
global error_count
request = DummyRequest()
response = DummyResponse()
# Try to call with missing params. The validation
# function should never get called
oldcount = error_count
self.ep.get_falcon_style(response, 'HELLO')
self.assertEqual(oldcount + 1, error_count)
# Try to pass a string to a positional argument
# where a response is expected
oldcount = error_count
self.ep.get_falcon_style(request, "bogusinput", 'HELLO')
self.assertEqual(oldcount + 1, error_count)
# Pass in as kwvalues with good input but out of
# typical order (should succeed)
oldcount = error_count
self.ep.get_falcon_style(response=response, value='HELLO',
request=request)
self.assertEqual(oldcount, error_count)
# Pass in as kwvalues with good input but out of
# typical order with an invalid value (lower-case 'h')
oldcount = error_count
self.ep.get_falcon_style(response=response, value='hELLO',
request=request)
self.assertEqual(oldcount + 1, error_count)
# Pass in as kwvalues with good input but out of typical order
# and pass an invalid value. Note that here the response is
# assigned to request, etc.
oldcount = error_count
self.ep.get_falcon_style(response=request, value='HELLO',
request=response)
self.assertEqual(oldcount + 1, error_count)
# Happy path
oldcount = error_count
self.ep.get_falcon_style(request, response, 'HELLO')
self.assertEqual(oldcount, error_count)
def test_falcon_style_declared_rules(self):
# The following tests repeat the above
# tests, but this time they test using the
# endpoint with the rules being declared
# separately. See get_falcon_with_declared_rules above
global error_count
request = DummyRequest()
response = DummyResponse()
# Try to call with missing params. The validation
# function should never get called
oldcount = error_count
self.ep.get_falcon_with_declared_rules(response, 'HELLO')
self.assertEqual(oldcount + 1, error_count)
# Try to pass a string to a positional argument
# where a response is expected
oldcount = error_count
self.ep.get_falcon_with_declared_rules(request, "bogusinput", 'HELLO')
self.assertEqual(oldcount + 1, error_count)
# Pass in as kwvalues with good input but out of
# typical order (should succeed)
oldcount = error_count
self.ep.get_falcon_with_declared_rules(
response=response,
value='HELLO',
request=request)
self.assertEqual(oldcount, error_count)
# Pass in as kwvalues with good input but out of
# typical order with an invalid value (lower-case 'h')
oldcount = error_count
self.ep.get_falcon_with_declared_rules(
response=response,
value='hELLO',
request=request)
self.assertEqual(oldcount + 1, error_count)
# Pass in as kwvalues with good input but out of typical order
# and pass an invalid value. Note that here the response is
# assigned to request, etc.
oldcount = error_count
self.ep.get_falcon_with_declared_rules(response=request, value='HELLO',
request=response)
self.assertEqual(oldcount + 1, error_count)
# Happy path
oldcount = error_count
self.ep.get_falcon_with_declared_rules(request, response, 'HELLO')
self.assertEqual(oldcount, error_count)
def test_happy_path_and_validation_failure(self):
global error_count
# Should not throw
res = self.ep.get_value_happy_path('WHATEVER', 'HELLO', 'YES')
self.assertEqual('WHATEVERHELLOYES', res)
# Validation should have failed, and
# we should have seen a tick in the error count
oldcount = error_count
res = self.ep.get_value_happy_path('WHAtEVER', 'HELLO', 'YES')
self.assertEqual(oldcount + 1, error_count)
# Check passing a None value. This decorator does
# not permit none values.
oldcount = error_count
res = self.ep.get_value_happy_path(None, 'HELLO', 'YES')
self.assertEqual(oldcount + 1, error_count)
def test_getter(self):
global other_vals
other_vals['value2'] = 'HELLO'
# Now have our validation actually try to
# get those values
# This should succeed
res = self.ep.get_value_with_getter('TEST')
self.assertEqual('TESTHELLO', res)
# check empty_ok
other_vals['value2'] = ''
res = self.ep.get_value_with_getter('TEST')
self.assertEqual('TEST', res)

246
doc/source/conf.py Normal file
View File

@ -0,0 +1,246 @@
# -*- coding: utf-8 -*-
#
# poppy documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 6 16:54:51 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../../'))
sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, os.path.abspath('./'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.pngmath',
'sphinx.ext.ifconfig',
'sphinx.ext.graphviz',
'oslosphinx',
]
# autodoc generation is a bit aggressive and a nuisance
# when doing heavy text edit cycles. Execute "export SPHINX_DEBUG=1"
# in your terminal to disable
todo_include_todos = True
# Add any paths that contain templates here, relative to this directory.
templates_path = []
if os.getenv('HUDSON_PUBLISH_DOCS'):
templates_path = ['_ga', '_templates']
else:
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Poppy'
copyright = u'2010-present, OpenStack Foundation'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
from poppy.version import version_info
# The full version, including alpha/beta/rc tags.
release = version_info.release_string()
# The short X.Y version.
version = version_info.version_string()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
modindex_common_prefix = ['poppy.']
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'poppydoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'poppy.tex', u'Poppy Documentation',
u'OpenStack Foundation', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'python': ('http://docs.python.org/', None)}

65
doc/source/index.rst Normal file
View File

@ -0,0 +1,65 @@
..
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.
Welcome to Poppy's documentation!
=================================
Poppy is an OpenStack related project to provide a generic and modular vendor-neutral API that wraps provisioning instructions for CDN vendors that support it.
Poppy, as with all OpenStack projects, is written with the following design
guidelines in mind:
* **Component based architecture**: Quickly add new behaviors
* **Highly available**: Scale to very serious workloads
* **Fault tolerant**: Isolated processes avoid cascading failures
* **Recoverable**: Failures should be easy to diagnose, debug, and rectify
* **Open standards**: Be a reference implementation for a community-driven api
This documentation is generated by the Sphinx toolkit and lives in the source
tree. Additional draft and project documentation on Poppy and other components of OpenStack can
be found on the `OpenStack wiki`_. Cloud administrators, refer to `docs.openstack.org`_.
.. _`OpenStack wiki`: http://wiki.openstack.org
.. _`docs.openstack.org`: http://docs.openstack.org
Concepts
========
.. toctree::
:maxdepth: 1
glossary
Installing/Configuring Poppy
============================
.. toctree::
:maxdepth: 1
installing
Operating Poppy
===============
.. toctree::
:maxdepth: 1
ha
Using Poppy
===========
.. toctree::
:maxdepth: 1
api

View File

@ -1,7 +1,7 @@
Building the Cassandra Docker Image
--------------------------------------
From the docker/cassandra-cdn folder:
From the docker/cassandra folder:
$ docker build -t db .
@ -30,5 +30,5 @@ Where local ip is the ip address of your running docker container
Import Schema
---------------
Import the schema file from the cdn/storage/cassandra/schema.cql file.
Import the schema file from the poppy/storage/cassandra/schema.cql file.

View File

@ -1,11 +1,11 @@
##
## CDN API
## Poppy
##
##
# The following files should exist in this folder before running Dockerfile
# - docker_rsa (private key) -> public key should be published to the private git repo
# - cdn.conf (desired configuration for cdn api)
# - poppy.conf (desired configuration for poppy api)
# - logging.conf (desired logging configuration file)
@ -43,28 +43,28 @@ RUN echo "IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config
RUN touch /root/.ssh/known_hosts
# Pull project
RUN git clone git@github.com:rackerlabs/cdn /home/cdn
RUN git clone git@github.com:rackerlabs/cdn /home/poppy
# Install Requirements
RUN sudo pip install -r /home/cdn/requirements/requirements.txt
RUN sudo pip install -r /home/poppy/requirements/requirements.txt
RUN sudo pip install -e /home/cdn/.
RUN sudo pip install -e /home/poppy/.
# Set up the configuration files
ADD ./cdn.conf /etc/cdn.conf
ADD ./poppy.conf /etc/poppy.conf
ADD ./logging.conf /etc/logging.conf
ADD ./uwsgi.ini /root/uwsgi.ini
# create uwsgi log directory
RUN mkdir -p /var/log/cdn
RUN chmod -R +w /var/log/cdn
RUN mkdir -p /var/log/poppy
RUN chmod -R +w /var/log/poppy
# create uwsgi pid directory
RUN mkdir -p /var/run/cdn
RUN chmod -R +w /var/run/cdn
RUN mkdir -p /var/run/poppy
RUN chmod -R +w /var/run/poppy
#RUN /usr/local/bin/uwsgi --ini /root/uwsgi.ini
# Start CDN
# Start Poppy
EXPOSE 80
CMD ["/usr/local/bin/uwsgi", "--ini", "/root/uwsgi.ini"]

View File

@ -14,12 +14,12 @@ handlers=devel
[logger_server]
level=DEBUG
handlers=devel
qualname=cdn-server
qualname=poppy-server
[logger_combined]
level=DEBUG
handlers=devel
qualname=cdn-combined
qualname=poppy-combined
[handler_production]
class=handlers.SysLogHandler
@ -31,7 +31,7 @@ args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
class=FileHandler
level=DEBUG
formatter=normal_with_name
args=('cdn.log', 'w')
args=('poppy.log', 'w')
[handler_devel]
class=StreamHandler

View File

@ -1,6 +1,6 @@
# By default, this should live in one of:
# ~/.cdn/cdn.conf
# /etc/cdn/cdn.conf
# ~/.poppy/poppy.conf
# /etc/poppy/poppy.conf
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
@ -10,7 +10,7 @@
;debug = False
# Log to this file
log_file = cdn.log
log_file = poppy.log
;auth_strategy =
@ -40,14 +40,14 @@ port = 8888
[drivers:storage:mongodb]
uri = mongodb://localhost
database = cdn
database = poppy
[drivers:storage:cassandra]
cluster = "<your-cassandra-server-link-name>"
keyspace = cdn
keyspace = poppy
[drivers:storage:mockdb]
database = cdn
database = poppy
[drivers:provider:fastly]
apikey = "<MYAPIKEY>"

View File

@ -1,14 +1,14 @@
[uwsgi]
master = true
chdir = /home/cdn/
chdir = /home/poppy/
workers = 4
http-socket = 0.0.0.0:80
logger = file:/var/log/cdn/cdn.log
pidfile = /var/run/cdn/cdn.pid
logger = file:/var/log/poppy/poppy.log
pidfile = /var/run/poppy/poppy.pid
die-on-term = true
enable-threads = true
buffer-size = 32768
max-requests = 15000
no-orphans = true
vacuum = true
module = cdn.transport.falcon.app:app
module = poppy.transport.falcon.app:app

View File

@ -14,12 +14,12 @@ handlers=devel
[logger_server]
level=DEBUG
handlers=devel
qualname=cdn-server
qualname=poppy-server
[logger_combined]
level=DEBUG
handlers=devel
qualname=cdn-combined
qualname=poppy-combined
[handler_production]
class=handlers.SysLogHandler
@ -31,7 +31,7 @@ args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
class=FileHandler
level=DEBUG
formatter=normal_with_name
args=('cdn.log', 'w')
args=('poppy.log', 'w')
[handler_devel]
class=StreamHandler

View File

@ -1,6 +1,6 @@
# By default, this should live in one of:
# ~/.cdn/cdn.conf
# /etc/cdn/cdn.conf
# ~/.poppy/poppy.conf
# /etc/poppy/poppy.conf
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
@ -10,7 +10,7 @@
;debug = False
# Log to this file
log_file = cdn.log
log_file = poppy.log
;auth_strategy =
@ -42,14 +42,14 @@ port = 8888
[drivers:storage:mongodb]
uri = mongodb://localhost
database = cdn
database = poppy
[drivers:storage:cassandra]
cluster = "localhost"
keyspace = cdn
keyspace = poppy
[drivers:storage:mockdb]
database = cdn
database = poppy
[drivers:provider:fastly]
apikey = "MYAPIKEY"

View File

@ -1,5 +1,10 @@
[DEFAULT]
base=cdn
modules=context
modules=local
modules=log
base=poppy
module=context
module=gettextutils
module=importutils
module=jsonutils
module=local
module=log
module=strutils
module=timeutils

View File

@ -13,11 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cdn.common import decorators
from cdn.openstack.common import log
from oslo.config import cfg
from stevedore import driver, extension
from poppy.common import decorators
from poppy.openstack.common import log
LOG = log.getLogger(__name__)
@ -47,7 +48,7 @@ class Bootstrap(object):
self.conf.register_opts(_DRIVER_OPTIONS, group=_DRIVER_GROUP)
self.driver_conf = self.conf[_DRIVER_GROUP]
log.setup('cdn')
log.setup('poppy')
LOG.debug("init bootstrap")
@ -56,7 +57,7 @@ class Bootstrap(object):
LOG.debug((u'Loading provider extension(s)'))
# create the driver manager to load the appropriate drivers
provider_type = 'cdn.provider'
provider_type = 'poppy.provider'
args = [self.conf]
mgr = extension.ExtensionManager(namespace=provider_type,
@ -69,7 +70,7 @@ class Bootstrap(object):
LOG.debug((u'Loading storage driver'))
# create the driver manager to load the appropriate drivers
storage_type = 'cdn.storage'
storage_type = 'poppy.storage'
storage_name = self.driver_conf.storage
args = [self.conf]
@ -88,7 +89,7 @@ class Bootstrap(object):
LOG.debug((u'Loading manager driver'))
# create the driver manager to load the appropriate drivers
manager_type = 'cdn.manager'
manager_type = 'poppy.manager'
manager_name = self.driver_conf.manager
args = [self.conf, self.storage, self.provider]
@ -107,7 +108,7 @@ class Bootstrap(object):
LOG.debug("loading transport")
# create the driver manager to load the appropriate drivers
transport_type = 'cdn.transport'
transport_type = 'poppy.transport'
transport_name = self.driver_conf.transport
args = [self.conf, self.manager]

View File

@ -13,10 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cdn import bootstrap
from cdn.common import cli
from oslo.config import cfg
from poppy import bootstrap
from poppy.common import cli
@cli.runnable
def run():
@ -24,7 +25,7 @@ def run():
# to pick up common options from openstack.common.log, since
# that module uses the global CONF instance exclusively.
conf = cfg.CONF
conf(project='cdn', prog='cdn')
conf(project='poppy', prog='poppy')
server = bootstrap.Bootstrap(conf)
server.run()

View File

@ -20,8 +20,8 @@ import os
import sys
import termios
from cdn.openstack.common.gettextutils import _
from cdn.openstack.common import log as logging
from poppy.openstack.common.gettextutils import _
from poppy.openstack.common import log as logging
LOG = logging.getLogger(__name__)
@ -72,7 +72,7 @@ def runnable(func):
_enable_echo(False)
try:
logging.setup('cdn')
logging.setup('poppy')
func()
except KeyboardInterrupt:
LOG.info(_(u'Terminating'))

View File

@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cdn.manager.base import driver
from cdn.manager.base import services
from cdn.manager.base import v1
from poppy.manager.base import driver
from poppy.manager.base import services
from poppy.manager.base import v1
Driver = driver.ManagerDriverBase

View File

@ -16,8 +16,8 @@
import abc
import six
from cdn.manager.base import controller
from cdn.manager.base import providers
from poppy.manager.base import controller
from poppy.manager.base import providers
@six.add_metaclass(abc.ABCMeta)

View File

@ -16,7 +16,7 @@
import abc
import six
from cdn.manager.base import controller
from poppy.manager.base import controller
@six.add_metaclass(abc.ABCMeta)

View File

@ -15,7 +15,7 @@
"""Default Manager Driver"""
from cdn.manager.default import driver
from poppy.manager.default import driver
# Hoist classes into package namespace

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cdn.manager.default import services, v1
from poppy.manager.default import services, v1
Services = services.DefaultServicesController

View File

@ -15,9 +15,9 @@
"""Default manager driver implementation."""
from cdn.common import decorators
from cdn.manager import base
from cdn.manager.default import controllers
from poppy.common import decorators
from poppy.manager import base
from poppy.manager.default import controllers
class DefaultManagerDriver(base.Driver):

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cdn.manager import base
from poppy.manager import base
class DefaultServicesController(base.ServicesController):

View File

@ -13,11 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cdn.manager import base
from poppy.manager import base
JSON_HOME = {
"resources": {
"rel/cdn": {
"rel/poppy": {
"href-template": "services{?marker,limit}",
"href-vars": {
"marker": "param/marker",

View File

@ -19,7 +19,7 @@ gettext for openstack-common modules.
Usual usage in an openstack.common module:
from cdn.openstack.common.gettextutils import _
from poppy.openstack.common.gettextutils import _
"""
import copy
@ -121,7 +121,7 @@ class TranslatorFactory(object):
# module within each application.
# Create the global translation functions.
_translators = TranslatorFactory('cdn')
_translators = TranslatorFactory('poppy')
# The primary translation function using the well-known name "_"
_ = _translators.primary
@ -182,7 +182,7 @@ class Message(six.text_type):
"""
def __new__(cls, msgid, msgtext=None, params=None,
domain='cdn', *args):
domain='poppy', *args):
"""Create a new Message object.
In order for translation to work gettext requires a message ID, this

View File

@ -59,7 +59,7 @@ def import_module(import_str):
def import_versioned_module(version, submodule=None):
module = 'cdn.v%s' % version
module = 'poppy.v%s' % version
if submodule:
module = '.'.join((module, submodule))
return import_module(module)

View File

@ -51,10 +51,10 @@ else:
import six
import six.moves.xmlrpc_client as xmlrpclib
from cdn.openstack.common import gettextutils
from cdn.openstack.common import importutils
from cdn.openstack.common import strutils
from cdn.openstack.common import timeutils
from poppy.openstack.common import gettextutils
from poppy.openstack.common import importutils
from poppy.openstack.common import strutils
from poppy.openstack.common import timeutils
netaddr = importutils.try_import("netaddr")

View File

@ -40,13 +40,15 @@ from oslo.config import cfg
import six
from six import moves
from cdn.openstack.common.gettextutils import _
from cdn.openstack.common import importutils
from cdn.openstack.common import jsonutils
from cdn.openstack.common import local
_PY26 = sys.version_info[0:2] == (2, 6)
from poppy.openstack.common.gettextutils import _
from poppy.openstack.common import importutils
from poppy.openstack.common import jsonutils
from poppy.openstack.common import local
# NOTE(flaper87): Pls, remove when graduating this module
# from the incubator.
from cdn.openstack.common.strutils import mask_password # noqa
from poppy.openstack.common.strutils import mask_password # noqa
_DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
@ -227,6 +229,15 @@ class BaseLoggerAdapter(logging.LoggerAdapter):
def audit(self, msg, *args, **kwargs):
self.log(logging.AUDIT, msg, *args, **kwargs)
def isEnabledFor(self, level):
if _PY26:
# This method was added in python 2.7 (and it does the exact
# same logic, so we need to do the exact same logic so that
# python 2.6 has this capability as well).
return self.logger.isEnabledFor(level)
else:
return super(BaseLoggerAdapter, self).isEnabledFor(level)
class LazyAdapter(BaseLoggerAdapter):
def __init__(self, name='unknown', version='unknown'):
@ -502,7 +513,7 @@ def _setup_logging_from_conf(project, version):
if CONF.publish_errors:
try:
handler = importutils.import_object(
"cdn.openstack.common.log_handler.PublishErrorsHandler",
"poppy.openstack.common.log_handler.PublishErrorsHandler",
logging.ERROR)
except ImportError:
handler = importutils.import_object(

View File

@ -24,7 +24,7 @@ import unicodedata
import six
from cdn.openstack.common.gettextutils import _
from poppy.openstack.common.gettextutils import _
UNIT_PREFIX_EXPONENT = {

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cdn.provider.base import driver
from cdn.provider.base import services
from poppy.provider.base import driver
from poppy.provider.base import services
Driver = driver.ProviderDriverBase

View File

@ -16,8 +16,8 @@
import abc
import six
from cdn.provider.base import controller
from cdn.provider.base import responder
from poppy.provider.base import controller
from poppy.provider.base import responder
@six.add_metaclass(abc.ABCMeta)

View File

@ -1,6 +1,6 @@
"""Fastly CDN Extension for CDN"""
from cdn.provider.fastly import driver
from poppy.provider.fastly import driver
# Hoist classes into package namespace
Driver = driver.CDNProvider

View File

@ -22,6 +22,6 @@ Field Mappings:
updated and documented in each controller class.
"""
from cdn.provider.fastly import services
from poppy.provider.fastly import services
ServiceController = services.ServiceController

View File

@ -15,9 +15,9 @@
"""Fastly CDN Provider implementation."""
from cdn.openstack.common import log as logging
from cdn.provider import base
from cdn.provider.fastly import controllers
from poppy.openstack.common import log as logging
from poppy.provider import base
from poppy.provider.fastly import controllers
from oslo.config import cfg

View File

@ -15,7 +15,7 @@
import fastly
from cdn.provider import base
from poppy.provider import base
class ServiceController(base.ServiceBase):

View File

@ -1,6 +1,6 @@
"""CDN Extension for CDN"""
from cdn.provider.mock import driver
from poppy.provider.mock import driver
# Hoist classes into package namespace
Driver = driver.CDNProvider

View File

@ -22,6 +22,6 @@ Field Mappings:
updated and documented in each controller class.
"""
from cdn.provider.mock import services
from poppy.provider.mock import services
ServiceController = services.ServiceController

View File

@ -15,9 +15,9 @@
"""CDN Provider implementation."""
from cdn.openstack.common import log as logging
from cdn.provider import base
from cdn.provider.mock import controllers
from poppy.openstack.common import log as logging
from poppy.provider import base
from poppy.provider.mock import controllers
LOG = logging.getLogger(__name__)

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cdn.provider import base
from poppy.provider import base
class ServiceController(base.ServiceBase):

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cdn.storage.base import driver
from cdn.storage.base import services
from poppy.storage.base import driver
from poppy.storage.base import services
Driver = driver.StorageDriverBase

View File

@ -16,7 +16,7 @@
import abc
import six
from cdn.storage.base import controller
from poppy.storage.base import controller
@six.add_metaclass(abc.ABCMeta)

View File

@ -1,6 +1,6 @@
"""MongoDB Storage Driver for CDN"""
from cdn.storage.cassandra import driver
from poppy.storage.cassandra import driver
# Hoist classes into package namespace
Driver = driver.CassandraStorageDriver

View File

@ -23,6 +23,6 @@ Field Mappings:
updated and documented in each controller class.
"""
from cdn.storage.cassandra import services
from poppy.storage.cassandra import services
ServicesController = services.ServicesController

View File

@ -17,10 +17,10 @@
from cassandra.cluster import Cluster
from cdn.common import decorators
from cdn.openstack.common import log as logging
from cdn.storage import base
from cdn.storage.cassandra import controllers
from poppy.common import decorators
from poppy.openstack.common import log as logging
from poppy.storage import base
from poppy.storage.cassandra import controllers
from oslo.config import cfg
@ -28,7 +28,7 @@ LOG = logging.getLogger(__name__)
CASSANDRA_OPTIONS = [
cfg.ListOpt('cluster', help='Cassandra Cluster contact points'),
cfg.StrOpt('keyspace', default='cdn',
cfg.StrOpt('keyspace', default='poppy',
help='Keyspace for all queries made in session'),
]

View File

@ -1,5 +1,5 @@
CREATE KEYSPACE cdn WITH REPLICATION = { 'class' : 'SimpleStrategy' , 'replication_factor' : 1} ;
USE cdn;
CREATE KEYSPACE poppy WITH REPLICATION = { 'class' : 'SimpleStrategy' , 'replication_factor' : 1} ;
USE poppy;
CREATE TABLE services (
project_id VARCHAR,

View File

@ -15,7 +15,7 @@
import json
from cdn.storage import base
from poppy.storage import base
CQL_GET_ALL_SERVICES = '''
SELECT project_id,

View File

@ -1,6 +1,6 @@
"""Storage Driver for CDN"""
from cdn.storage.mockdb import driver
from poppy.storage.mockdb import driver
# Hoist classes into package namespace
Driver = driver.MockDBStorageDriver

View File

@ -23,6 +23,6 @@ Field Mappings:
updated and documented in each controller class.
"""
from cdn.storage.mockdb import services
from poppy.storage.mockdb import services
ServicesController = services.ServicesController

View File

@ -15,17 +15,17 @@
"""Storage driver implementation."""
from cdn.common import decorators
from cdn.openstack.common import log as logging
from cdn.storage import base
from cdn.storage.mockdb import controllers
from poppy.common import decorators
from poppy.openstack.common import log as logging
from poppy.storage import base
from poppy.storage.mockdb import controllers
from oslo.config import cfg
LOG = logging.getLogger(__name__)
MOCKDB_OPTIONS = [
cfg.StrOpt('database', default='cdn',
cfg.StrOpt('database', default='poppy',
help='Database for all queries made in session')
]

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from cdn.storage import base
from poppy.storage import base
class ServicesController(base.ServicesController):

View File

@ -1,6 +1,6 @@
"""MongoDB Storage Driver for CDN"""
from cdn.storage.mongodb import driver
from poppy.storage.mongodb import driver
# Hoist classes into package namespace
Driver = driver.MongoDBStorageDriver

View File

@ -22,6 +22,6 @@ Field Mappings:
updated and documented in each controller class.
"""
from cdn.storage.mongodb import services
from poppy.storage.mongodb import services
ServicesController = services.ServicesController

View File

@ -18,10 +18,10 @@
import pymongo
import pymongo.errors
from cdn.common import decorators
from cdn.openstack.common import log as logging
from cdn.storage import base
from cdn.storage.mongodb import controllers
from poppy.common import decorators
from poppy.openstack.common import log as logging
from poppy.storage import base
from poppy.storage.mongodb import controllers
from oslo.config import cfg
@ -33,7 +33,7 @@ MONGODB_OPTIONS = [
# Database name
# TODO(kgriffs): Consider local sharding across DBs to mitigate
# per-DB locking latency.
cfg.StrOpt('database', default='cdn', help='Database name'),
cfg.StrOpt('database', default='poppy', help='Database name'),
cfg.IntOpt('max_attempts', default=1000,
help=('Maximum number of times to retry a failed operation.'

View File

@ -14,7 +14,7 @@
# limitations under the License.
# stevedore/example/simple.py
from cdn.storage import base
from poppy.storage import base
class ServicesController(base.ServicesController):

View File

@ -15,7 +15,7 @@
"""CDN Transport Drivers"""
from cdn.transport import base
from poppy.transport import base
# Hoist into package namespace

View File

@ -18,7 +18,7 @@
This app should be used by external WSGI
containers. For example:
$ gunicorn cdn.transport.app:app
$ gunicorn poppy.transport.app:app
NOTE: As for external containers, it is necessary
to put config files in the standard paths. There's
@ -28,10 +28,10 @@ to the WSGI app when it is called from other apps.
from oslo.config import cfg
from cdn import bootstrap
from poppy import bootstrap
conf = cfg.CONF
conf(project='cdn', prog='cdn', args=[])
conf(project='poppy', prog='poppy', args=[])
app = bootstrap.Bootstrap(conf).transport.app

View File

@ -1,6 +1,6 @@
"""Falcon Transport Driver"""
from cdn.transport.falcon import driver
from poppy.transport.falcon import driver
# Hoist into package namespace
Driver = driver.TransportDriver

View File

@ -18,7 +18,7 @@
This app should be used by external WSGI
containers. For example:
$ gunicorn cdn.transport.falcon.app:app
$ gunicorn poppy.transport.falcon.app:app
NOTE: As for external containers, it is necessary
to put config files in the standard paths. There's
@ -26,10 +26,11 @@ no common way to specify / pass configuration files
to the WSGI app when it is called from other apps.
"""
from cdn import bootstrap
from oslo.config import cfg
from poppy import bootstrap
conf = cfg.CONF
conf(project='cdn', prog='cdn', args=[])
conf(project='poppy', prog='poppy', args=[])
app = bootstrap.Bootstrap(conf).transport.app

View File

@ -20,9 +20,9 @@ import falcon
from oslo.config import cfg
import six
import cdn.openstack.common.log as logging
from cdn import transport
from cdn.transport.falcon import (
import poppy.openstack.common.log as logging
from poppy import transport
from poppy.transport.falcon import (
v1, services
)

View File

@ -19,7 +19,7 @@ import json
# NOTE(amitgandhinz): http://tools.ietf.org/html/draft-nottingham-json-home-03
JSON_HOME = {
"resources": {
"rel/cdn": {
"rel/poppy": {
"href-template": "services{?marker,limit}",
"href-vars": {
"marker": "param/marker",

View File

@ -15,7 +15,7 @@
"""Pecan Transport Driver"""
from cdn.transport.pecan import driver
from poppy.transport.pecan import driver
# Hoist into package namespace

View File

@ -15,9 +15,9 @@
"""Pecan Controllers"""
from cdn.transport.pecan.controllers import root
from cdn.transport.pecan.controllers import services
from cdn.transport.pecan.controllers import v1
from poppy.transport.pecan.controllers import root
from poppy.transport.pecan.controllers import services
from poppy.transport.pecan.controllers import v1
# Hoist into package namespace

Some files were not shown because too many files have changed in this diff Show More