Doc generation

Change-Id: I63fc5a45ccd08e5d43eaa135222b59498aa1e39e
This commit is contained in:
Anthony Michon 2015-05-13 11:05:18 +02:00
parent f10c0df6cb
commit 6827bdb48d
13 changed files with 478 additions and 48 deletions

51
.gitignore vendored Normal file
View File

@ -0,0 +1,51 @@
*.py[cod]
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
.testrepository
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Complexity
output/*.html
output/*/index.html
# Sphinx
doc/build
# pbr generates these
AUTHORS
ChangeLog
# Editors
*~
.*.swp
.*sw?
.idea

View File

@ -3,7 +3,7 @@
# 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
# 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,
@ -15,30 +15,72 @@
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ----------------------------------------------------
# -- 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 coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
#'sphinx.ext.intersphinx',
'oslosphinx'
'sphinx.ext.graphviz',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'wsmeext.sphinxext',
'sphinxcontrib.pecanwsme.rest',
'sphinxcontrib.httpdomain',
'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
wsme_protocols = ['restjson', 'restxml']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'sticks'
copyright = u'2013, OpenStack Foundation'
copyright = u'2015, Eurogiciel'
# 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.
#
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1'
# 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
@ -47,29 +89,179 @@ add_function_parentheses = True
# 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'
# -- Options for HTML output --------------------------------------------------
# A list of ignored prefixes for module index sorting.
modindex_common_prefix = ['sticks.']
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
# html_theme_path = ["."]
# html_theme = '_theme'
# html_static_path = ['static']
# 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 = ['_static']
# 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 = '%sdoc' % project
htmlhelp_basename = 'sticksdoc'
# -- 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]).
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index',
'%s.tex' % project,
u'%s Documentation' % project,
u'OpenStack Foundation', 'manual'),
('index', 'sticks.tex', u'sticks Documentation',
u'Eurogiciel', 'manual'),
]
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None}
# 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
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'sticks', u'sticks Documentation',
[u'Eurogiciel'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'sticks', u'sticks Documentation',
u'Eurogiciel', 'sticks', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

View File

@ -1,4 +1,4 @@
============
Contributing
============
.. include:: ../../CONTRIBUTING.rst
.. include:: ../../CONTRIBUTING.rst

View File

@ -0,0 +1,5 @@
digraph "Sticks's Architecture" {
}

View File

@ -1,25 +1,48 @@
.. sticks documentation master file, created by
sphinx-quickstart on Tue Jul 9 22:26:36 2013.
sphinx-quickstart on Wed May 14 23:05:42 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to sticks's documentation!
========================================================
==============================================
Welcome to Sticks's developer documentation!
==============================================
Contents:
Introduction
============
Sticks is a Security As A Service project aimed at integrating security tools
inside Openstack.
Installation
============
.. toctree::
:maxdepth: 2
:maxdepth: 1
readme
installation
usage
contributing
Architecture
============
.. toctree::
:maxdepth: 1
arch
API References
==============
.. toctree::
:maxdepth: 1
webapi/root
webapi/v1
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -1,12 +1,130 @@
============
Installation
============
#######################################
Sticks installation and configuration
#######################################
At the command line::
$ pip install sticks
Install from source
===================
Or, if you have virtualenvwrapper installed::
There is no release of Sticks as of now, the installation can be done from
the git repository.
$ mkvirtualenv sticks
$ pip install sticks
Retrieve and install Sticks :
::
git clone git://git.openstack.org/stackforge/sticks
cd sticks
python setup.py install
This procedure installs the ``sticks`` python library and a few
executables:
* ``sticks-api``: API service
Install a sample configuration file :
::
mkdir /etc/sticks
cp etc/sticks/sticks.conf.sample /etc/sticks/sticks.conf
Configure Sticks
==================
Edit :file:`/etc/sticks/sticks.conf` to configure Sticks.
The following shows the basic configuration items:
.. code-block:: ini
[DEFAULT]
verbose = True
log_dir = /var/log/sticks
rabbit_host = RABBIT_HOST
rabbit_userid = openstack
rabbit_password = RABBIT_PASSWORD
# Class of tracking plugin, ie redmine, trac, etc.
#tracking_plugin=
# Name of sticks role (default: sticks)
#sticks_role_name=sticks
[auth]
username = sticks
password = STICKS_PASSWORD
tenant = service
region = RegionOne
url = http://localhost:5000/v2.0
[keystone_authtoken]
username = sticks
password = STICKS_PASSWORD
project_name = service
region = RegionOne
auth_url = http://localhost:5000/v2.0
auth_plugin = password
[database]
connection = mysql://sticks:STICKS_DBPASS@localhost/sticks
DEFAULT]
Setup the database and storage backend
======================================
MySQL/MariaDB is the recommended database engine. To setup the database, use
the ``mysql`` client:
::
mysql -uroot -p << EOF
CREATE DATABASE sticks;
GRANT ALL PRIVILEGES ON sticks.* TO 'sticks'@'localhost' IDENTIFIED BY 'STICKS_DBPASS';
EOF
Run the database synchronisation scripts:
::
sticks-dbsync upgrade
Init the storage backend:
::
sticks-storage-init
Setup Keystone
==============
Sticks uses Keystone for authentication.
To integrate Sticks to Keystone, run the following commands (as OpenStack
administrator):
::
keystone user-create --name sticks --pass STICKS_PASS
keystone user-role-add --user sticks --role admin --tenant service
Create the ``Helpdesk`` service and its endpoints:
::
keystone service-create --name Sticks --type helpdesk
keystone endpoint-create --service-id SECURITY_SERVICE_ID \
--publicurl http://localhost:8888 \
--adminurl http://localhost:8888 \
--internalurl http://localhost:8888
Start Sticks
==============
Start the API service :
::
sticks-api --config-file /etc/sticks/sticks.conf

