From c34d85fbc51b58cbdac15f9a8f5c9754fd2be5ca Mon Sep 17 00:00:00 2001 From: Uggla Date: Thu, 11 Feb 2016 16:12:56 +0100 Subject: [PATCH] Documentation update - Put in place sphinx mechanism to build documentation. Most of the documentation is generated from python docstrings. - redfish-client.py usage is a bit modified to display a decent documentation. - A link rfclient.py to redfish-client.py was created to allow sphinx parsing. The '-' char is not allowed for module and so sphinx autodoc module. - Note : Copyright may need to be reviewed as well as main.py. --- README.rst | 5 +- doc/Makefile | 177 ++++++++++ doc/source/classesdoc.rst | 9 + doc/source/conf.py | 329 ++++++++++++++++-- doc/source/index.rst | 1 + doc/source/python-redfish_classes/config.rst | 6 + .../python-redfish_classes/exception.rst | 6 + doc/source/python-redfish_classes/main.rst | 6 + doc/source/python-redfish_classes/mapping.rst | 6 + doc/source/python-redfish_classes/types.rst | 6 + doc/source/python-redfish_lib.rst | 8 + doc/source/redfish-client.rst | 7 + redfish-client/redfish-client.py | 82 ++--- redfish-client/rfclient.py | 1 + redfish/config.py | 6 +- redfish/types.py | 8 +- requirements.txt | 1 + 17 files changed, 576 insertions(+), 88 deletions(-) create mode 100644 doc/Makefile create mode 100644 doc/source/classesdoc.rst mode change 100755 => 100644 doc/source/conf.py create mode 100644 doc/source/python-redfish_classes/config.rst create mode 100644 doc/source/python-redfish_classes/exception.rst create mode 100644 doc/source/python-redfish_classes/main.rst create mode 100644 doc/source/python-redfish_classes/mapping.rst create mode 100644 doc/source/python-redfish_classes/types.rst create mode 100644 doc/source/python-redfish_lib.rst create mode 100644 doc/source/redfish-client.rst create mode 120000 redfish-client/rfclient.py diff --git a/README.rst b/README.rst index 7855714..3491806 100644 --- a/README.rst +++ b/README.rst @@ -45,15 +45,13 @@ Developer setup --------------- To initialize a local development environment (eg, so you can run unit tests) -you should run the following commands:: +you should run the following commands Contacts -------- Distribution list : python-redfish@mondorescue.org - - Further References ------------------ @@ -62,3 +60,4 @@ The data model documentation can be found here: The overall protocol documentation can be found here: http://www.redfishspecification.org/ + diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..e4c5e88 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,177 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.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 ' where 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 " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @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 " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @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/python-redfish.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/python-redfish.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/python-redfish" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/python-redfish" + @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." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @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." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/doc/source/classesdoc.rst b/doc/source/classesdoc.rst new file mode 100644 index 0000000..b209587 --- /dev/null +++ b/doc/source/classesdoc.rst @@ -0,0 +1,9 @@ +===================== +Classes documentation +===================== + +.. toctree:: + :maxdepth: 2 + + python-redfish_lib + redfish-client diff --git a/doc/source/conf.py b/doc/source/conf.py old mode 100755 new mode 100644 index 512d1fa..c0e4fc1 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,75 +1,332 @@ # -*- coding: utf-8 -*- -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# python-redfish documentation build configuration file, created by +# sphinx-quickstart on Wed Feb 10 19:41:20 2016. # -# 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. +# 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 os import sys +import os +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('../..')) -# -- General configuration ---------------------------------------------------- +sys.path.insert(0, os.path.abspath('../../redfish-client')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. extensions = [ 'sphinx.ext.autodoc', - #'sphinx.ext.intersphinx', - 'oslosphinx' + 'sphinx.ext.viewcode', ] -# autodoc generation is a bit aggressive and a nuisance when doing heavy -# text edit cycles. -# execute "export SPHINX_DEBUG=1" in your terminal to disable +# 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'python-redfish' -copyright = u'2013, OpenStack Foundation' +copyright = u'2016, Bruno Cornec, Vincent Misson, René Ribaud' + +# 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.4' +# The full version, including alpha/beta/rc tags. +release = '0.4' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -add_function_parentheses = True +#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 +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' -# -- Options for HTML output -------------------------------------------------- +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] -# The theme to use for HTML and HTML Help pages. Major themes that come with -# Sphinx are currently 'default' and 'sphinxdoc'. -# html_theme_path = ["."] -# html_theme = '_theme' -# html_static_path = ['static'] +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project +htmlhelp_basename = 'python-redfishdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} # Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass -# [howto/manual]). +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', - '%s.tex' % project, - u'%s Documentation' % project, - u'OpenStack Foundation', 'manual'), + ('index', 'python-redfish.tex', u'python-redfish Documentation', + u'Bruno Cornec, Vincent Misson, René Ribaud', 'manual'), ] -# Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None} +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'python-redfish', u'python-redfish Documentation', + [u'Bruno Cornec, Vincent Misson, René Ribaud'], 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', 'python-redfish', u'python-redfish Documentation', + u'Bruno Cornec, Vincent Misson, René Ribaud', 'python-redfish', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + + +# -- Options for Epub output ---------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = u'python-redfish' +epub_author = u'Bruno Cornec, Vincent Misson, René Ribaud' +epub_publisher = u'Bruno Cornec, Vincent Misson, René Ribaud' +epub_copyright = u'2016, Bruno Cornec, Vincent Misson, René Ribaud' + +# The basename for the epub file. It defaults to the project name. +#epub_basename = u'python-redfish' + +# The HTML theme for the epub output. Since the default themes are not optimized +# for small screen space, using the same theme for HTML and epub output is +# usually not wise. This defaults to 'epub', a theme designed to save visual +# space. +#epub_theme = 'epub' + +# The language of the text. It defaults to the language option +# or en if the language is not set. +#epub_language = '' + +# The scheme of the identifier. Typical schemes are ISBN or URL. +#epub_scheme = '' + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +#epub_identifier = '' + +# A unique identification for the text. +#epub_uid = '' + +# A tuple containing the cover image and cover page html template filenames. +#epub_cover = () + +# A sequence of (type, uri, title) tuples for the guide element of content.opf. +#epub_guide = () + +# HTML files that should be inserted before the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_pre_files = [] + +# HTML files shat should be inserted after the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_post_files = [] + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] + +# The depth of the table of contents in toc.ncx. +#epub_tocdepth = 3 + +# Allow duplicate toc entries. +#epub_tocdup = True + +# Choose between 'default' and 'includehidden'. +#epub_tocscope = 'default' + +# Fix unsupported image types using the PIL. +#epub_fix_images = False + +# Scale large images. +#epub_max_image_width = 0 + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#epub_show_urls = 'inline' + +# If false, no index is generated. +#epub_use_index = True diff --git a/doc/source/index.rst b/doc/source/index.rst index c623c94..af8520f 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -15,6 +15,7 @@ Contents: installation usage contributing + classesdoc Indices and tables ================== diff --git a/doc/source/python-redfish_classes/config.rst b/doc/source/python-redfish_classes/config.rst new file mode 100644 index 0000000..b704fdd --- /dev/null +++ b/doc/source/python-redfish_classes/config.rst @@ -0,0 +1,6 @@ +============ +config class +============ + +.. automodule:: redfish.config + :members: diff --git a/doc/source/python-redfish_classes/exception.rst b/doc/source/python-redfish_classes/exception.rst new file mode 100644 index 0000000..80dc554 --- /dev/null +++ b/doc/source/python-redfish_classes/exception.rst @@ -0,0 +1,6 @@ +=============== +exception class +=============== + +.. automodule:: redfish.exception + :members: diff --git a/doc/source/python-redfish_classes/main.rst b/doc/source/python-redfish_classes/main.rst new file mode 100644 index 0000000..2a6e1c3 --- /dev/null +++ b/doc/source/python-redfish_classes/main.rst @@ -0,0 +1,6 @@ +========== +main class +========== + +.. automodule:: redfish.main + :members: diff --git a/doc/source/python-redfish_classes/mapping.rst b/doc/source/python-redfish_classes/mapping.rst new file mode 100644 index 0000000..251252b --- /dev/null +++ b/doc/source/python-redfish_classes/mapping.rst @@ -0,0 +1,6 @@ +============= +mapping class +============= + +.. automodule:: redfish.mapping + :members: diff --git a/doc/source/python-redfish_classes/types.rst b/doc/source/python-redfish_classes/types.rst new file mode 100644 index 0000000..9191577 --- /dev/null +++ b/doc/source/python-redfish_classes/types.rst @@ -0,0 +1,6 @@ +=========== +types class +=========== + +.. automodule:: redfish.types + :members: diff --git a/doc/source/python-redfish_lib.rst b/doc/source/python-redfish_lib.rst new file mode 100644 index 0000000..4de9220 --- /dev/null +++ b/doc/source/python-redfish_lib.rst @@ -0,0 +1,8 @@ +====================== +python-redfish classes +====================== + +.. toctree:: + :glob: + + python-redfish_classes/* diff --git a/doc/source/redfish-client.rst b/doc/source/redfish-client.rst new file mode 100644 index 0000000..50547f9 --- /dev/null +++ b/doc/source/redfish-client.rst @@ -0,0 +1,7 @@ +====================== +redfish-client classes +====================== + +.. automodule:: rfclient + :members: + diff --git a/redfish-client/redfish-client.py b/redfish-client/redfish-client.py index 6056d59..25ed9fc 100755 --- a/redfish-client/redfish-client.py +++ b/redfish-client/redfish-client.py @@ -3,32 +3,32 @@ # coding=utf-8 ''' -redfish-client +redfish-client :: -Usage: - redfish-client.py [options] config add [] [] - redfish-client.py [options] config del - redfish-client.py [options] config modify (manager_name | url | login | password) - redfish-client.py [options] config show - redfish-client.py [options] config showall - redfish-client.py [options] manager getinfo [] - redfish-client.py (-h | --help) - redfish-client.py --version - - -Options: - -h --help Show this screen. - --version Show version. - --conf_file FILE Configuration file [default: ~/.redfish.conf] - --insecure Ignore SSL certificates - --debug LEVEL Run in debug mode, LEVEL from 1 to 3 increase verbosity - Security warning LEVEL > 1 could reveal password into the logs - --debugfile FILE Specify the client debugfile [default: redfish-client.log] - --libdebugfile FILE Specify python-redfish library log file [default: /var/log/python-redfish/python-redfish.log] - -config commands : manage the configuration file. -manager commands : manage the manager (Ligh out management). If - is not provided use the 'default' entry + Usage: + redfish-client.py [options] config add [] [] + redfish-client.py [options] config del + redfish-client.py [options] config modify (manager_name | url | login | password) + redfish-client.py [options] config show + redfish-client.py [options] config showall + redfish-client.py [options] manager getinfo [] + redfish-client.py (-h | --help) + redfish-client.py --version + + + Options: + -h --help Show this screen. + --version Show version. + --conf_file FILE Configuration file [default: ~/.redfish.conf] + --insecure Ignore SSL certificates + --debug LEVEL Run in debug mode, LEVEL from 1 to 3 increase verbosity + Security warning LEVEL > 1 could reveal password into the logs + --debugfile FILE Specify the client debugfile [default: redfish-client.log] + --libdebugfile FILE Specify python-redfish library log file [default: /var/log/python-redfish/python-redfish.log] + + config commands : manage the configuration file. + manager commands : manage the manager (Ligh out management). If + is not provided use the 'default' entry ''' import os @@ -52,7 +52,7 @@ class ConfigFile(object): :param config_file: File name of the configuration file default: ~/.redfish.conf - :type str + :type config-file: str :returns: Nothing ''' @@ -84,7 +84,7 @@ class ConfigFile(object): '''Check if the manager exists in configuration file :param manager_name: Name of the manager - :type str + :type manager_name: str ''' try: @@ -97,13 +97,13 @@ class ConfigFile(object): '''Add a manager to the configuration file :param manager_name: Name of the manager - :type str + :type manager_name: str :param url: Url of the manager - :type str + :type url: str :param login: Login of the manager - :type str + :type login: str :param password: Password of the manager - :type str + :type password: str ''' @@ -119,12 +119,12 @@ class ConfigFile(object): def modify_manager(self, manager_name, parameter, parameter_value): '''Modify the manager settings - :param manager name: Name of the manager - :type str + :param manager_name: Name of the manager + :type manager_name: str :param parameter: url | login | password - :type str + :type url: str :param parameter_value: Value of the parameter - :type str + :type parameter_value: str :returns: Nothing ''' @@ -157,8 +157,8 @@ class ConfigFile(object): def delete_manager(self, manager_name): '''Delete manager - :param manager name: Name of the manager - :type str + :param manager_name: Name of the manager + :type manager_name: str :returns: Nothing ''' @@ -172,7 +172,7 @@ class ConfigFile(object): '''Get manager configured :returns: Managers - :type list + :type returns: list ''' managers = [] @@ -184,9 +184,9 @@ class ConfigFile(object): '''Show manager info (url, login, password) :param manager: Name of the manager - :type str + :type manager: str :returns: info containing url, login, password - :type dict + :type returns: dict ''' info = {} @@ -214,7 +214,7 @@ if __name__ == '__main__': '''Display manager info :param all: Add login and password info - :type bool + :type all: bool :returns: Nothing ''' diff --git a/redfish-client/rfclient.py b/redfish-client/rfclient.py new file mode 120000 index 0000000..338810b --- /dev/null +++ b/redfish-client/rfclient.py @@ -0,0 +1 @@ +redfish-client.py \ No newline at end of file diff --git a/redfish/config.py b/redfish/config.py index 0799aeb..6ddcccc 100644 --- a/redfish/config.py +++ b/redfish/config.py @@ -19,12 +19,12 @@ def initialize_logger(REDFISH_LOGFILE, '''Initialize a global logger to track application behaviour :param redfish_logfile: Log filename - :type str + :type redfish_logfile: str :param screen_logger_level: Console log level (logging.DEBUG, logging.ERROR, ..) or nolog - :type logging constant or string + :type screen_logger_level: logging constant or string :param file_logger_level: File log level - :type logging constant + :type file_logger_level: logging constant :returns: logging object ''' diff --git a/redfish/types.py b/redfish/types.py index fd6f5f0..ecdd477 100644 --- a/redfish/types.py +++ b/redfish/types.py @@ -54,12 +54,10 @@ class Base(object): def get_link_url(self, link_type): '''Need to be explained. - :param redfish_logfile: redfish log - :type str - :returns: True - + :param parameter_name: name of the parameter + :returns: string -- parameter value ''' - self.links=[] + self.links = [] # Manage standard < 1.0 if float(mapping.redfish_version) < 1.00: diff --git a/requirements.txt b/requirements.txt index 01b840b..a6fc6e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,4 @@ pbr>=0.6,!=0.7,<1.0 Babel>=1.3 tortilla>=0.4.1 Jinja2>=2.7.3 +Sphinx>=1.2.3