You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/08/01 20:30:13 UTC
[01/22] git commit: ignore the sphinx build directory
Updated Branches:
refs/heads/0.13.x 87e49260b -> ee54c26e0
ignore the sphinx build directory
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5198be7d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5198be7d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5198be7d
Branch: refs/heads/0.13.x
Commit: 5198be7db6932b092d95155da30a07cf482318f7
Parents: 6e78752
Author: Alex Gaynor <al...@gmail.com>
Authored: Wed Jul 31 12:18:46 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:47 2013 +0200
----------------------------------------------------------------------
.gitignore | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/5198be7d/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 0bc25c1..ef56c2e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ MANIFEST
coverage_html_report/
.idea
dist/*apache-libcloud*
+_build/
[17/22] git commit: Add download_pricing_file function to
libcloud.pricing module.
Posted by to...@apache.org.
Add download_pricing_file function to libcloud.pricing module.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/11db7375
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/11db7375
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/11db7375
Branch: refs/heads/0.13.x
Commit: 11db73751bfa956bbd484ba0d9f6b72213ae453d
Parents: b1a0214
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Wed Jul 31 19:48:01 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:49 2013 +0200
----------------------------------------------------------------------
libcloud/pricing.py | 61 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 59 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/11db7375/libcloud/pricing.py
----------------------------------------------------------------------
diff --git a/libcloud/pricing.py b/libcloud/pricing.py
index db3b674..6e5befe 100644
--- a/libcloud/pricing.py
+++ b/libcloud/pricing.py
@@ -13,17 +13,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import with_statement
+
"""
A class which handles loading the pricing files.
"""
+import os.path
+from os.path import join as pjoin
+
try:
import simplejson as json
except ImportError:
import json
-import os.path
-from os.path import join as pjoin
+from libcloud.utils.connection import get_response_object
+
+__all__ = [
+ 'get_pricing',
+ 'get_size_price',
+ 'set_pricing',
+ 'clear_pricing_data',
+ 'download_pricing_file'
+]
+
+# Default URL to the pricing file
+DEFAULT_FILE_URL = 'https://git-wip-us.apache.org/repos/asf?p=libcloud.git;a=blob_plain;f=libcloud/data/pricing.json'
CURRENT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
DEFAULT_PRICING_FILE_PATH = pjoin(CURRENT_DIRECTORY, 'data/pricing.json')
@@ -157,3 +171,46 @@ def invalidate_module_pricing_cache(driver_type, driver_name):
"""
if driver_name in PRICING_DATA[driver_type]:
del PRICING_DATA[driver_type][driver_name]
+
+
+def download_pricing_file(file_url=DEFAULT_FILE_URL,
+ file_path=CUSTOM_PRICING_FILE_PATH):
+ """
+ Download pricing file from the file_url and save it to file_path.
+
+ @type file_url: C{str}
+ @param file_url: URL pointing to the pricing file.
+
+ @type file_path: C{str}
+ @param file_path: Path where a download pricing file will be saved.
+ """
+ dir_name = os.path.dirname(file_path)
+
+ if not os.path.exists(dir_name):
+ # Verify a valid path is provided
+ msg = ('Can\'t write to %s, directory %s, doesn\'t exist' %
+ (file_path, dir_name))
+ raise ValueError(msg)
+
+ if os.path.exists(file_path) and os.path.isdir(file_path):
+ msg = ('Can\'t write to %s file path because it\'s a'
+ ' directory' % (file_path))
+ raise ValueError(msg)
+
+ response = get_response_object(file_url)
+ body = response.body
+
+ # Verify pricing file is valid
+ try:
+ data = json.loads(body)
+ except json.decoder.JSONDecodeError:
+ msg = 'Provided URL doesn\'t contain valid pricing data'
+ raise Exception(msg)
+
+ if not data.get('updated', None):
+ msg = 'Provided URL doesn\'t contain valid pricing data'
+ raise Exception(msg)
+
+ # No need to stream it since file is small
+ with open(file_path, 'w') as file_handle:
+ file_handle.write(body)
[02/22] git commit: Added the boilerplate stuff for sphinx docs
Posted by to...@apache.org.
Added the boilerplate stuff for sphinx docs
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6e787527
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6e787527
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6e787527
Branch: refs/heads/0.13.x
Commit: 6e7875276d0d35ab0f6de78bcd01daf0f53fdc74
Parents: 87e4926
Author: Alex Gaynor <al...@gmail.com>
Authored: Wed Jul 31 12:17:35 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:47 2013 +0200
----------------------------------------------------------------------
docs/Makefile | 153 ++++++++++++++++++++++++++++++++
docs/conf.py | 246 ++++++++++++++++++++++++++++++++++++++++++++++++++++
docs/index.rst | 7 ++
docs/make.bat | 190 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 596 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/6e787527/docs/Makefile
----------------------------------------------------------------------
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 0000000..3d1de36
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,153 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ -rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ApacheLibcloud.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ApacheLibcloud.qhc"
+
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/ApacheLibcloud"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ApacheLibcloud"
+ @echo "# devhelp"
+
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
http://git-wip-us.apache.org/repos/asf/libcloud/blob/6e787527/docs/conf.py
----------------------------------------------------------------------
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..fd2ab34
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,246 @@
+# -*- coding: utf-8 -*-
+#
+# Apache Libcloud documentation build configuration file, created by
+# sphinx-quickstart on Wed Jul 31 12:16:27 2013.
+#
+# 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, 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('.'))
+
+# -- 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']
+
+# 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'Apache Libcloud'
+copyright = u'2013, The Apache Software 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.
+#
+# The short X.Y version.
+version = '0.14.0'
+# The full version, including alpha/beta/rc tags.
+release = '0.14.0-dev'
+
+# 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 = ['_build']
+
+# 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 = []
+
+
+# -- 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']
+
+# 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 = 'ApacheLibclouddoc'
+
+
+# -- 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]).
+latex_documents = [
+ ('index', 'ApacheLibcloud.tex', u'Apache Libcloud Documentation',
+ u'The Apache Software 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
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ ('index', 'apachelibcloud', u'Apache Libcloud Documentation',
+ [u'The Apache Software Foundation'], 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', 'ApacheLibcloud', u'Apache Libcloud Documentation',
+ u'The Apache Software Foundation', 'ApacheLibcloud', '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'
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/': None}
http://git-wip-us.apache.org/repos/asf/libcloud/blob/6e787527/docs/index.rst
----------------------------------------------------------------------
diff --git a/docs/index.rst b/docs/index.rst
new file mode 100644
index 0000000..4675c85
--- /dev/null
+++ b/docs/index.rst
@@ -0,0 +1,7 @@
+Welcome to Apache Libcloud's documentation!
+===========================================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
http://git-wip-us.apache.org/repos/asf/libcloud/blob/6e787527/docs/make.bat
----------------------------------------------------------------------
diff --git a/docs/make.bat b/docs/make.bat
new file mode 100644
index 0000000..ee239c9
--- /dev/null
+++ b/docs/make.bat
@@ -0,0 +1,190 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+ set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+ :help
+ echo.Please use `make ^<target^>` where ^<target^> is one of
+ echo. html to make standalone HTML files
+ echo. dirhtml to make HTML files named index.html in directories
+ echo. singlehtml to make a single large HTML file
+ echo. pickle to make pickle files
+ echo. json to make JSON files
+ echo. htmlhelp to make HTML files and a HTML help project
+ echo. qthelp to make HTML files and a qthelp project
+ echo. devhelp to make HTML files and a Devhelp project
+ echo. epub to make an epub
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. text to make text files
+ echo. man to make manual pages
+ echo. texinfo to make Texinfo files
+ echo. gettext to make PO message catalogs
+ echo. changes to make an overview over all changed/added/deprecated items
+ echo. linkcheck to check all external links for integrity
+ echo. doctest to run all doctests embedded in the documentation if enabled
+ goto end
+)
+
+if "%1" == "clean" (
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+ del /q /s %BUILDDIR%\*
+ goto end
+)
+
+if "%1" == "html" (
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+ goto end
+)
+
+if "%1" == "dirhtml" (
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+ goto end
+)
+
+if "%1" == "singlehtml" (
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+ goto end
+)
+
+if "%1" == "pickle" (
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the pickle files.
+ goto end
+)
+
+if "%1" == "json" (
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the JSON files.
+ goto end
+)
+
+if "%1" == "htmlhelp" (
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+ goto end
+)
+
+if "%1" == "qthelp" (
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\ApacheLibcloud.qhcp
+ echo.To view the help file:
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\ApacheLibcloud.ghc
+ goto end
+)
+
+if "%1" == "devhelp" (
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished.
+ goto end
+)
+
+if "%1" == "epub" (
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
+ goto end
+)
+
+if "%1" == "latex" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "text" (
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The text files are in %BUILDDIR%/text.
+ goto end
+)
+
+if "%1" == "man" (
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
+ goto end
+)
+
+if "%1" == "texinfo" (
+ %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+ goto end
+)
+
+if "%1" == "gettext" (
+ %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+ goto end
+)
+
+if "%1" == "changes" (
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.The overview file is in %BUILDDIR%/changes.
+ goto end
+)
+
+if "%1" == "linkcheck" (
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+ goto end
+)
+
+if "%1" == "doctest" (
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+ goto end
+)
+
+:end
[21/22] git commit: Fix create_node feature metadata (LIBCLOUD-367)
Posted by to...@apache.org.
Fix create_node feature metadata (LIBCLOUD-367)
Signed-off-by: Tomaz Muraus <to...@apache.org>
Conflicts:
libcloud/compute/drivers/ec2.py
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/506c0fc0
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/506c0fc0
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/506c0fc0
Branch: refs/heads/0.13.x
Commit: 506c0fc07aaeb5c7477c3ab920d5e1a48777bb12
Parents: 57e6f4e
Author: John Carr <jo...@isotoma.com>
Authored: Thu Aug 1 18:11:42 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:29:28 2013 +0200
----------------------------------------------------------------------
libcloud/compute/base.py | 83 +++++++++++++++++++--------
libcloud/compute/drivers/abiquo.py | 7 +--
libcloud/compute/drivers/bluebox.py | 10 ++--
libcloud/compute/drivers/brightbox.py | 1 -
libcloud/compute/drivers/digitalocean.py | 1 -
libcloud/compute/drivers/ec2.py | 9 +--
libcloud/compute/drivers/hostvirtual.py | 10 +++-
libcloud/compute/drivers/linode.py | 7 ++-
libcloud/compute/drivers/opsource.py | 15 ++---
libcloud/compute/drivers/rimuhosting.py | 10 +---
libcloud/compute/drivers/vcloud.py | 11 ++--
libcloud/test/compute/test_base.py | 56 ++++++++++++++++++
12 files changed, 157 insertions(+), 63 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 53a2231..545ca00 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -358,8 +358,9 @@ class NodeAuthPassword(object):
"""
A password to be used for authentication to a node.
"""
- def __init__(self, password):
+ def __init__(self, password, generated=False):
self.password = password
+ self.generated = generated
def __repr__(self):
return '<NodeAuthPassword>'
@@ -478,6 +479,41 @@ class NodeDriver(BaseDriver):
host=host, port=port,
api_version=api_version, **kwargs)
+ def _get_and_check_auth(self, auth):
+ """
+ Helper function for providers supporting L{NodeAuthPassword} or
+ L{NodeAuthSSHKey}
+
+ Validates that only a supported object type is passed to the auth
+ parameter and raises an exception if it is not.
+
+ If no L{NodeAuthPassword} object is provided but one is expected then a
+ password is automatically generated.
+ """
+
+ if isinstance(auth, NodeAuthPassword):
+ if 'password' in self.features['create_node']:
+ return auth
+ raise LibcloudError(
+ 'Password provided as authentication information, but password'
+ 'not supported', driver=self)
+
+ if isinstance(auth, NodeAuthSSHKey):
+ if 'ssh_key' in self.features['create_node']:
+ return auth
+ raise LibcloudError(
+ 'SSH Key provided as authentication information, but SSH Key'
+ 'not supported', driver=self)
+
+ if 'password' in self.features['create_node']:
+ value = os.urandom(16)
+ return NodeAuthPassword(binascii.hexlify(value), generated=True)
+
+ if auth:
+ raise LibcloudError(
+ '"auth" argument provided, but it was not a NodeAuthPassword'
+ 'or NodeAuthSSHKey object', driver=self)
+
def create_node(self, **kwargs):
"""Create a new node instance.
@@ -582,8 +618,8 @@ class NodeDriver(BaseDriver):
"""
Create a new node, and start deployment.
- Depends on a Provider Driver supporting either using a specific
- password or returning a generated password.
+ Depends on user providing authentication information or the Provider
+ Driver generating a password and returning it.
This function may raise a :class:`DeploymentException`, if a create_node
call was successful, but there is a later error (like SSH failing or
@@ -656,29 +692,33 @@ class NodeDriver(BaseDriver):
raise RuntimeError('paramiko is not installed. You can install ' +
'it using pip: pip install paramiko')
- password = None
-
- if 'create_node' not in self.features:
- raise NotImplementedError(
- 'deploy_node not implemented for this driver')
- elif 'generates_password' not in self.features["create_node"]:
- if 'password' not in self.features["create_node"] and \
- 'ssh_key' not in self.features["create_node"]:
+ if 'auth' in kwargs:
+ auth = kwargs['auth']
+ if not isinstance(auth, (NodeAuthSSHKey, NodeAuthPassword)):
+ raise NotImplementedError(
+ 'If providing auth, only NodeAuthSSHKey or'
+ 'NodeAuthPassword is supported')
+ elif 'ssh_key' in kwargs:
+ # If an ssh_key is provided we can try deploy_node
+ pass
+ elif 'create_node' in self.features:
+ f = self.features['create_node']
+ if not 'generates_password' in f and not "password" in f:
raise NotImplementedError(
'deploy_node not implemented for this driver')
-
- if 'auth' not in kwargs:
- value = os.urandom(16)
- kwargs['auth'] = NodeAuthPassword(binascii.hexlify(value))
-
- if 'ssh_key' not in kwargs:
- password = kwargs['auth'].password
+ else:
+ raise NotImplementedError(
+ 'deploy_node not implemented for this driver')
node = self.create_node(**kwargs)
max_tries = kwargs.get('max_tries', 3)
- if 'generates_password' in self.features['create_node']:
- password = node.extra.get('password')
+ password = None
+ if 'auth' in kwargs:
+ if isinstance(kwargs['auth'], NodeAuthPassword):
+ password = kwargs['auth'].password
+ elif 'password' in node.extra:
+ password = node.extra['password']
ssh_interface = kwargs.get('ssh_interface', 'public_ips')
@@ -693,9 +733,6 @@ class NodeDriver(BaseDriver):
e = sys.exc_info()[1]
raise DeploymentError(node=node, original_exception=e, driver=self)
- if password:
- node.extra['password'] = password
-
ssh_username = kwargs.get('ssh_username', 'root')
ssh_alternate_usernames = kwargs.get('ssh_alternate_usernames', [])
ssh_port = kwargs.get('ssh_port', 22)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/drivers/abiquo.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/abiquo.py b/libcloud/compute/drivers/abiquo.py
index 7a10a99..98601cc 100644
--- a/libcloud/compute/drivers/abiquo.py
+++ b/libcloud/compute/drivers/abiquo.py
@@ -40,7 +40,6 @@ class AbiquoNodeDriver(NodeDriver):
name = 'Abiquo'
website = 'http://www.abiquo.com/'
connectionCls = AbiquoConnection
- features = {'create_node': ['password']}
timeout = 2000 # some images take a lot of time!
# Media Types
@@ -104,10 +103,6 @@ class AbiquoNodeDriver(NodeDriver):
undefined behavoir will be selected. (optional)
@type location: L{NodeLocation}
- @keyword auth: Initial authentication information for the node
- (optional)
- @type auth: L{NodeAuthPassword}
-
@keyword group_name: Which group this node belongs to. If empty,
it will be created into 'libcloud' group. If
it does not found any group in the target
@@ -684,7 +679,7 @@ class AbiquoNodeDriver(NodeDriver):
for vapp in vapps_element.findall('virtualAppliance'):
if vapp.findtext('name') == group_name:
uri_vapp = get_href(vapp, 'edit')
- return NodeGroup(self, vapp.findtext('name'), uri=uri_vapp)
+ return NodeGroup(self, vapp.findtext('name'), uri=uri_vapp)
# target group not found: create it. Since it is an extension of
# the basic 'libcloud' functionality, we try to be as flexible as
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/drivers/bluebox.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/bluebox.py b/libcloud/compute/drivers/bluebox.py
index ee9b3ce..8dc1ba2 100644
--- a/libcloud/compute/drivers/bluebox.py
+++ b/libcloud/compute/drivers/bluebox.py
@@ -135,6 +135,7 @@ class BlueboxNodeDriver(NodeDriver):
api_name = 'bluebox'
name = 'Bluebox Blocks'
website = 'http://bluebox.net'
+ features = {'create_node': ['ssh_key', 'password']}
def list_nodes(self):
result = self.connection.request('/api/blocks.json')
@@ -166,10 +167,7 @@ class BlueboxNodeDriver(NodeDriver):
image = kwargs['image']
size = kwargs['size']
- try:
- auth = kwargs['auth']
- except Exception:
- raise Exception("SSH public key or password required.")
+ auth = self._get_and_check_auth(kwargs.get('auth'))
data = {
'hostname': name,
@@ -197,6 +195,10 @@ class BlueboxNodeDriver(NodeDriver):
result = self.connection.request('/api/blocks.json', headers=headers,
data=params, method='POST')
node = self._to_node(result.object)
+
+ if getattr(auth, "generated", False):
+ node.extra['password'] = auth.password
+
return node
def destroy_node(self, node):
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/drivers/brightbox.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/brightbox.py b/libcloud/compute/drivers/brightbox.py
index 1747fdb..ce307ea 100644
--- a/libcloud/compute/drivers/brightbox.py
+++ b/libcloud/compute/drivers/brightbox.py
@@ -44,7 +44,6 @@ class BrightboxNodeDriver(NodeDriver):
type = Provider.BRIGHTBOX
name = 'Brightbox'
website = 'http://www.brightbox.co.uk/'
- features = {'create_node': ['ssh_key']}
NODE_STATE_MAP = {'creating': NodeState.PENDING,
'active': NodeState.RUNNING,
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/drivers/digitalocean.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/digitalocean.py b/libcloud/compute/drivers/digitalocean.py
index 0f4ee40..09ace5f 100644
--- a/libcloud/compute/drivers/digitalocean.py
+++ b/libcloud/compute/drivers/digitalocean.py
@@ -75,7 +75,6 @@ class DigitalOceanNodeDriver(NodeDriver):
type = Provider.DIGITAL_OCEAN
name = 'Digital Ocean'
website = 'https://www.digitalocean.com'
- features = {'create_node': ['ssh_key']}
NODE_STATE_MAP = {'new': NodeState.PENDING,
'off': NodeState.REBOOTING,
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index aecfdb2..17702fd 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -423,7 +423,6 @@ class BaseEC2NodeDriver(NodeDriver):
connectionCls = EC2Connection
path = '/'
- features = {'create_node': ['ssh_key']}
NODE_STATE_MAP = {
'pending': NodeState.PENDING,
@@ -1333,13 +1332,15 @@ class BaseEC2NodeDriver(NodeDriver):
if 'ex_blockdevicemappings' in kwargs:
if not isinstance(kwargs['ex_blockdevicemappings'], (list, tuple)):
- raise AttributeError('ex_blockdevicemappings not list or tuple')
+ raise AttributeError(
+ 'ex_blockdevicemappings not list or tuple')
for idx, mapping in enumerate(kwargs['ex_blockdevicemappings']):
idx += 1 # we want 1-based indexes
if not isinstance(mapping, dict):
- raise AttributeError('mapping %s in ex_blockdevicemappings '
- 'not a dict' % mapping)
+ raise AttributeError(
+ 'mapping %s in ex_blockdevicemappings '
+ 'not a dict' % mapping)
for k, v in mapping.items():
params['BlockDeviceMapping.%d.%s' % (idx, k)] = str(v)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/drivers/hostvirtual.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/hostvirtual.py b/libcloud/compute/drivers/hostvirtual.py
index e311224..de5e73d 100644
--- a/libcloud/compute/drivers/hostvirtual.py
+++ b/libcloud/compute/drivers/hostvirtual.py
@@ -61,6 +61,7 @@ class HostVirtualNodeDriver(NodeDriver):
name = 'HostVirtual'
website = 'http://www.vr.org'
connectionCls = HostVirtualComputeConnection
+ features = {'create_node': ['ssh_key', 'password']}
def __init__(self, key):
self.location = None
@@ -164,6 +165,8 @@ class HostVirtualNodeDriver(NodeDriver):
size = kwargs['size']
image = kwargs['image']
+ auth = self._get_and_check_auth(kwargs.get('auth'))
+
params = {'plan': size.name}
dc = DEFAULT_NODE_LOCATION_ID
@@ -186,9 +189,12 @@ class HostVirtualNodeDriver(NodeDriver):
})
# provisioning a server using the stub node
- self.ex_provision_node(node=stub_node, auth=kwargs['auth'])
-
+ self.ex_provision_node(node=stub_node, auth=auth)
node = self._wait_for_node(stub_node.id)
+
+ if getattr(auth, 'generated', False):
+ node.extra['password'] = auth.password
+
return node
def reboot_node(self, node):
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/drivers/linode.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/linode.py b/libcloud/compute/drivers/linode.py
index 86eb61c..c5cae83 100644
--- a/libcloud/compute/drivers/linode.py
+++ b/libcloud/compute/drivers/linode.py
@@ -208,7 +208,7 @@ class LinodeNodeDriver(NodeDriver):
name = kwargs["name"]
image = kwargs["image"]
size = kwargs["size"]
- auth = kwargs["auth"]
+ auth = self._get_and_check_auth(kwargs["auth"])
# Pick a location (resolves LIBCLOUD-41 in JIRA)
if "location" in kwargs:
@@ -372,7 +372,10 @@ class LinodeNodeDriver(NodeDriver):
nodes = self._to_nodes(data)
if len(nodes) == 1:
- return nodes[0]
+ node = nodes[0]
+ if getattr(auth, "generated", False):
+ node.extra['password'] = auth.password
+ return node
return None
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/drivers/opsource.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/opsource.py b/libcloud/compute/drivers/opsource.py
index 8b89ea8..5796a44 100644
--- a/libcloud/compute/drivers/opsource.py
+++ b/libcloud/compute/drivers/opsource.py
@@ -281,12 +281,8 @@ class OpsourceNodeDriver(NodeDriver):
# cannot be set at create time because size is part of the
# image definition.
password = None
- if 'auth' in kwargs:
- auth = kwargs.get('auth')
- if isinstance(auth, NodeAuthPassword):
- password = auth.password
- else:
- raise ValueError('auth must be of NodeAuthPassword type')
+ auth = self._get_and_check_auth(kwargs.get('auth'))
+ password = auth.password
ex_description = kwargs.get('ex_description', '')
ex_isStarted = kwargs.get('ex_isStarted', True)
@@ -319,7 +315,12 @@ class OpsourceNodeDriver(NodeDriver):
# XXX: return the last node in the list that has a matching name. this
# is likely but not guaranteed to be the node we just created
# because opsource allows multiple nodes to have the same name
- return list(filter(lambda x: x.name == name, self.list_nodes()))[-1]
+ node = list(filter(lambda x: x.name == name, self.list_nodes()))[-1]
+
+ if getattr(auth, "generated", False):
+ node.extra['password'] = auth.password
+
+ return node
def destroy_node(self, node):
body = self.connection.request_with_orgId(
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/drivers/rimuhosting.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/rimuhosting.py b/libcloud/compute/drivers/rimuhosting.py
index eb81a91..6db9b0d 100644
--- a/libcloud/compute/drivers/rimuhosting.py
+++ b/libcloud/compute/drivers/rimuhosting.py
@@ -116,6 +116,7 @@ class RimuHostingNodeDriver(NodeDriver):
name = 'RimuHosting'
website = 'http://rimuhosting.com/'
connectionCls = RimuHostingConnection
+ features = {'create_node': ['password']}
def __init__(self, key, host=API_HOST, port=443,
api_context=API_CONTEXT, secure=True):
@@ -283,11 +284,8 @@ class RimuHostingNodeDriver(NodeDriver):
data['instantiation_options']['control_panel'] = \
kwargs['ex_control_panel']
- if 'auth' in kwargs:
- auth = kwargs['auth']
- if not isinstance(auth, NodeAuthPassword):
- raise ValueError('auth must be of NodeAuthPassword type')
- data['instantiation_options']['password'] = auth.password
+ auth = self._get_and_check_auth(kwargs.get('auth'))
+ data['instantiation_options']['password'] = auth.password
if 'ex_billing_oid' in kwargs:
#TODO check for valid oid.
@@ -345,5 +343,3 @@ class RimuHostingNodeDriver(NodeDriver):
NodeLocation('DCLONDON', "RimuHosting London", 'GB', self),
NodeLocation('DCSYDNEY', "RimuHosting Sydney", 'AU', self),
]
-
- features = {"create_node": ["password"]}
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/compute/drivers/vcloud.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/vcloud.py b/libcloud/compute/drivers/vcloud.py
index e7d9a7e..02638e6 100644
--- a/libcloud/compute/drivers/vcloud.py
+++ b/libcloud/compute/drivers/vcloud.py
@@ -718,12 +718,8 @@ class VCloudNodeDriver(NodeDriver):
network = ''
password = None
- if 'auth' in kwargs:
- auth = kwargs['auth']
- if isinstance(auth, NodeAuthPassword):
- password = auth.password
- else:
- raise ValueError('auth must be of NodeAuthPassword type')
+ auth = self._get_and_check_auth(kwargs.get('auth'))
+ password = auth.password
instantiate_xml = InstantiateVAppXML(
name=name,
@@ -759,6 +755,9 @@ class VCloudNodeDriver(NodeDriver):
res = self.connection.request(vapp_path)
node = self._to_node(res.object)
+ if getattr(auth, "generated", False):
+ node.extra['password'] = auth.password
+
return node
features = {"create_node": ["password"]}
http://git-wip-us.apache.org/repos/asf/libcloud/blob/506c0fc0/libcloud/test/compute/test_base.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_base.py b/libcloud/test/compute/test_base.py
index 17081c1..750d527 100644
--- a/libcloud/test/compute/test_base.py
+++ b/libcloud/test/compute/test_base.py
@@ -17,7 +17,9 @@ import unittest
from libcloud.common.base import Response
from libcloud.common.base import Connection, ConnectionKey, ConnectionUserAndKey
+from libcloud.common.types import LibcloudError
from libcloud.compute.base import Node, NodeSize, NodeImage, NodeDriver
+from libcloud.compute.base import NodeAuthSSHKey, NodeAuthPassword
from libcloud.test import MockResponse # pylint: disable-msg=E0611
@@ -52,5 +54,59 @@ class BaseTests(unittest.TestCase):
def test_base_connection_timeout(self):
Connection(timeout=10)
+
+class TestValidateAuth(unittest.TestCase):
+
+ def test_get_auth_ssh(self):
+ n = NodeDriver('foo')
+ n.features = {'create_node': ['ssh_key']}
+ auth = NodeAuthSSHKey('pubkey...')
+ self.assertEqual(auth, n._get_and_check_auth(auth))
+
+ def test_get_auth_ssh_but_given_password(self):
+ n = NodeDriver('foo')
+ n.features = {'create_node': ['ssh_key']}
+ auth = NodeAuthPassword('password')
+ self.assertRaises(LibcloudError, n._get_and_check_auth, auth)
+
+ def test_get_auth_password(self):
+ n = NodeDriver('foo')
+ n.features = {'create_node': ['password']}
+ auth = NodeAuthPassword('password')
+ self.assertEqual(auth, n._get_and_check_auth(auth))
+
+ def test_get_auth_password_but_given_ssh_key(self):
+ n = NodeDriver('foo')
+ n.features = {'create_node': ['password']}
+ auth = NodeAuthSSHKey('publickey')
+ self.assertRaises(LibcloudError, n._get_and_check_auth, auth)
+
+ def test_get_auth_default_ssh_key(self):
+ n = NodeDriver('foo')
+ n.features = {'create_node': ['ssh_key']}
+ self.assertEqual(None, n._get_and_check_auth(None))
+
+ def test_get_auth_default_password(self):
+ n = NodeDriver('foo')
+ n.features = {'create_node': ['password']}
+ auth = n._get_and_check_auth(None)
+ self.assertTrue(isinstance(auth, NodeAuthPassword))
+
+ def test_get_auth_default_no_feature(self):
+ n = NodeDriver('foo')
+ self.assertEqual(None, n._get_and_check_auth(None))
+
+ def test_get_auth_generates_password_but_given_nonsense(self):
+ n = NodeDriver('foo')
+ n.features = {'create_node': ['generates_password']}
+ auth = "nonsense"
+ self.assertRaises(LibcloudError, n._get_and_check_auth, auth)
+
+ def test_get_auth_no_features_but_given_nonsense(self):
+ n = NodeDriver('foo')
+ auth = "nonsense"
+ self.assertRaises(LibcloudError, n._get_and_check_auth, auth)
+
+
if __name__ == '__main__':
sys.exit(unittest.main())
[22/22] git commit: Fix a bug with encoding in Python 3 which was
exposed by previous commit.
Posted by to...@apache.org.
Fix a bug with encoding in Python 3 which was exposed by previous commit.
In Python 3, binascii.hexlify returns bytes, but we want a str.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ee54c26e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ee54c26e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ee54c26e
Branch: refs/heads/0.13.x
Commit: ee54c26e025ddd9ef5fc1c8661d8c1da641dc883
Parents: 506c0fc
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Aug 1 19:51:09 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:29:36 2013 +0200
----------------------------------------------------------------------
libcloud/common/openstack.py | 2 +-
libcloud/compute/base.py | 3 ++-
libcloud/compute/deployment.py | 4 +++-
libcloud/compute/drivers/ecp.py | 2 +-
libcloud/storage/drivers/azure_blobs.py | 10 ++++++----
5 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee54c26e/libcloud/common/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack.py b/libcloud/common/openstack.py
index ba1425a..622a275 100644
--- a/libcloud/common/openstack.py
+++ b/libcloud/common/openstack.py
@@ -605,7 +605,7 @@ class OpenStackBaseConnection(ConnectionUserAndKey):
self._tuple_from_url(url)
def _add_cache_busting_to_params(self, params):
- cache_busting_number = binascii.hexlify(os.urandom(8))
+ cache_busting_number = binascii.hexlify(os.urandom(8)).decode('ascii')
if isinstance(params, dict):
params['cache-busting'] = cache_busting_number
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee54c26e/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 545ca00..0a84dd2 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -507,7 +507,8 @@ class NodeDriver(BaseDriver):
if 'password' in self.features['create_node']:
value = os.urandom(16)
- return NodeAuthPassword(binascii.hexlify(value), generated=True)
+ value = binascii.hexlify(value).decode('ascii')
+ return NodeAuthPassword(value, generated=True)
if auth:
raise LibcloudError(
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee54c26e/libcloud/compute/deployment.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/deployment.py b/libcloud/compute/deployment.py
index 103315c..d0925b5 100644
--- a/libcloud/compute/deployment.py
+++ b/libcloud/compute/deployment.py
@@ -142,7 +142,9 @@ class ScriptDeployment(Deployment):
if self.name is None:
# File is put under user's home directory
# (~/libcloud_deployment_<random_string>.sh)
- self.name = 'libcloud_deployment_%s.sh' % (binascii.hexlify(os.urandom(4)))
+ random_string = binascii.hexlify(os.urandom(4))
+ random_string = random_string.decode('ascii')
+ self.name = 'libcloud_deployment_%s.sh' % (random_string)
def run(self, node, client):
"""
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee54c26e/libcloud/compute/drivers/ecp.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecp.py b/libcloud/compute/drivers/ecp.py
index dff49c0..aa77440 100644
--- a/libcloud/compute/drivers/ecp.py
+++ b/libcloud/compute/drivers/ecp.py
@@ -102,7 +102,7 @@ class ECPConnection(ConnectionUserAndKey):
#use a random boundary that does not appear in the fields
boundary = ''
while boundary in ''.join(fields):
- boundary = u(binascii.hexlify(os.urandom(16)))
+ boundary = binascii.hexlify(os.urandom(16)).decode('utf-8')
L = []
for i in fields:
L.append('--' + boundary)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee54c26e/libcloud/storage/drivers/azure_blobs.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/azure_blobs.py b/libcloud/storage/drivers/azure_blobs.py
index 5512d70..06e4511 100644
--- a/libcloud/storage/drivers/azure_blobs.py
+++ b/libcloud/storage/drivers/azure_blobs.py
@@ -295,8 +295,9 @@ class AzureBlobsStorageDriver(StorageDriver):
}
if extra['md5_hash']:
- extra['md5_hash'] = binascii.hexlify(
- base64.b64decode(b(extra['md5_hash'])))
+ value = binascii.hexlify(base64.b64decode(b(extra['md5_hash'])))
+ value = value.decode('ascii')
+ extra['md5_hash'] = value
meta_data = {}
for meta in metadata.getchildren():
@@ -344,8 +345,9 @@ class AzureBlobsStorageDriver(StorageDriver):
}
if extra['md5_hash']:
- extra['md5_hash'] = binascii.hexlify(
- base64.b64decode(b(extra['md5_hash'])))
+ value = binascii.hexlify(base64.b64decode(b(extra['md5_hash'])))
+ value = value.decode('ascii')
+ extra['md5_hash'] = value
meta_data = {}
for key, value in response.headers.items():
[18/22] git commit: Add travis config.
Posted by to...@apache.org.
Add travis config.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/57e6f4ec
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/57e6f4ec
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/57e6f4ec
Branch: refs/heads/0.13.x
Commit: 57e6f4ec59e22687e9f2642dbf5bea9d04aa342d
Parents: 5820e01
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Aug 1 18:35:21 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:50 2013 +0200
----------------------------------------------------------------------
.travis.yml | 15 +++++++++++++++
1 file changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/57e6f4ec/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..f750c18
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,15 @@
+language: python
+python: 2.7
+env:
+ - TOX_ENV=py25
+ - TOX_ENV=py26
+ - TOX_ENV=py27
+ - TOX_ENV=pypy
+ - TOX_ENV=py32
+ - TOX_ENV=py33
+
+install:
+ - pip install tox
+
+script:
+ - tox -e $TOX_ENV
[04/22] git commit: Added some examples
Posted by to...@apache.org.
Added some examples
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9d4e3ffa
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9d4e3ffa
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9d4e3ffa
Branch: refs/heads/0.13.x
Commit: 9d4e3ffa7652425ad9c86df754861db4fe220e15
Parents: 4cb45c0
Author: Alex Gaynor <al...@gmail.com>
Authored: Wed Jul 31 15:06:26 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:48 2013 +0200
----------------------------------------------------------------------
docs/compute/index.rst | 5 +++++
docs/index.rst | 21 ++++++++++-----------
2 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9d4e3ffa/docs/compute/index.rst
----------------------------------------------------------------------
diff --git a/docs/compute/index.rst b/docs/compute/index.rst
index 5c0939a..cad3179 100644
--- a/docs/compute/index.rst
+++ b/docs/compute/index.rst
@@ -21,3 +21,8 @@ Terminology
* **NodeLocation** - represents a physical location where a server can be.
* **NodeState** - represents a node state. Standard states are: ``running``,
``rebooting``, ``terminated``, ``pending``, and ``unknown``.
+
+Examples
+--------
+
+We have :doc:`examples of several common patterns </compute/examples>`.
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9d4e3ffa/docs/index.rst
----------------------------------------------------------------------
diff --git a/docs/index.rst b/docs/index.rst
index bf200e0..9f8e30b 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -11,20 +11,19 @@ Apache Libcloud is a Python library which abstracts away the differences
between multiple cloud providers. It current can manage four different cloud
resources:
-* :doc:`Cloud servers <compute/index>` - services such as Amazon EC2 and
+* :doc:`Cloud servers </compute/index>` - services such as Amazon EC2 and
RackSpace CloudServers
-* :doc:`Cloud object storage <storage/index>` - services such as Amazon S3 and
+* :doc:`Cloud object storage </storage/index>` - services such as Amazon S3 and
Rackspace CloudFiles
-* :doc:`Load Balancers as a Service <loadbalancers/index>`
-* :doc:`DNS as a Service <dns/index>`
+* :doc:`Load Balancers as a Service </loadbalancers/index>`
+* :doc:`DNS as a Service </dns/index>`
-Contents:
-
.. toctree::
- :maxdepth: 1
+ :glob:
+ :hidden:
- compute/index
- storage/index
- loadbalancers/index
- dns/index
+ compute/*
+ storage/*
+ loadbalancers/*
+ dns/*
[16/22] git commit: Add argparse dependency for Python < 2.6 and >=
3.1 and <= 3.2.
Posted by to...@apache.org.
Add argparse dependency for Python < 2.6 and >= 3.1 and <= 3.2.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b1a02140
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b1a02140
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b1a02140
Branch: refs/heads/0.13.x
Commit: b1a0214057c1617b5857c492ed306be6e2db92f3
Parents: 30500fe
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Mon Jul 29 21:36:15 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:49 2013 +0200
----------------------------------------------------------------------
libcloud/utils/py3.py | 4 ++++
setup.py | 11 +++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b1a02140/libcloud/utils/py3.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/py3.py b/libcloud/utils/py3.py
index 206324e..1c44c27 100644
--- a/libcloud/utils/py3.py
+++ b/libcloud/utils/py3.py
@@ -28,6 +28,7 @@ PY2 = False
PY25 = False
PY27 = False
PY3 = False
+PY31 = False
PY32 = False
if sys.version_info >= (2, 0) and sys.version_info < (3, 0):
@@ -42,6 +43,9 @@ if sys.version_info >= (2, 7) and sys.version_info <= (2, 8):
if sys.version_info >= (3, 0):
PY3 = True
+if sys.version_info >= (3, 1) and sys.version_info < (3, 2):
+ PY31 = True
+
if sys.version_info >= (3, 2) and sys.version_info < (3, 3):
PY32 = True
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b1a02140/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index fc82122..2bbeba7 100644
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,7 @@ except ImportError:
import libcloud.utils.misc
from libcloud.utils.dist import get_packages, get_data_files
-from libcloud.utils.py3 import unittest2_required
+from libcloud.utils.py3 import unittest2_required, PY31, PY32
libcloud.utils.misc.SHOW_DEPRECATION_WARNING = False
@@ -229,6 +229,13 @@ class CoverageCommand(Command):
cov.save()
cov.html_report()
+if pre_python26:
+ dependencies = ['ssl', 'simplejson', 'argparse']
+elif PY31 or PY32:
+ dependencies = ['argparse']
+else:
+ dependencies = []
+
setup(
name='apache-libcloud',
@@ -238,7 +245,7 @@ setup(
' and documentation, please see http://libcloud.apache.org',
author='Apache Software Foundation',
author_email='dev@libcloud.apache.org',
- requires=([], ['ssl', 'simplejson'],)[pre_python26],
+ requires=dependencies,
packages=get_packages('libcloud'),
package_dir={
'libcloud': 'libcloud',
[13/22] git commit: Really added the examples
Posted by to...@apache.org.
Really added the examples
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8a868d97
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8a868d97
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8a868d97
Branch: refs/heads/0.13.x
Commit: 8a868d974e53bccdf10070042487561586b44dcf
Parents: 9d4e3ff
Author: Alex Gaynor <al...@gmail.com>
Authored: Wed Jul 31 15:06:33 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:49 2013 +0200
----------------------------------------------------------------------
docs/compute/examples.rst | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8a868d97/docs/compute/examples.rst
----------------------------------------------------------------------
diff --git a/docs/compute/examples.rst b/docs/compute/examples.rst
new file mode 100644
index 0000000..1a7e2bd
--- /dev/null
+++ b/docs/compute/examples.rst
@@ -0,0 +1,42 @@
+Compute Examples
+================
+
+Create an OpenStack node using trystack.org provider
+----------------------------------------------------
+
+`trystack.org`_ allows users to try out OpenStack for free. This example
+demonstrates how to launch an OpenStack node on the ``trystack.org`` provider
+using a generic OpenStack driver.
+
+.. sourcecode:: python
+
+ from libcloud.compute.types import Provider
+ from libcloud.compute.providers import get_driver
+
+ import libcloud.security
+
+ # At the time this example was written, https://nova-api.trystack.org:5443
+ # was using a certificate issued by a Certificate Authority (CA) which is
+ # not included in the default Ubuntu certificates bundle (ca-certificates).
+ # Note: Code like this poses a security risk (MITM attack) and that's the
+ # reason why you should never use it for anything else besides testing. You
+ # have been warned.
+ libcloud.security.VERIFY_SSL_CERT = False
+
+ OpenStack = get_driver(Provider.OPENSTACK)
+
+ driver = OpenStack('your username', 'your password',
+ ex_force_auth_url='https://nova-api.trystack.org:5443/v2.0',
+ ex_force_auth_version='2.0_password')
+
+ nodes = driver.list_nodes()
+
+ images = driver.list_images()
+ sizes = driver.list_sizes()
+ size = [s for s in sizes if s.ram == 512][0]
+ image = [i for i in images if i.name == 'natty-server-cloudimg-amd64'][0]
+
+ node = driver.create_node(name='test node', image=image, size=size)
+
+
+.. _`trystack.org`: http://trystack.org/
[15/22] git commit: Add cli utility for updating pricing file.
Posted by to...@apache.org.
Add cli utility for updating pricing file.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/30500fed
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/30500fed
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/30500fed
Branch: refs/heads/0.13.x
Commit: 30500fedd0a48273b4a45ec9147d3f670b6e9710
Parents: 5fa1610
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Mon Jul 29 21:28:50 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:49 2013 +0200
----------------------------------------------------------------------
bin/libcloud | 30 ++++++++++++++
libcloud/cli/__init__.py | 0
libcloud/cli/pricing.py | 84 +++++++++++++++++++++++++++++++++++++++
libcloud/utils/connection.py | 31 +++++++++++++++
4 files changed, 145 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/30500fed/bin/libcloud
----------------------------------------------------------------------
diff --git a/bin/libcloud b/bin/libcloud
new file mode 100755
index 0000000..270922e
--- /dev/null
+++ b/bin/libcloud
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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 __future__ import with_statement
+
+import argparse
+
+from libcloud.cli.pricing import add_subparser, update_pricing
+
+parser = argparse.ArgumentParser(prog='libcloud', usage='%(prog)s')
+subparsers = parser.add_subparsers(dest='subparser_name')
+add_subparser(subparsers=subparsers)
+
+args = parser.parse_args()
+
+if args.subparser_name == 'update-pricing':
+ update_pricing(file_url=args.file_url, file_path=args.file_path)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/30500fed/libcloud/cli/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/cli/__init__.py b/libcloud/cli/__init__.py
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/libcloud/blob/30500fed/libcloud/cli/pricing.py
----------------------------------------------------------------------
diff --git a/libcloud/cli/pricing.py b/libcloud/cli/pricing.py
new file mode 100644
index 0000000..584d292
--- /dev/null
+++ b/libcloud/cli/pricing.py
@@ -0,0 +1,84 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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 sys
+
+try:
+ import simplejson as json
+except ImportError:
+ import json
+
+
+from libcloud.pricing import CUSTOM_PRICING_FILE_PATH
+from libcloud.utils.connection import get_response_object
+
+__all__ = [
+ 'add_subparser',
+ 'update_pricing'
+]
+
+# Default URL to the pricing file
+DEFAULT_FILE_URL = 'https://git-wip-us.apache.org/repos/asf?p=libcloud.git;a=blob_plain;f=libcloud/data/pricing.json'
+
+
+def add_subparser(subparsers):
+ parser = subparsers.add_parser('update-pricing',
+ help='Update Libcloud pricing file')
+ parser.add_argument('--file-path', dest='file_path', action='store',
+ default=CUSTOM_PRICING_FILE_PATH,
+ help='Path where the file will be saved')
+ parser.add_argument('--file-url', dest='file_url', action='store',
+ default=DEFAULT_FILE_URL,
+ help='URL to the pricing file')
+ return parser
+
+
+def update_pricing(file_url, file_path):
+ dir_name = os.path.dirname(file_path)
+
+ if not os.path.exists(dir_name):
+ # Verify a valid path is provided
+ sys.stderr.write('Can\'t write to %s, directory %s, doesn\'t exist\n' %
+ (file_path, dir_name))
+ sys.exit(2)
+
+ if os.path.exists(file_path) and os.path.isdir(file_path):
+ sys.stderr.write('Can\'t write to %s file path because it\'s a'
+ ' directory\n' %
+ (file_path))
+ sys.exit(2)
+
+ response = get_response_object(file_url)
+ body = response.body
+
+ # Verify pricing file is valid
+ try:
+ data = json.loads(body)
+ except json.decoder.JSONDecodeError:
+ sys.stderr.write('Provided URL doesn\'t contain valid pricing'
+ ' data\n')
+ sys.exit(3)
+
+ if not data.get('updated', None):
+ sys.stderr.write('Provided URL doesn\'t contain valid pricing'
+ ' data\n')
+ sys.exit(3)
+
+ # No need to stream it since file is small
+ with open(file_path, 'w') as file_handle:
+ file_handle.write(response.body)
+
+ print('Pricing file saved to %s' % (file_path))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/30500fed/libcloud/utils/connection.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/connection.py b/libcloud/utils/connection.py
new file mode 100644
index 0000000..bd2b50d
--- /dev/null
+++ b/libcloud/utils/connection.py
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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 libcloud.utils.py3 import urlparse, parse_qs
+from libcloud.common.base import Connection
+
+__all__ = [
+ 'get_response_object'
+]
+
+
+def get_response_object(url):
+ parsed_url = urlparse.urlparse(url)
+ parsed_qs = parse_qs(parsed_url.query)
+ secure = parsed_url.scheme == 'https'
+
+ con = Connection(secure=secure, host=parsed_url.netloc)
+ response = con.request(method='GET', action=parsed_url.path, params=parsed_qs)
+ return response
[03/22] git commit: Added some todos
Posted by to...@apache.org.
Added some todos
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4cb45c07
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4cb45c07
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4cb45c07
Branch: refs/heads/0.13.x
Commit: 4cb45c079182e320f6d950d25e7bc603552ffd5f
Parents: bd1e71b
Author: Alex Gaynor <al...@gmail.com>
Authored: Wed Jul 31 14:43:18 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:48 2013 +0200
----------------------------------------------------------------------
docs/dns/index.rst | 4 ++++
docs/loadbalancers/index.rst | 4 ++++
docs/storage/index.rst | 4 ++++
3 files changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/4cb45c07/docs/dns/index.rst
----------------------------------------------------------------------
diff --git a/docs/dns/index.rst b/docs/dns/index.rst
index 51bbfe3..7e899b1 100644
--- a/docs/dns/index.rst
+++ b/docs/dns/index.rst
@@ -1,2 +1,6 @@
DNS
===
+
+.. note::
+
+ TODO: Write me!
http://git-wip-us.apache.org/repos/asf/libcloud/blob/4cb45c07/docs/loadbalancers/index.rst
----------------------------------------------------------------------
diff --git a/docs/loadbalancers/index.rst b/docs/loadbalancers/index.rst
index 35c5ed1..f9baa2d 100644
--- a/docs/loadbalancers/index.rst
+++ b/docs/loadbalancers/index.rst
@@ -1,2 +1,6 @@
Load Balancers
==============
+
+.. note::
+
+ TODO: Write me!
http://git-wip-us.apache.org/repos/asf/libcloud/blob/4cb45c07/docs/storage/index.rst
----------------------------------------------------------------------
diff --git a/docs/storage/index.rst b/docs/storage/index.rst
index 17a6f7c..3ab1bb5 100644
--- a/docs/storage/index.rst
+++ b/docs/storage/index.rst
@@ -1,2 +1,6 @@
Object Storage
==============
+
+.. note::
+
+ TODO: Write me!
[12/22] git commit: Included API doc for base node driver,
also ported docstrings from epytext to sphinx
Posted by to...@apache.org.
Included API doc for base node driver, also ported docstrings from epytext to sphinx
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/be1bdc01
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/be1bdc01
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/be1bdc01
Branch: refs/heads/0.13.x
Commit: be1bdc012cda62e962272de586df9c2d6e5311ea
Parents: 8a868d9
Author: Alex Gaynor <al...@gmail.com>
Authored: Wed Jul 31 16:04:59 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:49 2013 +0200
----------------------------------------------------------------------
docs/compute/api.rst | 5 +
docs/compute/index.rst | 6 +
libcloud/compute/base.py | 262 ++++++++++++++++++++----------------------
3 files changed, 136 insertions(+), 137 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/be1bdc01/docs/compute/api.rst
----------------------------------------------------------------------
diff --git a/docs/compute/api.rst b/docs/compute/api.rst
new file mode 100644
index 0000000..13d9a1f
--- /dev/null
+++ b/docs/compute/api.rst
@@ -0,0 +1,5 @@
+Compute Base API
+================
+
+.. autoclass:: libcloud.compute.base.NodeDriver
+ :members:
http://git-wip-us.apache.org/repos/asf/libcloud/blob/be1bdc01/docs/compute/index.rst
----------------------------------------------------------------------
diff --git a/docs/compute/index.rst b/docs/compute/index.rst
index cad3179..af0dbb8 100644
--- a/docs/compute/index.rst
+++ b/docs/compute/index.rst
@@ -26,3 +26,9 @@ Examples
--------
We have :doc:`examples of several common patterns </compute/examples>`.
+
+API Reference
+-------------
+
+There is a reference to :doc:`all the methods on the base compute driver
+</compute/api/>`.
http://git-wip-us.apache.org/repos/asf/libcloud/blob/be1bdc01/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index b5def91..53a2231 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -78,7 +78,7 @@ class UuidMixin(object):
def get_uuid(self):
"""Unique hash for a node, node image, or node size
- @return: C{string}
+ :return: ``string``
The hash is a function of an SHA1 hash of the node, node image,
or node size's ID and its driver which means that it should be
@@ -188,7 +188,7 @@ class Node(UuidMixin):
def reboot(self):
"""Reboot this node
- @return: C{bool}
+ :return: ``bool``
This calls the node's driver and reboots the node
@@ -210,7 +210,7 @@ class Node(UuidMixin):
def destroy(self):
"""Destroy this node
- @return: C{bool}
+ :return: ``bool``
This calls the node's driver and destroys the node
@@ -382,14 +382,14 @@ class StorageVolume(UuidMixin):
"""
Attach this volume to a node.
- @param node: Node to attach volume to
- @type node: L{Node}
+ :param node: Node to attach volume to
+ :type node: :class:`Node`
- @param device: Where the device is exposed,
+ :param device: Where the device is exposed,
e.g. '/dev/sdb (optional)
- @type device: C{str}
+ :type device: ``str``
- @returns C{bool}
+ :return s ``bool``
"""
return self.driver.attach_volume(node=node, volume=self, device=device)
@@ -398,14 +398,14 @@ class StorageVolume(UuidMixin):
"""
Detach this volume from its node
- @returns C{bool}
+ :return s ``bool``
"""
return self.driver.detach_volume(volume=self)
def list_snapshots(self):
"""
- @returns C{list} of C{VolumeSnapshot}
+ :return s ``list`` of ``VolumeSnapshot``
"""
return self.driver.list_volume_snapshots(volume=self)
@@ -413,7 +413,7 @@ class StorageVolume(UuidMixin):
"""
Creates a snapshot of this volume.
- @returns C{VolumeSnapshot}
+ :return s ``VolumeSnapshot``
"""
return self.driver.create_volume_snapshot(volume=self, name=name)
@@ -421,7 +421,7 @@ class StorageVolume(UuidMixin):
"""
Destroy this storage volume.
- @returns C{bool}
+ :return s ``bool``
"""
return self.driver.destroy_volume(volume=self)
@@ -439,7 +439,7 @@ class VolumeSnapshot(object):
"""
Destroys this snapshot.
- @returns C{bool}
+ :return s ``bool``
"""
return self.driver.destroy_volume_snapshot(snapshot=self)
@@ -461,10 +461,10 @@ class NodeDriver(BaseDriver):
features = {"create_node": []}
"""
List of available features for a driver.
- - L{create_node}
- - ssh_key: Supports L{NodeAuthSSHKey} as an authentication method
+ - :class:`create_node`
+ - ssh_key: Supports :class:`NodeAuthSSHKey` as an authentication method
for nodes.
- - password: Supports L{NodeAuthPassword} as an authentication
+ - password: Supports :class:`NodeAuthPassword` as an authentication
method for nodes.
- generates_password: Returns a password attribute on the Node
object returned from creation.
@@ -481,26 +481,26 @@ class NodeDriver(BaseDriver):
def create_node(self, **kwargs):
"""Create a new node instance.
- @keyword name: String with a name for this new node (required)
- @type name: C{str}
+ :param name: String with a name for this new node (required)
+ :type name: ``str``
- @keyword size: The size of resources allocated to this node.
+ :param size: The size of resources allocated to this node.
(required)
- @type size: L{NodeSize}
+ :type size: :class:`NodeSize`
- @keyword image: OS Image to boot on node. (required)
- @type image: L{NodeImage}
+ :param image: OS Image to boot on node. (required)
+ :type image: :class:`NodeImage`
- @keyword location: Which data center to create a node in. If empty,
+ :param location: Which data center to create a node in. If empty,
undefined behavoir will be selected. (optional)
- @type location: L{NodeLocation}
+ :type location: :class:`NodeLocation`
- @keyword auth: Initial authentication information for the node
+ :param auth: Initial authentication information for the node
(optional)
- @type auth: L{NodeAuthSSHKey} or L{NodeAuthPassword}
+ :type auth: :class:`NodeAuthSSHKey` or :class:`NodeAuthPassword`
- @return: The newly created node.
- @rtype: L{Node}
+ :return: The newly created node.
+ :rtype: :class:`Node`
"""
raise NotImplementedError(
'create_node not implemented for this driver')
@@ -511,11 +511,11 @@ class NodeDriver(BaseDriver):
Depending upon the provider, this may destroy all data associated with
the node, including backups.
- @param node: The node to be destroyed
- @type node: L{Node}
+ :param node: The node to be destroyed
+ :type node: :class:`Node`
- @return: True if the destroy was successful, otherwise False
- @rtype: C{bool}
+ :return: True if the destroy was successful, otherwise False
+ :rtype: ``bool``
"""
raise NotImplementedError(
'destroy_node not implemented for this driver')
@@ -524,11 +524,11 @@ class NodeDriver(BaseDriver):
"""
Reboot a node.
- @param node: The node to be rebooted
- @type node: L{Node}
+ :param node: The node to be rebooted
+ :type node: :class:`Node`
- @return: True if the reboot was successful, otherwise False
- @rtype: C{bool}
+ :return: True if the reboot was successful, otherwise False
+ :rtype: ``bool``
"""
raise NotImplementedError(
'reboot_node not implemented for this driver')
@@ -536,8 +536,8 @@ class NodeDriver(BaseDriver):
def list_nodes(self):
"""
List all nodes
- @return: list of node objects
- @rtype: C{list} of L{Node}
+ :return: list of node objects
+ :rtype: ``list`` of :class:`Node`
"""
raise NotImplementedError(
'list_nodes not implemented for this driver')
@@ -546,11 +546,11 @@ class NodeDriver(BaseDriver):
"""
List images on a provider
- @keyword location: The location at which to list images
- @type location: L{NodeLocation}
+ :param location: The location at which to list images
+ :type location: :class:`NodeLocation`
- @return: list of node image objects
- @rtype: C{list} of L{NodeImage}
+ :return: list of node image objects
+ :rtype: ``list`` of :class:`NodeImage`
"""
raise NotImplementedError(
'list_images not implemented for this driver')
@@ -559,11 +559,11 @@ class NodeDriver(BaseDriver):
"""
List sizes on a provider
- @keyword location: The location at which to list sizes
- @type location: L{NodeLocation}
+ :param location: The location at which to list sizes
+ :type location: :class:`NodeLocation`
- @return: list of node size objects
- @rtype: C{list} of L{NodeSize}
+ :return: list of node size objects
+ :rtype: ``list`` of :class:`NodeSize`
"""
raise NotImplementedError(
'list_sizes not implemented for this driver')
@@ -572,8 +572,8 @@ class NodeDriver(BaseDriver):
"""
List data centers for a provider
- @return: list of node location objects
- @rtype: C{list} of L{NodeLocation}
+ :return: list of node location objects
+ :rtype: ``list`` of :class:`NodeLocation`
"""
raise NotImplementedError(
'list_locations not implemented for this driver')
@@ -585,7 +585,7 @@ class NodeDriver(BaseDriver):
Depends on a Provider Driver supporting either using a specific
password or returning a generated password.
- This function may raise a L{DeploymentException}, if a create_node
+ This function may raise a :class:`DeploymentException`, if a create_node
call was successful, but there is a later error (like SSH failing or
timing out). This exception includes a Node object which you may want
to destroy if incomplete deployments are not desirable.
@@ -609,48 +609,48 @@ class NodeDriver(BaseDriver):
Deploy node is typically not overridden in subclasses. The
existing implementation should be able to handle most such.
- @inherits: L{NodeDriver.create_node}
+ @inherits: :class:`NodeDriver.create_node`
- @keyword deploy: Deployment to run once machine is online and
+ :param deploy: Deployment to run once machine is online and
availble to SSH.
- @type deploy: L{Deployment}
+ :type deploy: :class:`Deployment`
- @keyword ssh_username: Optional name of the account which is used
+ :param ssh_username: Optional name of the account which is used
when connecting to
SSH server (default is root)
- @type ssh_username: C{str}
+ :type ssh_username: ``str``
- @keyword ssh_alternate_usernames: Optional list of ssh usernames to
+ :param ssh_alternate_usernames: Optional list of ssh usernames to
try to connect with if using the
default one fails
- @type ssh_alternate_usernames: C{list}
+ :type ssh_alternate_usernames: ``list``
- @keyword ssh_port: Optional SSH server port (default is 22)
- @type ssh_port: C{int}
+ :param ssh_port: Optional SSH server port (default is 22)
+ :type ssh_port: ``int``
- @keyword ssh_timeout: Optional SSH connection timeout in seconds
+ :param ssh_timeout: Optional SSH connection timeout in seconds
(default is None)
- @type ssh_timeout: C{float}
+ :type ssh_timeout: ``float``
- @keyword auth: Initial authentication information for the node
+ :param auth: Initial authentication information for the node
(optional)
- @type auth: L{NodeAuthSSHKey} or L{NodeAuthPassword}
+ :type auth: :class:`NodeAuthSSHKey` or :class:`NodeAuthPassword`
- @keyword ssh_key: A path (or paths) to an SSH private key with which
+ :param ssh_key: A path (or paths) to an SSH private key with which
to attempt to authenticate. (optional)
- @type ssh_key: C{str} or C{list} of C{str}
+ :type ssh_key: ``str`` or ``list`` of ``str``
- @keyword timeout: How many seconds to wait before timing out.
+ :param timeout: How many seconds to wait before timing out.
(default is 600)
- @type timeout: C{int}
+ :type timeout: ``int``
- @keyword max_tries: How many times to retry if a deployment fails
+ :param max_tries: How many times to retry if a deployment fails
before giving up (default is 3)
- @type max_tries: C{int}
+ :type max_tries: ``int``
- @keyword ssh_interface: The interface to wait for. Default is
+ :param ssh_interface: The interface to wait for. Default is
'public_ips', other option is 'private_ips'.
- @type ssh_interface: C{str}
+ :type ssh_interface: ``str``
"""
if not libcloud.compute.ssh.have_paramiko:
raise RuntimeError('paramiko is not installed. You can install ' +
@@ -734,23 +734,23 @@ class NodeDriver(BaseDriver):
"""
Create a new volume.
- @param size: Size of volume in gigabytes (required)
- @type size: C{int}
+ :param size: Size of volume in gigabytes (required)
+ :type size: ``int``
- @keyword name: Name of the volume to be created
- @type name: C{str}
+ :param name: Name of the volume to be created
+ :type name: ``str``
- @keyword location: Which data center to create a volume in. If
+ :param location: Which data center to create a volume in. If
empty, undefined behavoir will be selected.
(optional)
- @type location: L{NodeLocation}
+ :type location: :class:`NodeLocation`
- @keyword snapshot: Name of snapshot from which to create the new
+ :param snapshot: Name of snapshot from which to create the new
volume. (optional)
- @type snapshot: C{str}
+ :type snapshot: ``str``
- @return: The newly created volume.
- @rtype: L{StorageVolume}
+ :return: The newly created volume.
+ :rtype: :class:`StorageVolume`
"""
raise NotImplementedError(
'create_volume not implemented for this driver')
@@ -759,10 +759,10 @@ class NodeDriver(BaseDriver):
"""
Destroys a storage volume.
- @param volume: Volume to be destroyed
- @type volume: L{StorageVolume}
+ :param volume: Volume to be destroyed
+ :type volume: :class:`StorageVolume`
- @rtype: C{bool}
+ :rtype: ``bool``
"""
raise NotImplementedError(
@@ -772,17 +772,11 @@ class NodeDriver(BaseDriver):
"""
Attaches volume to node.
- @param node: Node to attach volume to
- @type node: L{Node}
+ :param Node node: Node to attach volume to.
+ :param StorageVolume volume: Volume to attach.
+ :param str device: Where the device is exposed, e.g. '/dev/sdb'
- @param volume: Volume to attach
- @type volume: L{StorageVolume}
-
- @param device: Where the device is exposed,
- e.g. '/dev/sdb (optional)
- @type device: C{str}
-
- @rtype: C{bool}
+ :return bool:
"""
raise NotImplementedError('attach not implemented for this driver')
@@ -790,10 +784,8 @@ class NodeDriver(BaseDriver):
"""
Detaches a volume from a node.
- @param volume: Volume to be detached
- @type volume: L{StorageVolume}
-
- @rtype: C{bool}
+ :param StorageVolume volume: Volume to be detached
+ :return bool:
"""
raise NotImplementedError('detach not implemented for this driver')
@@ -802,8 +794,7 @@ class NodeDriver(BaseDriver):
"""
List storage volumes.
- @return: list of storageVolume objects
- @rtype: C{list} of L{StorageVolume}
+ :return [StorageVolume]:
"""
raise NotImplementedError(
'list_volumes not implemented for this driver')
@@ -812,7 +803,7 @@ class NodeDriver(BaseDriver):
"""
List snapshots for a storage volume.
- @rtype: C{list} of L{VolumeSnapshot}
+ :rtype: ``list`` of :class:`VolumeSnapshot`
"""
raise NotImplementedError(
'list_volume_snapshots not implemented for this driver')
@@ -821,7 +812,7 @@ class NodeDriver(BaseDriver):
"""
Creates a snapshot of the storage volume.
- @rtype: L{VolumeSnapshot}
+ :rtype: :class:`VolumeSnapshot`
"""
raise NotImplementedError(
'create_volume_snapshot not implemented for this driver')
@@ -830,7 +821,7 @@ class NodeDriver(BaseDriver):
"""
Destroys a snapshot.
- @rtype: L{bool}
+ :rtype: :class:`bool`
"""
raise NotImplementedError(
'destroy_volume_snapshot not implemented for this driver')
@@ -850,31 +841,28 @@ class NodeDriver(BaseDriver):
Block until the given nodes are fully booted and have an IP address
assigned.
- @keyword nodes: list of node instances.
- @type nodes: C{List} of L{Node}
+ :param nodes: list of node instances.
+ :type nodes: ``List`` of :class:`Node`
- @keyword wait_period: How many seconds to between each loop
+ :param wait_period: How many seconds to between each loop
iteration (default is 3)
- @type wait_period: C{int}
+ :type wait_period: ``int``
- @keyword timeout: How many seconds to wait before timing out
+ :param timeout: How many seconds to wait before timing out
(default is 600)
- @type timeout: C{int}
+ :type timeout: ``int``
- @keyword ssh_interface: The interface to wait for.
+ :param ssh_interface: The interface to wait for.
Default is 'public_ips', other option is
'private_ips'.
- @type ssh_interface: C{str}
+ :type ssh_interface: ``str``
- @keyword force_ipv4: Ignore ipv6 IP addresses (default is True).
- @type force_ipv4: C{bool}
+ :param force_ipv4: Ignore ipv6 IP addresses (default is True).
+ :type force_ipv4: ``bool``
- @return: C{[(Node, ip_addresses)]} list of tuple of Node instance and
+ :return: ``[(Node, ip_addresses)]`` list of tuple of Node instance and
list of ip_address on success.
-
- @return: List of tuple of Node instance and list of ip_address on
- success (node, ip_addresses).
- @rtype: C{list} of C{tuple}
+ :rtype: ``list`` of ``tuple``
"""
def is_supported(address):
"""Return True for supported address"""
@@ -923,18 +911,18 @@ class NodeDriver(BaseDriver):
Try to connect to the remote SSH server. If a connection times out or
is refused it is retried up to timeout number of seconds.
- @keyword ssh_client: A configured SSHClient instance
- @type ssh_client: C{SSHClient}
+ :param ssh_client: A configured SSHClient instance
+ :type ssh_client: ``SSHClient``
- @keyword wait_period: How many seconds to wait between each loop
+ :param wait_period: How many seconds to wait between each loop
iteration (default is 1.5)
- @type wait_period: C{int}
+ :type wait_period: ``int``
- @keyword timeout: How many seconds to wait before timing out
+ :param timeout: How many seconds to wait before timing out
(default is 600)
- @type timeout: C{int}
+ :type timeout: ``int``
- @return: C{SSHClient} on success
+ :return: ``SSHClient`` on success
"""
start = time.time()
end = start + timeout
@@ -978,20 +966,20 @@ class NodeDriver(BaseDriver):
Run the deployment script on the provided node. At this point it is
assumed that SSH connection has already been established.
- @keyword task: Deployment task to run on the node.
- @type task: C{Deployment}
+ :param task: Deployment task to run on the node.
+ :type task: ``Deployment``
- @keyword node: Node to operate one
- @type node: C{Node}
+ :param node: Node to operate one
+ :type node: ``Node``
- @keyword ssh_client: A configured and connected SSHClient instance
- @type ssh_client: C{SSHClient}
+ :param ssh_client: A configured and connected SSHClient instance
+ :type ssh_client: ``SSHClient``
- @keyword max_tries: How many times to retry if a deployment fails
+ :param max_tries: How many times to retry if a deployment fails
before giving up (default is 3)
- @type max_tries: C{int}
+ :type max_tries: ``int``
- @return: C{Node} Node instance on success.
+ :return: ``Node`` Node instance on success.
"""
tries = 0
while tries < max_tries:
@@ -1018,10 +1006,10 @@ def is_private_subnet(ip):
"""
Utility function to check if an IP address is inside a private subnet.
- @type ip: C{str}
- @keyword ip: IP address to check
+ :type ip: ``str``
+ :param ip: IP address to check
- @return: C{bool} if the specified IP address is private.
+ :return: ``bool`` if the specified IP address is private.
"""
priv_subnets = [{'subnet': '10.0.0.0', 'mask': '255.0.0.0'},
{'subnet': '172.16.0.0', 'mask': '255.240.0.0'},
@@ -1043,7 +1031,7 @@ def is_valid_ip_address(address, family=socket.AF_INET):
"""
Check if the provided address is valid IPv4 or IPv6 adddress.
- @return: C{bool} True if the provided address is valid.
+ :return: ``bool`` True if the provided address is valid.
"""
try:
socket.inet_pton(family, address)
[07/22] git commit: Print Python version, change if statement.
Posted by to...@apache.org.
Print Python version, change if statement.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/259657f2
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/259657f2
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/259657f2
Branch: refs/heads/0.13.x
Commit: 259657f2372476081695c369bce0875e64b6eb0b
Parents: 67b5934
Author: Tomaz Muraus <to...@apache.org>
Authored: Wed Jul 31 22:38:39 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:48 2013 +0200
----------------------------------------------------------------------
libcloud/utils/py3.py | 5 ++++-
setup.py | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/259657f2/libcloud/utils/py3.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/py3.py b/libcloud/utils/py3.py
index 0d6987d..206324e 100644
--- a/libcloud/utils/py3.py
+++ b/libcloud/utils/py3.py
@@ -146,4 +146,7 @@ if PY25:
return posixpath.curdir
return posixpath.join(*rel_list)
-unittest2_required = not (PY27 or PY3)
+if PY27 or PY3:
+ unittest2_required = False
+else:
+ unittest2_required = True
http://git-wip-us.apache.org/repos/asf/libcloud/blob/259657f2/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index 1adee5d..fc82122 100644
--- a/setup.py
+++ b/setup.py
@@ -95,6 +95,7 @@ class TestCommand(Command):
import unittest2
unittest2
except ImportError:
+ print('Python version: %s' % (sys.version))
print('Missing "unittest2" library. unittest2 is library is needed '
'to run the tests. You can install it using pip: '
'pip install unittest2')
[05/22] git commit: Typo fix
Posted by to...@apache.org.
Typo fix
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/bd1e71bb
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bd1e71bb
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bd1e71bb
Branch: refs/heads/0.13.x
Commit: bd1e71bb12b91f49ad7fd6d4ab52da6b5ae9958d
Parents: e8101cb
Author: Alex Gaynor <al...@gmail.com>
Authored: Wed Jul 31 14:41:55 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:48 2013 +0200
----------------------------------------------------------------------
docs/compute/index.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bd1e71bb/docs/compute/index.rst
----------------------------------------------------------------------
diff --git a/docs/compute/index.rst b/docs/compute/index.rst
index 7a618a0..5c0939a 100644
--- a/docs/compute/index.rst
+++ b/docs/compute/index.rst
@@ -20,4 +20,4 @@ Terminology
* **NodeImage** - represents an operating system image.
* **NodeLocation** - represents a physical location where a server can be.
* **NodeState** - represents a node state. Standard states are: ``running``,
- ``rebooting``, ``terminated``, ``pending``, and ``unknown```.
+ ``rebooting``, ``terminated``, ``pending``, and ``unknown``.
[11/22] git commit: Remove CLI stuff since it will be part of a
separate PR.
Posted by to...@apache.org.
Remove CLI stuff since it will be part of a separate PR.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e6436559
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e6436559
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e6436559
Branch: refs/heads/0.13.x
Commit: e64365592bf63ac7b826ce1c3685bd417eef97ec
Parents: 11db737
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Wed Jul 31 19:48:37 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:49 2013 +0200
----------------------------------------------------------------------
bin/libcloud | 30 ----------------
libcloud/cli/__init__.py | 0
libcloud/cli/pricing.py | 84 -------------------------------------------
3 files changed, 114 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e6436559/bin/libcloud
----------------------------------------------------------------------
diff --git a/bin/libcloud b/bin/libcloud
deleted file mode 100755
index 270922e..0000000
--- a/bin/libcloud
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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 __future__ import with_statement
-
-import argparse
-
-from libcloud.cli.pricing import add_subparser, update_pricing
-
-parser = argparse.ArgumentParser(prog='libcloud', usage='%(prog)s')
-subparsers = parser.add_subparsers(dest='subparser_name')
-add_subparser(subparsers=subparsers)
-
-args = parser.parse_args()
-
-if args.subparser_name == 'update-pricing':
- update_pricing(file_url=args.file_url, file_path=args.file_path)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e6436559/libcloud/cli/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/cli/__init__.py b/libcloud/cli/__init__.py
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e6436559/libcloud/cli/pricing.py
----------------------------------------------------------------------
diff --git a/libcloud/cli/pricing.py b/libcloud/cli/pricing.py
deleted file mode 100644
index 584d292..0000000
--- a/libcloud/cli/pricing.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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 sys
-
-try:
- import simplejson as json
-except ImportError:
- import json
-
-
-from libcloud.pricing import CUSTOM_PRICING_FILE_PATH
-from libcloud.utils.connection import get_response_object
-
-__all__ = [
- 'add_subparser',
- 'update_pricing'
-]
-
-# Default URL to the pricing file
-DEFAULT_FILE_URL = 'https://git-wip-us.apache.org/repos/asf?p=libcloud.git;a=blob_plain;f=libcloud/data/pricing.json'
-
-
-def add_subparser(subparsers):
- parser = subparsers.add_parser('update-pricing',
- help='Update Libcloud pricing file')
- parser.add_argument('--file-path', dest='file_path', action='store',
- default=CUSTOM_PRICING_FILE_PATH,
- help='Path where the file will be saved')
- parser.add_argument('--file-url', dest='file_url', action='store',
- default=DEFAULT_FILE_URL,
- help='URL to the pricing file')
- return parser
-
-
-def update_pricing(file_url, file_path):
- dir_name = os.path.dirname(file_path)
-
- if not os.path.exists(dir_name):
- # Verify a valid path is provided
- sys.stderr.write('Can\'t write to %s, directory %s, doesn\'t exist\n' %
- (file_path, dir_name))
- sys.exit(2)
-
- if os.path.exists(file_path) and os.path.isdir(file_path):
- sys.stderr.write('Can\'t write to %s file path because it\'s a'
- ' directory\n' %
- (file_path))
- sys.exit(2)
-
- response = get_response_object(file_url)
- body = response.body
-
- # Verify pricing file is valid
- try:
- data = json.loads(body)
- except json.decoder.JSONDecodeError:
- sys.stderr.write('Provided URL doesn\'t contain valid pricing'
- ' data\n')
- sys.exit(3)
-
- if not data.get('updated', None):
- sys.stderr.write('Provided URL doesn\'t contain valid pricing'
- ' data\n')
- sys.exit(3)
-
- # No need to stream it since file is small
- with open(file_path, 'w') as file_handle:
- file_handle.write(response.body)
-
- print('Pricing file saved to %s' % (file_path))
[20/22] git commit: Update changes.
Posted by to...@apache.org.
Update changes.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5820e018
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5820e018
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5820e018
Branch: refs/heads/0.13.x
Commit: 5820e01886fa9ed73261c5e006b511d8873a2a4a
Parents: caa7ab9
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Aug 1 14:31:22 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:50 2013 +0200
----------------------------------------------------------------------
CHANGES | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/5820e018/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index a308d8b..b9917a6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,17 @@
Changes with Apache Libcloud in development
+ *) General
+
+ - By default read pricing data from ~/.libcloud/pricing.json if this file
+ exists. If it doesn't it uses old behavior and falls back to pricing file
+ bundled with a libcloud release.
+ [Tomaz Muraus]
+
+ - Add libcloud.pricing.download_pricing_file function for downloading and
+ updating the pricing file.
+ [Tomaz Muraus]
+
*) Compute
- Modify ElasticHosts drive to store drive UUID in 'extra' field.
[09/22] git commit: Modify py26 tox environment to also run coverage
command.
Posted by to...@apache.org.
Modify py26 tox environment to also run coverage command.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ade45fde
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ade45fde
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ade45fde
Branch: refs/heads/0.13.x
Commit: ade45fdea2d93a2d15af39bc2fac0eb522a282e9
Parents: 259657f
Author: Tomaz Muraus <to...@apache.org>
Authored: Wed Jul 31 23:17:51 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:48 2013 +0200
----------------------------------------------------------------------
tox.ini | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/ade45fde/tox.ini
----------------------------------------------------------------------
diff --git a/tox.ini b/tox.ini
index 7212a7e..536b750 100644
--- a/tox.ini
+++ b/tox.ini
@@ -10,6 +10,15 @@ deps = mock
paramiko
commands = python setup.py test
+[testenv:py26]
+deps = mock
+ unittest2
+ lockfile
+ paramiko
+ coverage
+commands = python setup.py test
+ python setup.py coverage
+
[testenv:py25]
deps = mock
unittest2
[14/22] git commit: Allow user to use a custom pricing file by
placing a file to ~/.libcloud/pricing.json.
Posted by to...@apache.org.
Allow user to use a custom pricing file by placing a file to ~/.libcloud/pricing.json.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5fa1610c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5fa1610c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5fa1610c
Branch: refs/heads/0.13.x
Commit: 5fa1610cdad7400303af8d6cdfb4d19d6bb81d59
Parents: be1bdc0
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Fri Jun 14 21:50:50 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:49 2013 +0200
----------------------------------------------------------------------
libcloud/pricing.py | 43 ++++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/5fa1610c/libcloud/pricing.py
----------------------------------------------------------------------
diff --git a/libcloud/pricing.py b/libcloud/pricing.py
index 3ed32d2..db3b674 100644
--- a/libcloud/pricing.py
+++ b/libcloud/pricing.py
@@ -25,27 +25,26 @@ except ImportError:
import os.path
from os.path import join as pjoin
-PRICING_FILE_PATH = 'data/pricing.json'
+CURRENT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
+DEFAULT_PRICING_FILE_PATH = pjoin(CURRENT_DIRECTORY, 'data/pricing.json')
+CUSTOM_PRICING_FILE_PATH = os.path.expanduser('~/.libcloud/pricing.json')
-PRICING_DATA = {}
+# Pricing data cache
+PRICING_DATA = {
+ 'compute': {},
+ 'storage': {}
+}
VALID_PRICING_DRIVER_TYPES = ['compute', 'storage']
-def clear_pricing_data():
- PRICING_DATA.clear()
- PRICING_DATA.update({
- 'compute': {},
- 'storage': {},
- })
-clear_pricing_data()
-
-
def get_pricing_file_path(file_path=None):
- pricing_directory = os.path.dirname(os.path.abspath(__file__))
- pricing_file_path = pjoin(pricing_directory, PRICING_FILE_PATH)
+ if os.path.exists(CUSTOM_PRICING_FILE_PATH) and \
+ os.path.isfile(CUSTOM_PRICING_FILE_PATH):
+ # Custom pricing file is available, use it
+ return CUSTOM_PRICING_FILE_PATH
- return pricing_file_path
+ return DEFAULT_PRICING_FILE_PATH
def get_pricing(driver_type, driver_name, pricing_file_path=None):
@@ -58,6 +57,10 @@ def get_pricing(driver_type, driver_name, pricing_file_path=None):
@type driver_name: C{str}
@param driver_name: Driver name
+ @type pricing_file_path: C{str}
+ @param pricing_file_path: Custom path to a price file. If not provided
+ it uses a default path.
+
@rtype: C{dict}
@return: Dictionary with pricing where a key name is size ID and
the value is a price.
@@ -126,12 +129,22 @@ def get_size_price(driver_type, driver_name, size_id):
def invalidate_pricing_cache():
"""
- Invalidate the cache for all the drivers.
+ Invalidate pricing cache for all the drivers.
"""
PRICING_DATA['compute'] = {}
PRICING_DATA['storage'] = {}
+def clear_pricing_data():
+ """
+ Invalidate pricing cache for all the drivers.
+
+ Note: This method does the same thing as invalidate_pricing_cache and is
+ here for backward compatibility reasons.
+ """
+ invalidate_pricing_cache()
+
+
def invalidate_module_pricing_cache(driver_type, driver_name):
"""
Invalidate the cache for the specified driver.
[19/22] git commit: Fix a typo.
Posted by to...@apache.org.
Fix a typo.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/caa7ab9f
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/caa7ab9f
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/caa7ab9f
Branch: refs/heads/0.13.x
Commit: caa7ab9fdb99a099dab683e550d7b4e782e85713
Parents: a1eda4e
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Wed Jul 31 19:54:20 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:50 2013 +0200
----------------------------------------------------------------------
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/caa7ab9f/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index fc82122..1ed4ebd 100644
--- a/setup.py
+++ b/setup.py
@@ -119,7 +119,7 @@ class TestCommand(Command):
if mtime_dist > mtime_current:
print("It looks like test/secrets.py file is out of date.")
- print("Please copy the new secret.py-dist file over otherwise" +
+ print("Please copy the new secrets.py-dist file over otherwise" +
" tests might fail")
if pre_python26:
[10/22] git commit: Revert "Add argparse dependency for Python < 2.6
and >= 3.1 and <= 3.2."
Posted by to...@apache.org.
Revert "Add argparse dependency for Python < 2.6 and >= 3.1 and <= 3.2."
This reverts commit a62b97a098441603832deb239307a8cd7cf53029.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a1eda4e3
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a1eda4e3
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a1eda4e3
Branch: refs/heads/0.13.x
Commit: a1eda4e361f9f63c0b1a90229a976a173961dc06
Parents: e643655
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Wed Jul 31 19:51:04 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:49 2013 +0200
----------------------------------------------------------------------
libcloud/utils/py3.py | 4 ----
setup.py | 11 ++---------
2 files changed, 2 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a1eda4e3/libcloud/utils/py3.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/py3.py b/libcloud/utils/py3.py
index 1c44c27..206324e 100644
--- a/libcloud/utils/py3.py
+++ b/libcloud/utils/py3.py
@@ -28,7 +28,6 @@ PY2 = False
PY25 = False
PY27 = False
PY3 = False
-PY31 = False
PY32 = False
if sys.version_info >= (2, 0) and sys.version_info < (3, 0):
@@ -43,9 +42,6 @@ if sys.version_info >= (2, 7) and sys.version_info <= (2, 8):
if sys.version_info >= (3, 0):
PY3 = True
-if sys.version_info >= (3, 1) and sys.version_info < (3, 2):
- PY31 = True
-
if sys.version_info >= (3, 2) and sys.version_info < (3, 3):
PY32 = True
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a1eda4e3/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index 2bbeba7..fc82122 100644
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,7 @@ except ImportError:
import libcloud.utils.misc
from libcloud.utils.dist import get_packages, get_data_files
-from libcloud.utils.py3 import unittest2_required, PY31, PY32
+from libcloud.utils.py3 import unittest2_required
libcloud.utils.misc.SHOW_DEPRECATION_WARNING = False
@@ -229,13 +229,6 @@ class CoverageCommand(Command):
cov.save()
cov.html_report()
-if pre_python26:
- dependencies = ['ssl', 'simplejson', 'argparse']
-elif PY31 or PY32:
- dependencies = ['argparse']
-else:
- dependencies = []
-
setup(
name='apache-libcloud',
@@ -245,7 +238,7 @@ setup(
' and documentation, please see http://libcloud.apache.org',
author='Apache Software Foundation',
author_email='dev@libcloud.apache.org',
- requires=dependencies,
+ requires=([], ['ssl', 'simplejson'],)[pre_python26],
packages=get_packages('libcloud'),
package_dir={
'libcloud': 'libcloud',
[06/22] git commit: Noted that the Sphinx docs are a work in progress
Posted by to...@apache.org.
Noted that the Sphinx docs are a work in progress
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/67b5934b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/67b5934b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/67b5934b
Branch: refs/heads/0.13.x
Commit: 67b5934b01095bf4618be47975a4b00767946355
Parents: 5198be7
Author: Alex Gaynor <al...@gmail.com>
Authored: Wed Jul 31 12:20:03 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:48 2013 +0200
----------------------------------------------------------------------
docs/index.rst | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/67b5934b/docs/index.rst
----------------------------------------------------------------------
diff --git a/docs/index.rst b/docs/index.rst
index 4675c85..9d3438c 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,6 +1,10 @@
Welcome to Apache Libcloud's documentation!
===========================================
+Right now we're in the progress of migrating our existing documentation to
+Sphinx, so this may be incomplete. We apologize for the inconvenience and we
+hope the upcoming awesomeness will make up for it.
+
Contents:
.. toctree::
[08/22] git commit: Initial set of indices for each component
Posted by to...@apache.org.
Initial set of indices for each component
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e8101cb4
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e8101cb4
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e8101cb4
Branch: refs/heads/0.13.x
Commit: e8101cb4cbbf682eb2c459ff80be245c26bb6fbd
Parents: ade45fd
Author: Alex Gaynor <al...@gmail.com>
Authored: Wed Jul 31 14:28:30 2013 -0700
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Aug 1 20:28:48 2013 +0200
----------------------------------------------------------------------
docs/compute/index.rst | 23 +++++++++++++++++++++++
docs/dns/index.rst | 2 ++
docs/index.rst | 27 +++++++++++++++++++++++----
docs/loadbalancers/index.rst | 2 ++
docs/storage/index.rst | 2 ++
5 files changed, 52 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e8101cb4/docs/compute/index.rst
----------------------------------------------------------------------
diff --git a/docs/compute/index.rst b/docs/compute/index.rst
new file mode 100644
index 0000000..7a618a0
--- /dev/null
+++ b/docs/compute/index.rst
@@ -0,0 +1,23 @@
+Compute
+=======
+
+The compute component of ``libcloud`` allows you to manage cloud and virtual
+servers offered by different providers, more than 20 in total.
+
+In addition to managing the servers this component also allows you to run
+deployment scripts on newly created servers. Deployment or "bootstrap" scripts
+allow you to execute arbitrary shell commands. This functionality is usually
+used to prepare your freshly created server, install your SSH key, and run a
+configuration management tool (such as Puppet, Chef, or cfengine) on it.
+
+Terminology
+-----------
+
+* **Node** - represents a cloud or virtual server.
+* **NodeSize** - represents node hardware configuration. Usually this is amount
+ of the available RAM, bandwidth, CPU speed and disk size. Most of the drivers
+ also expose hourly price (in dollars) for the Node of this size.
+* **NodeImage** - represents an operating system image.
+* **NodeLocation** - represents a physical location where a server can be.
+* **NodeState** - represents a node state. Standard states are: ``running``,
+ ``rebooting``, ``terminated``, ``pending``, and ``unknown```.
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e8101cb4/docs/dns/index.rst
----------------------------------------------------------------------
diff --git a/docs/dns/index.rst b/docs/dns/index.rst
new file mode 100644
index 0000000..51bbfe3
--- /dev/null
+++ b/docs/dns/index.rst
@@ -0,0 +1,2 @@
+DNS
+===
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e8101cb4/docs/index.rst
----------------------------------------------------------------------
diff --git a/docs/index.rst b/docs/index.rst
index 9d3438c..bf200e0 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,11 +1,30 @@
Welcome to Apache Libcloud's documentation!
===========================================
-Right now we're in the progress of migrating our existing documentation to
-Sphinx, so this may be incomplete. We apologize for the inconvenience and we
-hope the upcoming awesomeness will make up for it.
+.. note::
+
+ Right now we're in the progress of migrating our existing documentation to
+ Sphinx, so this may be incomplete. We apologize for the inconvenience and we
+ hope the upcoming awesomeness will make up for it.
+
+Apache Libcloud is a Python library which abstracts away the differences
+between multiple cloud providers. It current can manage four different cloud
+resources:
+
+* :doc:`Cloud servers <compute/index>` - services such as Amazon EC2 and
+ RackSpace CloudServers
+* :doc:`Cloud object storage <storage/index>` - services such as Amazon S3 and
+ Rackspace CloudFiles
+* :doc:`Load Balancers as a Service <loadbalancers/index>`
+* :doc:`DNS as a Service <dns/index>`
+
Contents:
.. toctree::
- :maxdepth: 2
+ :maxdepth: 1
+
+ compute/index
+ storage/index
+ loadbalancers/index
+ dns/index
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e8101cb4/docs/loadbalancers/index.rst
----------------------------------------------------------------------
diff --git a/docs/loadbalancers/index.rst b/docs/loadbalancers/index.rst
new file mode 100644
index 0000000..35c5ed1
--- /dev/null
+++ b/docs/loadbalancers/index.rst
@@ -0,0 +1,2 @@
+Load Balancers
+==============
http://git-wip-us.apache.org/repos/asf/libcloud/blob/e8101cb4/docs/storage/index.rst
----------------------------------------------------------------------
diff --git a/docs/storage/index.rst b/docs/storage/index.rst
new file mode 100644
index 0000000..17a6f7c
--- /dev/null
+++ b/docs/storage/index.rst
@@ -0,0 +1,2 @@
+Object Storage
+==============