View File

@ -1 +1 @@
.. include:: ../../README.rst
.. include:: ../../README.rst

View File

@ -4,4 +4,4 @@ Usage
To use sticks in a project::
import sticks
import sticks

View File

@ -0,0 +1,16 @@
========================
Sticks REST API (root)
========================
.. rest-controller:: sticks.api.root:RootController
:webprefix: / /
.. Dirty hack till the bug is fixed so we can specify root path
.. autotype:: sticks.api.root.APILink
:members:
.. autotype:: sticks.api.root.APIMediaType
:members:
.. autotype:: sticks.api.root.APIVersion
:members:

16
doc/source/webapi/v1.rst Normal file
View File

@ -0,0 +1,16 @@
======================
Sticks REST API (v1)
======================
Tickets
=======
.. rest-controller:: sticks.api.v1.controllers.ticket:TicketsController
:webprefix: /v1/tickets
.. autotype:: sticks.api.v1.datamodels.ticket.TicketResource
:members:
.. autotype:: sticks.api.v1.datamodels.ticket.TicketResourceCollection
:members:

View File

@ -53,10 +53,12 @@ class TicketsController(rest.RestController):
@pecan.expose()
def put(self):
""" Modify a ticket """
core.response.status = 204
return
@pecan.expose()
def delete(self):
""" Delete a ticket """
core.response.status = 200
return

View File

@ -44,6 +44,12 @@ class TicketResource(base.Base):
return self.as_dict_from_keys(['title', 'id', 'project', 'start_date',
'status'])
@classmethod
def sample(cls):
sample = cls(project='test_project',
title='Ticket incident')
return sample
class TicketResourceCollection(base.Base):
"""A list of Tickets."""

View File

@ -16,6 +16,7 @@ nose
nose-exclude
nosexcover
# Doc requirements
sphinx>=1.1.2,<1.1.999
sphinxcontrib-pecanwsme>=0.6,<=0.8.0
oslosphinx<=2.5.0
sphinx>=1.1.2,!=1.2.0,<1.3
oslosphinx
sphinxcontrib-httpdomain
sphinxcontrib-pecanwsme>=0.8