diff options
author | Michal Minar <miminar@redhat.com> | 2014-04-22 15:19:56 +0200 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2014-04-24 09:58:44 +0200 |
commit | 2a78da4f98a583a382c553f2e1fc68299210e7d5 (patch) | |
tree | 53029ae0a8474a9ddc464419da7337d0d88dea13 /doc | |
parent | 9138628a62461fd8914d5b82ec6a4ace964a4b2b (diff) | |
download | openlmi-scripts-2a78da4f98a583a382c553f2e1fc68299210e7d5.tar.gz openlmi-scripts-2a78da4f98a583a382c553f2e1fc68299210e7d5.tar.xz openlmi-scripts-2a78da4f98a583a382c553f2e1fc68299210e7d5.zip |
moved lmi meta-command to openlmi-tools repository
Diffstat (limited to 'doc')
-rw-r--r-- | doc/Makefile | 236 | ||||
-rw-r--r-- | doc/README.md | 39 | ||||
-rw-r--r-- | doc/_static/imode-tree.svg | 605 | ||||
-rw-r--r-- | doc/_static/logicalfile.class.violet | 556 | ||||
-rw-r--r-- | doc/_static/logicalfile.png | bin | 32696 -> 0 bytes | |||
-rwxr-xr-x | doc/build-with-sphinx.sh | 34 | ||||
-rw-r--r-- | doc/command-classes.rst | 163 | ||||
-rw-r--r-- | doc/command-properties.rst | 574 | ||||
-rw-r--r-- | doc/conf.py.skel | 290 | ||||
-rw-r--r-- | doc/configuration.rst | 175 | ||||
-rwxr-xr-x | doc/gendoc.sh | 70 | ||||
-rw-r--r-- | doc/index.rst | 25 | ||||
-rw-r--r-- | doc/make.bat | 190 | ||||
-rw-r--r-- | doc/mylf/README.md | 7 | ||||
-rw-r--r-- | doc/mylf/doc/Makefile | 177 | ||||
-rw-r--r-- | doc/mylf/doc/cmdline.rst | 6 | ||||
-rw-r--r-- | doc/mylf/doc/conf.py | 285 | ||||
-rw-r--r-- | doc/mylf/doc/index.rst | 24 | ||||
-rw-r--r-- | doc/mylf/doc/make.bat | 190 | ||||
-rw-r--r-- | doc/mylf/lmi/__init__.py | 27 | ||||
-rw-r--r-- | doc/mylf/lmi/scripts/__init__.py | 27 | ||||
-rw-r--r-- | doc/mylf/lmi/scripts/mylf/__init__.py | 191 | ||||
-rw-r--r-- | doc/mylf/lmi/scripts/mylf/cmd.py | 100 | ||||
-rw-r--r-- | doc/mylf/setup.py | 44 | ||||
-rw-r--r-- | doc/script-development.rst | 668 | ||||
-rw-r--r-- | doc/script-tutorial.rst | 447 | ||||
-rw-r--r-- | doc/usage.rst | 133 |
27 files changed, 0 insertions, 5283 deletions
diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 index 0900330..0000000 --- a/doc/Makefile +++ /dev/null @@ -1,236 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR ?= _build -PROJECTNAME = OpenLMIScripts -COMMANDS_PATH ?= ../commands -INCLUDE_COMMANDS ?= 0 -COMMANDS ?= logicalfile service software storage - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -n -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -TUTORIAL_SOURCES := mylf/*.md mylf/*.py mylf/lmi/*.py mylf/*/*.py mylf/*/*/*.py \ - mylf/doc/*.py mylf/doc/*.rst mylf/doc/Makefile mylf/doc/_static -TUTORIAL_TARBALL := _static/mylf.tar.gz - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp \ - devhelp epub latex latexpdf text man changes linkcheck doctest gettext \ - commands.rst - -export COMMANDS -export INCLUDE_COMMANDS - -all: html - -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)" - -api.rst: gendoc.sh $(wildcard ../lmi/scripts/*.py \ - ../lmi/scripts/common/*.py \ - ../lmi/scripts/_metacommand/*.py \ - ../lmi/scripts/formatter/*.py) - ./gendoc.sh - -commands.rst: - echo "Command libraries documentation" > $@ - echo "===============================" >> $@ -ifneq ($(INCLUDE_COMMANDS), 0) - -[ -e commands ] && rm -rf commands - mkdir commands - echo "Usage and developer documentations of provider libraries" >> $@ - echo "(also called *commands*.)" >> $@ - printf "\n.. toctree::\n" >> $@ - printf " :maxdepth: 2\n\n" >> $@ - for cmd in $(COMMANDS); do \ - printf " commands/$$cmd\n" >> $@; \ - ln -s ../$(COMMANDS_PATH)/$${cmd}/doc commands/$${cmd}_docdir; \ - title="$${cmd^} library"; \ - length=`echo "$$title" | wc -c`; \ - ( \ - printf "$${title}\n"; \ - printf -- "!%.0s" `seq 2 $$length`; \ - printf "\n\n"; \ - if [ -e commands/$${cmd}_docdir/cmdline.rst ]; then \ - sed "s,\(\.\.\s\+include::\s*\)\(.*\),\1$${cmd}_docdir/\2," \ - commands/$${cmd}_docdir/cmdline.rst \ - >commands/$${cmd}_cmdline.txt; \ - printf ".. include:: $${cmd}_cmdline.txt\n\n"; \ - fi; \ - printf "$${cmd^} library reference\n"; \ - printf -- "==========================\n"; \ - if [ -e commands/$${cmd}_docdir/python.rst ]; then \ - printf ".. toctree::\n :maxdepth: 2\n\n"; \ - printf " $${cmd}_docdir/python\n\n"; \ - else \ - printf ".. automodule:: lmi.scripts.$${cmd}\n"; \ - printf " :members:\n"; \ - fi; \ - ) > commands/$${cmd}.rst; \ - done -else - ( \ - printf "You may visit command usage and developer documentations\n"; \ - printf "on pythonhosted site:\n\n"; \ - for cmd in $(COMMANDS); do \ - printf " * \`openlmi-scripts-$${cmd}"; \ - printf " <http://pythonhosted.org/openlmi-scripts-$${cmd}>\`_\n"; \ - done \ - ) >> $@ -endif - - -clean: - -rm -rf $(BUILDDIR)/* modules/ api.rst commands.rst commands/ -ifneq ($(INCLUDE_COMMANDS), 0) - for cmd in $(COMMANDS); do \ - make -C $(COMMANDS_PATH)/$${cmd}/doc clean; \ - done -endif - -%.png: %.dia - dia -e $@ $< - -%.svg: %.uml plantuml.cfg - plantuml -config plantuml.cfg -Tsvg $< - -figures: - -$(TUTORIAL_TARBALL): - tar -czf $@ mylf - -html: figures api.rst commands.rst $(TUTORIAL_TARBALL) - ./build-with-sphinx.sh "$(COMMANDS)" -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/AnacondaStorageProvider.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/AnacondaStorageProvider.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/AnacondaStorageProvider" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/AnacondaStorageProvider" - @echo "# devhelp" - -epub: figures api.rst commands.rst - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: figures api.rst commands.rst - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - sed -i 's/^\\makeindex$$/\0[columns=1]/' $(BUILDDIR)/latex/$(PROJECTNAME).tex - @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: latex - $(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." diff --git a/doc/README.md b/doc/README.md deleted file mode 100644 index 12b6e95..0000000 --- a/doc/README.md +++ /dev/null @@ -1,39 +0,0 @@ -Documentation -============= -This directory contains usage and developer documentation. -It's available online on [pythonhosted][]. - -How to build ------------- -Supported builds are *html*, *pdflatex* and *epub*. - -### Requirements - - * `bash` - * `GNU make` - * `setuptools` - provided by package `python-setuptools` - * `sphinx-build` - provided by package `python-sphinx` - -### Steps -There are two kinds of builds available. One containing documentation of `lmi` -command libraries and one with just references to them to external sources. -Following examples will generate only *html* documentation, to make any other -just replace the `html` argument with prefered one. - -#### Including commands documentation - - INCLUDE_COMMANDS=1 make -C doc html - -#### Without commands documentation -This build is the preferred one for Python Hosted site. - - make -C doc html - -How to upload -------------- -First build it (see the section above). -Then run: - - python setup.py upload_docs - -[pythonhosted]: http://pythonhosted.org/openlmi-scripts/index.html diff --git a/doc/_static/imode-tree.svg b/doc/_static/imode-tree.svg deleted file mode 100644 index 91c1614..0000000 --- a/doc/_static/imode-tree.svg +++ /dev/null @@ -1,605 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="678.85718" - height="399.14285" - id="svg2" - version="1.1" - inkscape:version="0.48.4 r9939" - sodipodi:docname="imode-tree.svg"> - <defs - id="defs4" /> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="0.98994949" - inkscape:cx="524.19771" - inkscape:cy="224.52211" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:window-width="1920" - inkscape:window-height="1058" - inkscape:window-x="0" - inkscape:window-y="0" - inkscape:window-maximized="0" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" /> - <metadata - id="metadata7"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1" - transform="translate(-14.499999,-184.21933)"> - <path - style="fill:none;stroke:#b3b3b3;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:4, 4;stroke-dashoffset:0" - d="m 162.85714,185.21933 0,397.14285" - id="path4052" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cc" /> - <path - sodipodi:type="arc" - style="fill:#ffffff;fill-opacity:1;stroke:#800000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0" - id="path4042" - sodipodi:cx="122.5" - sodipodi:cy="410.57648" - sodipodi:rx="69.64286" - sodipodi:ry="35.357143" - d="m 192.14286,410.57648 c 0,19.52721 -31.18017,35.35714 -69.64286,35.35714 -38.46269,0 -69.64286,-15.82993 -69.64286,-35.35714 0,-19.52721 31.18017,-35.35715 69.64286,-35.35715 38.46269,0 69.64286,15.82994 69.64286,35.35715 z" - transform="translate(35.714286,-14.285714)" /> - <g - id="g3003" - transform="translate(0,0.71427917)"> - <rect - ry="17.857143" - y="230.21933" - x="14.999999" - height="35.714287" - width="137.85715" - id="rect2985" - style="fill:#ffe680;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text2999" - y="253.59406" - x="41.628769" - style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="253.59406" - x="41.628769" - id="tspan3001" - sodipodi:role="line">TopLevel</tspan></text> - </g> - <g - id="g3033" - transform="translate(-41.20703,-4.2857208)"> - <rect - style="fill:#ffaaaa;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect3024" - width="137.85715" - height="35.714287" - x="215" - y="235.21933" - ry="17.857143" /> - <text - xml:space="preserve" - style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="244.661" - y="258.41827" - id="text3026" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3028" - x="244.661" - y="258.41827">Storage</tspan></text> - </g> - <g - id="g4032" - transform="translate(0.22154353,20)"> - <rect - ry="17.857143" - y="463.07648" - x="173.57143" - height="35.714287" - width="137.85715" - id="rect3040" - style="fill:#ffaaaa;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text3042" - y="488.38968" - x="198.27148" - style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="488.38968" - x="198.27148" - id="tspan3044" - sodipodi:role="line">Software</tspan></text> - </g> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" - x="46.047226" - y="290.93359" - id="text3049" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3051" - x="46.047226" - y="290.93359">lmi> :pwd</tspan><tspan - sodipodi:role="line" - x="46.047226" - y="308.43359" - id="tspan3053">/lmi</tspan></text> - <text - sodipodi:linespacing="125%" - id="text3055" - y="290.93359" - x="183.97691" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" - xml:space="preserve"><tspan - y="290.93359" - x="183.97691" - id="tspan3057" - sodipodi:role="line" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">>storage> :pwd</tspan><tspan - id="tspan3059" - y="308.43359" - x="183.97691" - sodipodi:role="line" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono">/lmi/storage</tspan></text> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" - x="183.97691" - y="542.18982" - id="text3061" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3063" - x="183.97691" - y="542.18982">>sw> :pwd</tspan><tspan - sodipodi:role="line" - x="183.97691" - y="559.68982" - id="tspan3065">/lmi/sw</tspan></text> - <g - id="g3078" - transform="translate(-71.821487,-5)"> - <rect - ry="17.857143" - y="235.93361" - x="415.71426" - height="35.714287" - width="137.85715" - id="rect3069" - style="fill:#ffaaaa;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text3071" - y="261.2468" - x="450.17505" - style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="261.2468" - x="450.17505" - id="tspan3073" - sodipodi:role="line">LVCmd</tspan></text> - </g> - <g - id="g4037" - transform="translate(-8.9643402,2.1428265)"> - <rect - style="fill:#ffaaaa;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect3085" - width="137.85715" - height="35.714287" - x="352.85712" - y="320.93362" - ry="17.857143" /> - <text - xml:space="preserve" - style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="374.60309" - y="346.24683" - id="text3087" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3089" - x="374.60309" - y="346.24683">RAIDCmd</tspan></text> - </g> - <g - id="g4027" - transform="translate(-7.5357819,0)"> - <rect - ry="17.857143" - y="422.36218" - x="351.42856" - height="35.714287" - width="137.85715" - id="rect3101" - style="fill:#a8dbff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text3103" - y="447.67538" - x="377.3493" - style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="447.67538" - x="377.3493" - id="tspan3105" - sodipodi:role="line">TreeCmd</tspan></text> - </g> - <text - xml:space="preserve" - style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - x="65.21373" - y="198.29857" - id="text3886" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3888" - x="65.21373" - y="198.29857">Root</tspan></text> - <text - xml:space="preserve" - style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - x="198.54967" - y="198.79076" - id="text3890" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3892" - x="198.54967" - y="198.79076">Registered</tspan><tspan - sodipodi:role="line" - x="198.54967" - y="218.79076" - id="tspan3894">commands</tspan></text> - <text - xml:space="preserve" - style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - x="350.43854" - y="198.79076" - id="text3896" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3898" - x="350.43854" - y="198.79076">Sub-commands</tspan></text> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" - x="337.14752" - y="290.93359" - id="text3900" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3902" - x="337.14752" - y="290.93359">>>lv> :pwd</tspan><tspan - sodipodi:role="line" - x="337.14752" - y="308.43359" - id="tspan3904">/lmi/storage/lv</tspan></text> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" - x="337.14752" - y="385.93359" - id="text3906" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3908" - x="337.14752" - y="385.93359">>>raid> :pwd</tspan><tspan - sodipodi:role="line" - x="337.14752" - y="403.43359" - id="tspan3910">/lmi/storage/raid</tspan></text> - <path - style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0" - d="M 245.57868,275.21932 194.8644,359.50503" - id="path3916" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cc" /> - <path - style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0" - d="M 362.85714,273.79075 C 360,275.93361 221.42858,372.36218 221.42858,372.36218" - id="path3918" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cc" /> - <path - style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0" - d="m 349.28571,350.21932 c -1.42857,2.85715 -117.85714,33.57144 -117.85714,33.57144" - id="path3920" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cc" /> - <path - style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0" - d="M 225.57868,478.79076 194.8644,432.36217" - id="path3924" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cc" /> - <g - id="g3992" - transform="translate(-41.428572,0)"> - <rect - style="fill:#a8dbff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect3878" - width="137.85715" - height="35.714287" - x="546.42859" - y="230.93361" - ry="17.857143" /> - <text - sodipodi:linespacing="125%" - id="text3929" - y="256.2468" - x="597.1394" - style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="256.2468" - x="597.1394" - id="tspan3931" - sodipodi:role="line">List</tspan></text> - </g> - <g - id="g3997" - transform="translate(-40.000044,1.4285889)"> - <rect - ry="17.857143" - y="275.21933" - x="545.00006" - height="35.714287" - width="137.85715" - id="rect3880" - style="fill:#a8dbff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text3933" - y="300.35675" - x="580.63763" - style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - xml:space="preserve"><tspan - style="font-size:20px" - y="300.35675" - x="580.63763" - id="tspan3935" - sodipodi:role="line">Create</tspan></text> - </g> - <g - id="g4002" - transform="translate(-38.571455,2.1428265)"> - <rect - style="fill:#a8dbff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect3882" - width="137.85715" - height="35.714287" - x="543.57147" - y="320.93362" - ry="17.857143" /> - <text - sodipodi:linespacing="125%" - id="text3937" - y="346.24683" - x="594.28229" - style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - xml:space="preserve"><tspan - style="font-size:20px" - y="346.24683" - x="594.28229" - id="tspan3939" - sodipodi:role="line">List</tspan></text> - </g> - <g - id="g4007" - transform="translate(-38.571455,0)"> - <rect - ry="17.857143" - y="368.07648" - x="543.57147" - height="35.714287" - width="137.85715" - id="rect3884" - style="fill:#a8dbff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text3941" - y="393.38968" - x="579.19928" - style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - xml:space="preserve"><tspan - style="font-size:20px" - y="393.38968" - x="579.19928" - id="tspan3943" - sodipodi:role="line">Delete</tspan></text> - </g> - <path - style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0" - d="m 491.42857,441.64789 56.42857,0" - id="path3968" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cc" /> - <g - id="g4022" - transform="translate(-14.100082,20)"> - <rect - style="fill:#ffaaaa;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect3972" - width="137.85715" - height="35.714287" - x="357.99286" - y="463.07648" - ry="17.857143" /> - <text - sodipodi:linespacing="125%" - id="text3974" - y="486.4512" - x="373.05426" - style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - xml:space="preserve"><tspan - y="486.4512" - x="373.05426" - id="tspan3976" - sodipodi:role="line">Repository</tspan></text> - </g> - <g - id="g4012" - transform="translate(-36.428572,1.4285579)"> - <rect - style="fill:#a8dbff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect3980" - width="137.85715" - height="35.714287" - x="541.42859" - y="481.64792" - ry="17.857143" /> - <text - xml:space="preserve" - style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - x="575.82593" - y="506.96112" - id="text3982" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3984" - x="575.82593" - y="506.96112" - style="font-size:20px">Enable</tspan></text> - </g> - <g - id="g4017" - transform="translate(-36.428572,2.1428571)"> - <rect - ry="17.857143" - y="528.79077" - x="541.42859" - height="35.714287" - width="137.85715" - id="rect3986" - style="fill:#a8dbff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text3988" - y="554.10394" - x="572.81812" - style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - xml:space="preserve"><tspan - style="font-size:20px" - y="554.10394" - x="572.81812" - id="tspan3990" - sodipodi:role="line">Disable</tspan></text> - </g> - <text - xml:space="preserve" - style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - x="101.7055" - y="401.48608" - id="text3912" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3914" - x="101.7055" - y="401.48608" - style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Droid Sans;-inkscape-font-specification:Droid Sans">multiplexers</tspan></text> - <path - inkscape:connector-curvature="0" - id="path4054" - d="m 327.85714,185.21933 0,397.14285" - style="fill:none;stroke:#b3b3b3;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:4, 4;stroke-dashoffset:0" - sodipodi:nodetypes="cc" /> - <g - id="g4058"> - <path - sodipodi:type="arc" - style="fill:#ffffff;fill-opacity:1;stroke:#800000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0" - id="path4056" - sodipodi:cx="122.5" - sodipodi:cy="410.57648" - sodipodi:rx="69.64286" - sodipodi:ry="35.357143" - d="m 192.14286,410.57648 c 0,19.52721 -31.18017,35.35714 -69.64286,35.35714 -38.46269,0 -69.64286,-15.82993 -69.64286,-35.35714 0,-19.52721 31.18017,-35.35715 69.64286,-35.35715 38.46269,0 69.64286,15.82994 69.64286,35.35715 z" - transform="translate(500.71429,32.857143)" /> - <text - sodipodi:linespacing="125%" - id="text3912-0" - y="438.43362" - x="573.19476" - style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Terminus" - xml:space="preserve"><tspan - style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Droid Sans;-inkscape-font-specification:Droid Sans" - y="438.43362" - x="573.19476" - id="tspan3914-9" - sodipodi:role="line">end point</tspan><tspan - id="tspan3966" - style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Droid Sans;-inkscape-font-specification:Droid Sans" - y="463.43362" - x="573.19476" - sodipodi:role="line">commands</tspan></text> - </g> - <path - sodipodi:nodetypes="cc" - inkscape:connector-curvature="0" - id="path4064" - d="M 542.14286,407.36217 555,423.07646" - style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0" /> - <path - style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0" - d="m 545.00001,478.79074 13.57142,-13.57143" - id="path4066" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cc" /> - <text - sodipodi:linespacing="125%" - id="text4068" - y="540.57654" - x="337.14752" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Droid Sans Mono;-inkscape-font-specification:Droid Sans Mono" - xml:space="preserve"><tspan - y="540.57654" - x="337.14752" - id="tspan4070" - sodipodi:role="line">>>repo> :pwd</tspan><tspan - id="tspan4072" - y="558.07654" - x="337.14752" - sodipodi:role="line">/lmi/software/repo</tspan></text> - <path - sodipodi:nodetypes="cc" - inkscape:connector-curvature="0" - id="path4074" - d="M 337.00725,484.50505 228.43583,416.64789" - style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0" /> - </g> -</svg> diff --git a/doc/_static/logicalfile.class.violet b/doc/_static/logicalfile.class.violet deleted file mode 100644 index 4df1546..0000000 --- a/doc/_static/logicalfile.class.violet +++ /dev/null @@ -1,556 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<java version="1.7.0_60" class="java.beans.XMLDecoder"> - <object class="com.horstmann.violet.ClassDiagramGraph"> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode0"> - <void property="name"> - <void property="text"> - <string>LMI_DataFile</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double0"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double0"/> - <double>1016.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double0"/> - <double>330.0</double> - </void> - </void> - <void method="setLocation"> - <double>1016.0</double> - <double>330.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode1"> - <void property="attributes"> - <void property="text"> - <string>CIM_Directory REF GroupComponent -CIM_LogicalFile REF PartComponent</string> - </void> - </void> - <void property="name"> - <void property="text"> - <string>LMI_DirectoryContainsFile</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double1"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double1"/> - <double>407.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double1"/> - <double>239.0</double> - </void> - </void> - <void method="setLocation"> - <double>407.0</double> - <double>239.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode2"> - <void property="name"> - <void property="text"> - <string>LMI_FIFOPipeFile</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double2"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double2"/> - <double>742.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double2"/> - <double>430.0</double> - </void> - </void> - <void method="setLocation"> - <double>742.0</double> - <double>430.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode3"> - <void property="attributes"> - <void property="text"> - <string>CIM_ManagedElement REF SameElement -CIM_ManagedElement REF SystemElement</string> - </void> - </void> - <void property="name"> - <void property="text"> - <string>LMI_FileIdentity</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double3"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double3"/> - <double>676.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double3"/> - <double>56.0</double> - </void> - </void> - <void method="setLocation"> - <double>676.0</double> - <double>56.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode4"> - <void property="attributes"> - <void property="text"> - <string>CIM_ManagedElement REF GroupComponent -LMI_UnixDirectory REF PartComponent</string> - </void> - </void> - <void property="name"> - <void property="text"> - <string>LMI_RootDirectory</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double4"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double4"/> - <double>128.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double4"/> - <double>418.0</double> - </void> - </void> - <void method="setLocation"> - <double>128.0</double> - <double>418.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode5"> - <void property="name"> - <void property="text"> - <string>LMI_SymbolicLink</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double5"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double5"/> - <double>923.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double5"/> - <double>431.0</double> - </void> - </void> - <void method="setLocation"> - <double>923.0</double> - <double>431.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode6"> - <void property="name"> - <void property="text"> - <string>LMI_UnixDeviceFile</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double6"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double6"/> - <double>1020.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double6"/> - <double>168.0</double> - </void> - </void> - <void method="setLocation"> - <double>1020.0</double> - <double>168.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode7"> - <void property="name"> - <void property="text"> - <string>LMI_UnixDirectory</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double7"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double7"/> - <double>462.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double7"/> - <double>425.0</double> - </void> - </void> - <void method="setLocation"> - <double>462.0</double> - <double>425.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode8"> - <void property="attributes"> - <void property="text"> - <string>string FSCreationClassName -string CSName -string CSCreationClassName -string CreationClassName -string FSName -string LFName</string> - </void> - </void> - <void property="name"> - <void property="text"> - <string>LMI_UnixFile</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double8"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double8"/> - <double>334.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double8"/> - <double>36.0</double> - </void> - </void> - <void method="setLocation"> - <double>334.0</double> - <double>36.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode9"> - <void property="name"> - <void property="text"> - <string>LMI_UnixSocket</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double9"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double9"/> - <double>1015.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double9"/> - <double>254.0</double> - </void> - </void> - <void method="setLocation"> - <double>1015.0</double> - <double>254.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode10"> - <void property="attributes"> - <void property="text"> - <string>string CreationClassName -string Name</string> - </void> - </void> - <void property="name"> - <void property="text"> - <string>CIM_ComputerSystem</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double10"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double10"/> - <double>180.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double10"/> - <double>245.0</double> - </void> - </void> - <void method="setLocation"> - <double>180.0</double> - <double>245.0</double> - </void> - </object> - </void> - <void method="addNode"> - <object class="com.horstmann.violet.ClassNode" id="ClassNode11"> - <void property="attributes"> - <void property="text"> - <string>string FSCreationClassName -string Name -string CSName -string CSCreationClassName -string CreationClassName -string FSName</string> - </void> - </void> - <void property="name"> - <void property="text"> - <string>CIM_LogicalFile</string> - </void> - </void> - </object> - <object class="java.awt.geom.Point2D$Double" id="Point2D$Double11"> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>x</string> - <void method="set"> - <object idref="Point2D$Double11"/> - <double>707.0</double> - </void> - </void> - <void class="java.awt.geom.Point2D$Double" method="getField"> - <string>y</string> - <void method="set"> - <object idref="Point2D$Double11"/> - <double>209.0</double> - </void> - </void> - <void method="setLocation"> - <double>707.0</double> - <double>209.0</double> - </void> - </object> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="HVH"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="V"/> - </void> - <void property="endLabel"> - <string>1</string> - </void> - </object> - <object idref="ClassNode4"/> - <object idref="ClassNode10"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="HVH"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="V"/> - </void> - <void property="endLabel"> - <string>1</string> - </void> - </object> - <object idref="ClassNode4"/> - <object idref="ClassNode7"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="VHV"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/> - </void> - </object> - <object idref="ClassNode5"/> - <object idref="ClassNode11"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="VHV"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/> - </void> - </object> - <object idref="ClassNode6"/> - <object idref="ClassNode11"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="VHV"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/> - </void> - </object> - <object idref="ClassNode2"/> - <object idref="ClassNode11"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="VHV"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/> - </void> - </object> - <object idref="ClassNode9"/> - <object idref="ClassNode11"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="VHV"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/> - </void> - </object> - <object idref="ClassNode0"/> - <object idref="ClassNode11"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="HVH"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="V"/> - </void> - <void property="endLabel"> - <string>1</string> - </void> - </object> - <object idref="ClassNode3"/> - <object idref="ClassNode8"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="HVH"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="V"/> - </void> - <void property="endLabel"> - <string>1</string> - </void> - </object> - <object idref="ClassNode3"/> - <object idref="ClassNode11"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/> - </void> - </object> - <object idref="ClassNode7"/> - <object idref="ClassNode11"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="HVH"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="V"/> - </void> - <void property="endLabel"> - <string>1</string> - </void> - </object> - <object idref="ClassNode1"/> - <object idref="ClassNode7"/> - </void> - <void method="connect"> - <object class="com.horstmann.violet.ClassRelationshipEdge"> - <void property="bentStyle"> - <object class="com.horstmann.violet.BentStyle" field="HVH"/> - </void> - <void property="endArrowHead"> - <object class="com.horstmann.violet.ArrowHead" field="V"/> - </void> - <void property="endLabel"> - <string>*</string> - </void> - </object> - <object idref="ClassNode1"/> - <object idref="ClassNode11"/> - </void> - </object> -</java> diff --git a/doc/_static/logicalfile.png b/doc/_static/logicalfile.png Binary files differdeleted file mode 100644 index 04633d1..0000000 --- a/doc/_static/logicalfile.png +++ /dev/null diff --git a/doc/build-with-sphinx.sh b/doc/build-with-sphinx.sh deleted file mode 100755 index e1a08d2..0000000 --- a/doc/build-with-sphinx.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# This script creates a temporary python workspace directory, where the -# openlmi-scripts and all specified commands are installed in order for -# sphinx-build to successfuly find them and generate devel documentation out of -# them. -# -# There are several environment variables affecting the execution: -# * SPHINXBUILD -# sphinx binary generating the documentation -# * INCLUDE_COMMANDS -# whether the command should be included in generated documentation -# * COMMANDS -# list of subcommands to include - -SPHINXBUILD=${SPHINXBUILD:-sphinx-build} -INCLUDE_COMMANDS=${INCLUDE_COMMANDS:-1} -tmp=`mktemp -d` -pushd .. -export PYTHONPATH=$tmp -python setup.py develop --install-dir=$tmp || exit 1 -if [ "$INCLUDE_COMMANDS" == 1 ]; then - pushd commands - COMMANDS="$1" - for cmd in ${COMMANDS}; do - pushd $cmd - python setup.py develop --install-dir=$tmp || exit 1 - popd - done - popd -fi -popd # .. -shift -${SPHINXBUILD} $@ || exit 1 -rm -rf $tmp diff --git a/doc/command-classes.rst b/doc/command-classes.rst deleted file mode 100644 index bdee7c7..0000000 --- a/doc/command-classes.rst +++ /dev/null @@ -1,163 +0,0 @@ -.. _command_classes: - -Command classes -=============== -Before reading this, please make sure you're familiar with -:ref:`command_wrappers_overview`. - -We focus here on commands intended for subclassing in command wrapper modules. -*OpenLMI Scripts* defines and uses other kinds of commands internally. But -the script developer does not need to know about them. - -.. seealso:: - General and class specific properties in :ref:`command_properties`. - -.. _end-point_commands: - -End-point commands ------------------- -Were already introduced before (see :ref:`end-point_commands_introduction`). -We'll dive into details here. - -Every end-point command allows to verify and transform options parsed by -docopt_ before they are passed to associated function. This can happen in -methods: - -``verify_options(self, options)`` - Taking pre-processed options dictionary as a first argument. - Properties affecting this pre-processing can be found in - :ref:`pre_processing_properties`. This method shall check option values or - their combination and raise ``lmi.scripts.common.errors.LmiInvalidOptions`` - if any inconsistency is discovered. - - Example usage: :: - - class FileLister(command.LmiInstanceLister): - DYNAMIC_PROPERTIES = True - - def verify_options(self, options): - file_types = { 'all', 'file', 'directory', 'symlink' - , 'fifo', 'device'} - if ( options['--type'] is not None - and options['--type'] not in file_types): - raise errors.LmiInvalidOptions( - 'Invalid file type given, must be one of %s' % - file_types) - - .. seealso:: - API doccumentation on - :py:meth:`~lmi.scripts.common.command.endpoint.LmiEndPointCommand.verify_options` - -``transform_options(self, options)`` - Takes verified options dictionary. It modifies this dictionary in - arbitrary way in place. Its return value is ignored. - - Example usage: :: - - class Lister(command.LmiLister): - COLUMNS = ('Device', 'Name', "ElementName", "Type") - - def transform_options(self, options): - """ - Rename 'device' option to 'devices' parameter name for better - readability. - """ - options['<devices>'] = options.pop('<device>') - - .. seealso:: - API documentation on - :py:meth:`~lmi.scripts.common.command.endpoint.LmiEndPointCommand.transform_options` - -Above methods can be used to process options in a way that any script library -function can be called. In case we need more control over what is called or -when we want to decide at runtime which function shall be called, we may override -:py:meth:`~lmi.scripts.common.command.endpoint.LmiEndPointCommand.execute` method -instead. Example of this may be found at :ref:`associating_a_function`. - -.. _lmi_check_result: - -``LmiCheckResult`` -~~~~~~~~~~~~~~~~~~ -This command invokes associated function on hosts in session, collects results -from them and compares them to an expected value. It does not produce any -output, when all returned values are expected. - -This command class is very useful when wrapping up some CIM class's method -such as ``LMI_Service::StartService()``. Example can be seen in -:ref:`property_descriptions`. - -Its specific properties are listed in :ref:`lmi_check_result_properties`. - -.. seealso:: - API documentation on - :py:class:`~lmi.scripts.common.command.checkresult.LmiCheckResult` - -.. _lmi_lister: - -``LmiLister`` -~~~~~~~~~~~~~ -Prints tablelike data. It expects associated function to return its result -in form: :: - - [row1, row2, ...] - -Where ``rowX`` is a tuple containing row values. Each such row is ``list`` or -``tuple`` of the same length. There is a property ``COLUMNS`` defining column -names [#]_ (see :ref:`lmi_lister_properties`). Generator is prefered over -a ``list`` of rows. If ``COLUMNS`` property is omitted, returned value shall -take the following form instead: :: - - (columns, data) - -Where ``columns`` has the same meaning as ``COLUMNS`` as a class property and -``data`` is the result of previous case [#]_. - -.. seealso:: - API documentation on - :py:class:`~lmi.scripts.common.command.lister.LmiLister` - -.. _lmi_instance_lister: - -``LmiInstanceLister`` -~~~~~~~~~~~~~~~~~~~~~ -Is a variant of ``LmiLister``. Instead of rows being tuples, here they are -instances of some CIM class. Instead of using ``COLUMNS`` property for -specifying columns labels, ``PROPERTIES`` is used for the same purpose here. -Its primary use is in specifying which properties of instances shall be -rendered in which column. This is described in detail in -:ref:`lmi_instance_lister_properties`. - -The expected output of associated function is therefore: :: - - [instance1, instance2, ...] - -Again, usage of generators is preferred. - -.. seealso:: - API documentation on - :py:class:`~lmi.scripts.common.command.lister.LmiInstanceLister` - -.. _lmi_show_instance: - -``LmiShowInstance`` -~~~~~~~~~~~~~~~~~~~ -Renders a single instance of some CIM class. It's rendered in a form of -two-column table, where the first column contains property names and -the second their corresponding values. Rendering is controlled in the same -way as for ``LmiInstanceLister`` (see :ref:`lmi_show_instance_properties`). - -.. seealso:: - API documentation on - :py:class:`~lmi.scripts.common.command.show.LmiShowInstance` - -.. **************************************************************************** - -.. _CIM: http://dmtf.org/standards/cim -.. _OpenLMI: http://fedorahosted.org/openlmi/ -.. _openlmi-tools: http://fedorahosted.org/openlmi/wiki/shell -.. _docopt: http://docopt.org/ - -------------------------------------------------------------------------------- - -.. [#] Having the same length as each row in returned data. -.. [#] Generator or a ``list`` of rows. diff --git a/doc/command-properties.rst b/doc/command-properties.rst deleted file mode 100644 index d45f8d9..0000000 --- a/doc/command-properties.rst +++ /dev/null @@ -1,574 +0,0 @@ -.. _command_properties: - -Command properties -================== - -As noted before in :ref:`end-point_commands`, command at first tries to -process input arguments, calls an associated function and then renders its -result. We'll now introduce properties affecting this process. - -Command class properties are written in their bodies and handled by their -metaclasses. After being processed, they are removed from class. So they are -not accessible as class attributes or from their instances. - -.. _pre_processing_properties: - -Options pre-processing ----------------------- -Influencing properties: - - * ``OPT_NO_UNDERSCORES`` (opt_no_underscores_) - * ``ARG_ARRAY_SUFFIX`` (arg_array_suffix_) - * ``OWN_USAGE`` (own_usage_) - -docopt_ will make a dictionary of options based on usage string such -as the one above (:ref:`usage_string`). Options dictionary matching this -example looks like this: :: - - { 'list' : bool - , '--all' : bool - , '--disabled' : bool - , 'start' : bool - , '<service>' : str - } - -Values of this dictionary are passed to an associated function as arguments -with names created out of matching keys. Since argument names can not contain -characters such as `'<'`, `'>'`, `'-'`, etc., these need to be replaced. -Process of renaming of these options can be described by the following pseudo -algorithm: - -.. _options_transform_algorithm: - - 1. arguments enclosed in brackets are un-surrounded -- brackets get - removed :: - - "<service>" -> "service" - - 2. arguments written in upper case are made lower cased :: - - "FILE" -> "file" - - 3. prefix of short and long options made of dashes shall be replaced with - single underscore :: - - "-a" -> "_a" - "--all" -> "_all" - - 4. any non-empty sequence of characters not allowed in python's identitier - shall be replaced with a single underscore :: - - "_long-option" -> "_long_option" - "special--cmd-#2" -> "special_cmd_2" - -Points 3 and 4 could be merged into one. But we separate them due to effects -of ``OPT_NO_UNDERSCORES`` property described below. - -.. seealso:: - Notes in :ref:`end-point_commands` for method - :py:meth`lmi.scripts.common.command.endpoint.LmiEndPointCommand.transform_options` - which is issued before the above algorithm is run. - -Treating dashes -~~~~~~~~~~~~~~~ -Single dash and double dash are special cases of commands. - -Double dash in usage string allows to pass option-like argument to a script -e.g.: :: - - lmi file show -- --file-prefix-with-double-dash - -Without the ``'--'`` argument prefixing the file, docopt_ would throw an error -beacause of ``--file-prefix-with-double-dash`` being treated as an unknown -option. This way it's correctly treated as an argument ``<file>`` given the -usage string: :: - - Usage: %(cmd)s file show [--] <file> - -Double dash isn't be passed to an associated function. - -Single dash on a command line is commonly used to specify stdout or stding. For -example in the following snippet: :: - - Usage: %(cmd)s file copy (- | <file>) <dest> - -``'-'`` stands for standard input which will be read instead of a file if the -user wishes to. - -Property descriptions -~~~~~~~~~~~~~~~~~~~~~ -.. _opt_no_underscores: - -``OPT_NO_UNDERSCORES`` : ``bool`` (defaults to ``False``) - Modifies point 3 of options pre-processing. It causes the prefix of dashes - to be completely removed with no replacement: :: - - "--long-options" -> "long-option" - - This may not be save if there is a command with the same name as the - option being removed. Setting this property to ``True`` will cause - overwriting the command with the value of option. A warning shall be - echoed if such a case occurs. - -.. _arg_array_suffix: - -``ARG_ARRAY_SUFFIX`` : ``str`` (defaults to ``""``) - Adds additional point (5) to `options_transform_algorithm`_. All - repeatable arguments, resulting in a ``list`` of items, are renamed to - ``<original_name><suffix>`` [#]_. Repeatable argument in usage string - looks like this: :: - - """ - Usage: %(cmd)s start <service> ... - """ - - Causing all of the ``<service>`` arguments being loaded into a ``list`` - object. - -.. _own_usage: - -``OWN_USAGE`` : ``bool`` (defaults to ``False``) - Says whether the documentation string of this class is a usage string. - Each command in hierarchy can have its own usage string. - - This can also be assigned a usage string directly: :: - - class MySubcommand(LmiCheckResult): - """ - Class doc string. - """ - OWN_USAGE = "Usage: %(cmd)s --opt1 --opt1 <file> <args> ..." - EXPECT = 0 - - But using a boolean value is more readable: :: - - class MySubcommand(LmiCheckResult): - """ - Usage: %(cmd)s --opt1 --opt1 <file> <args> ... - """ - OWN_USAGE = True - EXPECT = 0 - - .. note:: - - Using own usage strings in subcommands of top-level commands is not - recommended. It brings a lot of redundancy and may prove problematic - to modify while keeping consistency among hierarchically nested - usages. - - Therefore try to have just one usage string in a top-level command. - And one top-level command in a single module. Resulting in one usage - string per one command wrappers module. This makes it easier to read - and modify. - -.. _associating_a_function: - -Associating a function ----------------------- -Influencing properties: - - * ``CALLABLE`` (callable_) - -When command is invoked, its method -:py:meth:`~lmi.scripts.common.command.endpoint.LmiEndPointCommand.execute` will -get verified and transformed options as positional and keyword arguments. -This method shall pass them to an associated function residing in script -library and return its result on completition. - -One way to associate a function is to use ``CALLABLE`` property. The other -is to define very own ``execute()`` method like this: :: - - class Lister(command.LmiInstanceLister): - PROPERTIES = ('Name', "Started", 'Status') - - def execute(self, ns, _all, _disabled, _oneshot): - kind = 'enabled' - if _all: - kind = 'all' - elif _disabled: - kind = 'disabled' - elif _oneshot: - kind = 'oneshot' - for service_inst in service.list_services(ns, kind): - yield service_inst - -This may come handy if the application object [#]_ needs to be accessed or -if we need to decide which function to call based on command line options. - -.. _property_descriptions: - -Property descriptions -~~~~~~~~~~~~~~~~~~~~~ -.. _callable: - -``CALLABLE`` : ``str`` (defaults to ``None``) - This is a mandatory option if - :py:meth:`~lmi.scripts.common.command.endpoint.LmiEndPointCommand.execute` - method is not overriden. It may be a string composed of a full path of - module and its callable delimited with ``':'``: :: - - CALLABLE = 'lmi.scripts.service:start' - - Causes function ``start()`` of ``'lmi.scripts.service'`` module to be - associated with command. - - Callable may also be assigned directly like this: :: - - from lmi.scripts import service - class Start(command.LmiCheckResult): - CALLABLE = service.start - EXPECT = 0 - - The first variant (by assigning string) comes handy if the particular - module of associated function is not yet imported. Thus delaying the - import until the point of function's invocation - if the execution comes - to this point at all. In short it speeds up execution of ``lmi`` - meta-command by reducing number of module imports that are not needed. - -.. _function_invocation: - -Function invocation -------------------- -Influencing properties: - - * ``NAMESPACE`` (namespace_) - -Property descriptions -~~~~~~~~~~~~~~~~~~~~~ - -.. _namespace: - -``NAMESPACE`` : ``str`` (defaults to ``None``) - This property affects the first argument passed to an associated function. - Various values have different impact: - - +-----------+---------------------------------------+-------------------------------------+ - | Value | Value of first argument. | Its type | - +===========+=======================================+=====================================+ - | ``None`` | Same impact as value ``"root/cimv2"`` | :py:class:`lmi.shell.LMINamespace` | - +-----------+---------------------------------------+-------------------------------------+ - | ``False`` | Raw connection object | :py:class:`lmi.shell.LMIConnection` | - +-----------+---------------------------------------+-------------------------------------+ - | any path | Namespace object with given path | :py:class:`lmi.shell.LMINamespace` | - +-----------+---------------------------------------+-------------------------------------+ - - This usually won't need any modification. Sometimes perhaps associated - function might want to access more than one namespace, in that case an - instance of :py:class:`lmi.shell.LMIConnection` might provide more useful. - - Namespace can also be overriden globally in a configuration file or with - an option on command line. - - -Output rendering ----------------- -All these options begin with ``FMT_`` which is a shortcut for *formatter* as -they become options to formatter objects. These can be defined not only in -end-point commands but also in multiplexers. In the latter case they set the -defaults for all their direct and indirect child commands. - -.. note:: - These options override configuration settings and command line options. - Therefor use them with care. - -They are: - -.. _fmt_no_headings: - -``FMT_NO_HEADINGS`` : ``bool`` (defaults to ``False``) - Allows to suppress headings (column or row names) in the output. - - .. note:: - With :ref:`lmi_lister` command it's preferable to set the *COLUMNS* - property to empty list instead. Otherwise associated function is - expected to return column headers as a first row in its result. - -.. _fmt_human_friendly: - -``FMT_HUMAN_FRIENDLY`` : ``bool`` (defaults to ``False``) - Forces the output to be more pleasant to read by human beings. - -.. _specifying_requirements: - -Command specific properties ---------------------------- -Each command class can have its own specific properties. Let's take a look on -them. - -``LmiCommandMultiplexer`` -~~~~~~~~~~~~~~~~~~~~~~~~~ -.. _commands: - -``COMMANDS`` : ``dict`` (mandatory) - Dictionary assigning subcommands to their names listed in usage string. - Example follows: :: - - class MyCommand(LmiCommandMultiplexer): - ''' - My command description. - - Usage: %(cmd)s mycommand (subcmd1 | subcmd2) - ''' - COMMANDS = {'subcmd1' : Subcmd1, 'subcmd2' : Subcmd2} - OWN_USAGE = True - - Where ``Subcmd1`` and ``Subcmd2`` are some other ``LmiBaseCommand`` - subclasses. Documentation string must be parseable with docopt_. - - ``COMMANDS`` property will be translated to - :py:meth:`~lmi.scripts.common.command.multiplexer.LmiCommandMultiplexer.child_commands` - class method by - :py:class:`~lmi.scripts.common.command.meta.MultiplexerMetaClass`. - -``FALLBACK_COMMAND`` : :py:class:`lmi.scripts.common.command.endpoint.LmiEndPointCommand` - Command class used when no command defined in ``COMMANDS`` dictionary is - passed on command line. - - Take for example this usage string: :: - - """ - Display hardware information. - - Usage: - %(cmd)s [all] - %(cmd)s system - %(cmd)s chassis - """ - - This suggests there are tree commands defined taking care of listing - hardware informations. Entry point definition could look like this: :: - - class Hardware(command.LmiCommandMultiplexer): - OWN_USAGE = __doc__ # usage string from above - COMMANDS = { 'all' : All - , 'system' : System - , 'chassis' : Chassis - } - FALLBACK_COMMAND = All - - Without the ``FALLBACK_COMMAND`` property, the multiplexer would not - handle the case when ``'all'`` argument is omitted as is suggested in - the usage string. Adding it to command properties causes this multiplexer - to behave exactly as ``All`` subcommand in case that no command - is given on command line. - -.. _lmi_select_command_properties: - -``LmiSelectCommand`` properties -------------------------------- -Following properties allow to define profile and class requirements for -commands. - -.. _select: - -``SELECT`` : ``list`` (mandatory) - Is a list of pairs ``(condition, command)`` where ``condition`` is an - expression in *LMIReSpL* language. And ``command`` is either a string with - absolute path to command that shall be loaded or the command class itself. - - Small example: :: - - SELECT = [ - ( 'OpenLMI-Hardware < 0.4.2' - , 'lmi.scripts.hardware.pre042.PreCmd' - ) - , ('OpenLMI-Hardware >= 0.4.2 & class LMI_Chassis == 0.3.0' - , HwCmd - ) - ] - - It says: Let the ``PreHwCmd`` command do the job on brokers having - ``openlmi-hardware`` package older than ``0.4.2``. Use the ``HwCmd`` - anywhere else where also the ``LMI_Chassis`` CIM class in version ``0.3.0`` - is available. - - First matching condition wins and assigned command will be passed all the - arguments. If no condition can be satisfied and no default command is set, - an exception will be raised. - - .. seealso:: - Definition of *LMIReSpL* mini-language: - :py:mod:`~lmi.scripts.common.versioncheck.parser` - -.. _default: - -``DEFAULT`` : ``string`` or reference to command class - Defines fallback command used in case no condition in ``SELECT`` can be - satisfied. - -.. _lmi_lister_properties: - -``LmiLister`` properties -~~~~~~~~~~~~~~~~~~~~~~~~ -.. _columns: - -``COLUMNS`` : ``tuple`` - Column names. It's a tuple with name for each column. Each row of data - shall then contain the same number of items as this tuple. If omitted, - associated function is expected to provide them in the first row of - returned list. It's translated to - :py:meth:`~lmi.scripts.common.command.lister.LmiBaseListerCommand.get_columns` - class method. - - If set to empty list, no column headers will be printed. Every item of - returned list of associated function will be treated as data. Note that - setting this to empty list makes the *FMT_NO_HEADINGS* property - redundant. - -.. _lmi_instance_commands_properties: -.. _lmi_show_instance_properties: -.. _lmi_instance_lister_properties: - -``LmiShowInstance`` and ``LmiInstanceLister`` properties -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -These two classes expect, as a result of their associated function, an instance -or a list of instances of some CIM class. They take care of rendering them to -standard output. Thus their properties affect the way how their properties -are rendered. - -.. _properties: - -``PROPERTIES`` : ``tuple`` - Property names in the same order as the properties shall be listed. Items - of this tuple can take multiple forms: - - Property Name : ``str`` - Will be used for the name of column/property in output table and the - same name will be used when obtaining the value from instance. Thus - this form may be used only if the property name of instance can appear - as a name of column. - - (Column Name, Property Name) : ``(str, str)`` - This pair allows to render value of property under different name - (*Column Name*). - - (Column Name, getter) : ``(str, callable)`` - This way allows the value to be arbitrarily computed. The second - item is a callable taking one and only argument -- the instance of - class to be rendered. - - Example below shows different ways of rendering attributes for instances - of ``LMI_Service`` CIM class: :: - - class Show(command.LmiShowInstance): - CALLABLE = 'lmi.scripts.service:get_instance' - PROPERTIES = ( - 'Name', - ('Enabled', lambda i: i.EnabledDefault == 2), - ('Active', 'Started')) - - First property will be shown with the same label as the name of property. - Second one modifies the value of ``EnabledDefault`` from ``int`` to - ``bool`` representing enabled state. The last one uses different label for - property name ``Started``. - -.. _dynamic_properties: - -``DYNAMIC_PROPERTIES`` : ``bool`` (defaults to ``False``) - Whether the associated function is expected to return the properties tuple - itself. If ``True``, the result of associated function must be in form: :: - - (properties, data) - - Where ``properties`` have the same inscription and meaning as a - ``PROPERTIES`` property of class. - - Otherwise, only the ``data`` is expected. - - .. note:: - Both :py:class:`~lmi.scripts.common.command.show.LmiShowInstance` - and :py:class:`~lmi.scripts.common.command.lister.LmiInstanceLister` - expect different ``data`` to be returned. See :ref:`lmi_show_instance` - and :ref:`lmi_instance_lister` for more information. - -.. note:: - - Omitting both ``PROPERTIES`` and ``DYNAMIC_PROPERTIES`` makes the - ``LmiShowInstance`` render all attributes of instance. For - ``LmiInstanceLister`` this is not allowed, either ``DYNAMIC_PROPERTIES`` - must be ``True`` or ``PROPERTIES`` must be filled. - - -.. _lmi_check_result_properties: - -``LmiCheckResult`` properties -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This command typically does not produce any output if operation succeeds. The -operation succeeds if the result of associated function is expected. There are -more ways how to say what is an expected result. One way is to use ``EXPECT`` -property. The other is to provide very own implementation of -:py:class:`~lmi.scripts.common.command.checkresult.LmiCheckResult.check_result` -method. - -.. _expect: - -``EXPECT``: (mandatory) - Any value can be assigned to this property. This value is then expected - to be returned by associated function. Unexpected result is treated - as an error. - - A callable object assigned here has special meaning. This object must - accept exactly two parameters: - - 1. options - Dictionary with parsed command line options returned by - docopt_ after being processed by - :py:meth:`~lmi.scripts.common.command.endpoint.LmiEndPointCommand.transform_options`. - 2. result - Return value of associated function. - - If the associated function does not return an expected result, an error - such as: :: - - There was 1 error: - host kvm-fedora-20 - 0 != 1 - - will be presented to user which is not much helpful. To improve user - experience, the - :py:class:`~lmi.scripts.common.command.checkresult.LmiCheckResult.check_result` - method could be implemented instead. Note the example: :: - - class Update(command.LmiCheckResult): - ARG_ARRAY_SUFFIX = '_array' - - def check_result(self, options, result): - """ - :param list result: List of packages successfuly installed - that were passed as an ``<package_array>`` arguments. - """ - if options['<package_array>'] != result: - return (False, ('failed to update packages: %s' % - ", ".join( set(options['<package_array>']) - - set(result)))) - return True - - The ``execute()`` method is not listed to make the listing shorter. This - command could be used with usage string such as: :: - - %(cmd)s update [--force] [--repoid <repository>] <package> ... - - In case of a failure, this would produce output like this one: :: - - $ lmi sw update wt wt-doc unknownpackage - There was 1 error: - host kvm-fedora-20 - failed to update packages: unknownpackage - -.. seealso:: - - Docopt_ home page and its git: http://github.org/docopt/docopt. - -------------------------------------------------------------------------------- - -.. [#] Angle brackets here just mark the boundaries of name components. They - have nothing to do with arguments. -.. [#] Application object is accessible through ``app`` property of each - command instance. - -.. **************************************************************************** - -.. _CIM: http://dmtf.org/standards/cim -.. _OpenLMI: http://fedorahosted.org/openlmi/ -.. _openlmi-tools: http://fedorahosted.org/openlmi/wiki/shell -.. _docopt: http://docopt.org/ -.. _docopt-git: http://github.org/docopt - diff --git a/doc/conf.py.skel b/doc/conf.py.skel deleted file mode 100644 index af4caa9..0000000 --- a/doc/conf.py.skel +++ /dev/null @@ -1,290 +0,0 @@ -# -*- coding: utf-8 -*- -# -# OpenLMI Scripts documentation build configuration file, created by -# sphinx-quickstart on Thu Sep 5 12:50:18 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('..')) - -if os.environ.get('INCLUDE_COMMANDS', '0').lower() in {'1', 'true', 'yes'}: - commands_path = os.environ.get('COMMANDS_PATH', '../commands') - commands = os.environ.get('COMMANDS', '') - if commands: - for i, cmd in enumerate(commands.split(',')): - sys.path.insert(1 + i, os.path.join(os.path.abspath(commands_path), cmd)) - - include_commands_docs = True - include_commands = commands.split(',') - -# -- General configuration ----------------------------------------------------- - -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode'] - -# 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'OpenLMI Scripts' -copyright = u'2013-2014, Red Hat, Inc.' - -# 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 = '@@VERSION@@' -# The full version, including alpha/beta/rc tags. -release = '@@VERSION@@' - -# 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 = ['mylf/*'] - -# 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 = 'OpenLMIScriptsdoc' - - -# -- 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': u""" -\\usepackage{imakeidx} -\\usepackage{tikz} - -\\makeatletter -\\newcount\\dirtree@lvl -\\newcount\\dirtree@plvl -\\newcount\\dirtree@clvl -\\def\\dirtree@growth{% - \\ifnum\\tikznumberofcurrentchild=1\\relax - \\global\\advance\\dirtree@plvl by 1 - \\expandafter\\xdef\\csname dirtree@p@\\the\\dirtree@plvl\\endcsname{\\the\\dirtree@lvl} - \\fi - \\global\\advance\\dirtree@lvl by 1\\relax - \\dirtree@clvl=\\dirtree@lvl - \\advance\\dirtree@clvl by -\\csname dirtree@p@\\the\\dirtree@plvl\\endcsname - \\pgf@xa=0.5cm\\relax - \\pgf@ya=-0.5cm\\relax - \\pgf@ya=\\dirtree@clvl\\pgf@ya - \\pgftransformshift{\\pgfqpoint{\\the\\pgf@xa}{\\the\\pgf@ya}}% - \\ifnum\\tikznumberofcurrentchild=\\tikznumberofchildren - \\global\\advance\\dirtree@plvl by -1 - \\fi -} - -\\tikzset{ - dirtree/.style={ - growth function=\\dirtree@growth, - every node/.style={anchor=north}, - every child node/.style={anchor=west}, - edge from parent path={(\\tikzparentnode\\tikzparentanchor) |- (\\tikzchildnode\\tikzchildanchor)} - } -} -\\makeatother -""", -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ('index', 'OpenLMIScripts.tex', u'OpenLMI Scripts Documentation', - u'Michal Minář', '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', 'openlmiscripts', u'OpenLMI Scripts Documentation', - [u'Michal Minář'], 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', 'OpenLMIScripts', u'OpenLMI Scripts Documentation', - u'Michal Minář', 'OpenLMIScripts', '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' - -def setup(app): - app.add_config_value('include_commands', False, 'env') - app.add_config_value('commands', '', 'env') diff --git a/doc/configuration.rst b/doc/configuration.rst deleted file mode 100644 index 3c56ee9..0000000 --- a/doc/configuration.rst +++ /dev/null @@ -1,175 +0,0 @@ -.. _configuration: - -Configuration -============= -``lmi`` meta-command has the main configuration file located in: :: - - /etc/openlmi/scripts/lmi.conf - -User can have his own configuration file taking precedence over anything in -global one above: :: - - $HOME/.lmirc - -Configuration is written in MS Windows INI files fashion. Please refer to -corresponding `RFC 822`_ and to `ConfigParser`_ for python specific -interpretation language. - -Follows a list of sections with their list of options. Most of the options -listed here can be overridden with command line parameters. - -.. seealso:: - :py:mod:`~lmi.scripts.common.configuration` - -.. _sect_main: - -Section [Main] --------------- -.. _main_command_namespace: - -CommandNamespace : ``string`` - Python namespace, where command entry points will be searched for. - - Defaults to ``lmi.scripts.cmd``. - -.. _main_trace: - -Trace : ``boolean`` - Whether the exceptions should be logged with tracebacks. - - Defaults to ``False``. - - Can be overridden with ``--trace`` and ``--notrace`` options on - command-line. - - .. note:: - For most exceptions generated by scripts a *Verbosity* option - needs to be highest as well for tracebacks to be printed. - -.. _main_verbosity: - -Verbosity: ``integer`` - A number within 0-2 range saying, how verbose the output shall be. This - differs from `log_level`_, which controls the logging messages written to - file. If logging to console is enabled it sets the minimum severity level. - -1 Suppresses all messages except for errors. 0 shows warnings, 1 info - messages and 2 enables debug messages. This option also affects the - verbosity of commands, making them print more information to stdout. - - Defaults to 0. - - Can be overridden with ``-v`` and ``-q`` flags on command-line. - -Section [CIM] -------------- -.. _cim_namespace: - -Namespace : ``string`` - Allows to override default CIM namespace, which will be passed to - script library functions. - - Defaults to ``root/cimv2``. - -Section [SSL] -------------- -.. _ssl_verify_server_certificate: - -VerifyServerCertificate : ``boolean`` - Whether to verify server-side certificate, when making secured - connection over https. - - Defaults to ``True``. - - Can be overridden with ``-n | --noverify`` flag on command-line. - -Section [Format] ----------------- -.. _format_human_friendly: - -HumanFriendly : ``boolean`` - Whether to print values in human readable forms (e.g. with units). - - Defaults to ``False``. - - Can be overridden with ``-H | --human-frienly`` flag on command-line. - -.. _format_lister_format: - -ListerFormat : one of {``csv``, ``table``} - What format to use, when listing tabular data. ``csv`` format allows for - easy machine parsing, the second one is more human friendly. - - Defaults to ``table``. - - Can be overridden with ``-L | --lister-format`` option on command line. - -.. _format_no_headings: - -NoHeadings : ``boolean`` - Whether to suppress headings (column names) when printing tables. - - Defaults to ``False``. - - Can be overridden with ``-N | --no-headings`` option on command line. - -Section [Log] -------------- -.. _log_level: - -Level : one of {``DEBUG``, ``INFO``, ``WARNING``, ``ERROR``, ``CRITICAL``} - Minimal severity level of messages to log. Affects only logging to a - file. See the `main_verbosity`_ option controlling console logging level. - - Defaults to ``ERROR``. - -LogToConsole : ``boolean`` - Whether the logging to console is enabled. - - Defaults to ``True`` - - On command-line the same could be achieved by redirecting *stderr* to - ``/dev/null``. - -.. _log_console_format: - -ConsoleFormat : ``string`` - Format string used when logging to a console. This applies to warnings and - more severe messages. Refer to `Format String` in python's documentation for - details. - - Defaults to ``%(levelname)s: %(message)s``. - -.. _log_console_info_format: - -ConsoleInfoFormat : ``string`` - Format string used when logging to a console. Applies to info and debug - messages. Refer to `Format String` in python's documentation for details. - - - Defaults to ``%(message)s``. - -.. _log_file_format: - -FileFormat : ``string`` - Format string used, when logging to a console. This applies only when - *OutputFile* is set (see below). Refer to `Format String` in python's - documentation for details. - - Defaults to - ``%(asctime)s:%(levelname)-8s:%(name)s:%(lineno)d - %(message)s`` - -.. _log_output_file: - -OutputFile : ``string`` - Allows to set a path to file, where messages will be logged. No log - file is written at default. - - Defaults to empty string. - - Can be overridden on command line with ``--log-file`` option. - -.. **************************************************************************** - -.. _`RFC 822`: http://tools.ietf.org/html/rfc822.html -.. _`ConfigParser`: http://docs.python.org/2/library/configparser.html -.. _`Format String`: http://docs.python.org/2/library/logging.html#logrecord-attributes diff --git a/doc/gendoc.sh b/doc/gendoc.sh deleted file mode 100755 index 4ce3244..0000000 --- a/doc/gendoc.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -# -# Helper script to generate developer documentation in -# doc/modules and api.rst -# - -TOPDIR=.. - -[ -e $TOPDIR/doc/modules ] || mkdir $TOPDIR/doc/modules - -function get_modules() { - find $TOPDIR/lmi/scripts/ -type f -a -name '*.py' | \ - sed 's:/__init__\.py$::' | \ - grep -v "^${TOPDIR}/lmi/scripts/\?$" | \ - grep -v '/_' | \ - sort -u -} - -function get_module_name() { - path=`sed -e "s:^.*${TOPDIR}/lmi/scripts/\(.*\)$:\1:" -e "s:/:.:g"` - basename -s .py "$path" -} - -function get_version_string() { - out=`python $TOPDIR/setup.py --version` - git_version=`git describe HEAD 2>/dev/null` - echo -n "\`\`$out\`\`" - if [ -n "$git_version" ]; then - echo ", git: \`\`$git_version\`\`" - fi -} - -# api.rst header -cat >$TOPDIR/doc/api.rst <<_EOF_ -OpenLMI Scripts API -=================== - -This is a generated documentation form *OpenLMI Scripts* sources. - -Developer of script library will be interested in -:py:mod:\`lmi.scripts.common\` package providing useful functionality to -script development. - -Generated from version: $(get_version_string) - -Contents: - -.. toctree:: - :maxdepth: 2 - -_EOF_ - -# Generate modules/*.rst -for module_path in `get_modules`; do - module=`echo "$module_path" | get_module_name` - out=$module.rst - len=`echo $module| wc -c` - len=$(($len-1)) - underline="" - for i in `seq $len`; do underline="=$underline"; done - - cat >$TOPDIR/doc/modules/$out <<_EOF_ -$module -$underline -.. automodule:: lmi.scripts.$module - :members: -_EOF_ - echo >>$TOPDIR/doc/api.rst " modules/$module" -done diff --git a/doc/index.rst b/doc/index.rst deleted file mode 100644 index c95879e..0000000 --- a/doc/index.rst +++ /dev/null @@ -1,25 +0,0 @@ -OpenLMI Scripts documentation -============================= - -Client-side python modules and command line utilities. Contains python -libraries for interfacing with OpenLMI providers through local or remote CIMOM -with WBEM as a protocol in between. It also contains `lmi` meta-command -allowing to instrument these libraries from command line. - -Content: - -.. toctree:: - :maxdepth: 2 - - usage - configuration - script-development - api - commands - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/doc/make.bat b/doc/make.bat deleted file mode 100644 index c9db9bc..0000000 --- a/doc/make.bat +++ /dev/null @@ -1,190 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source -set I18NSPHINXOPTS=%SPHINXOPTS% source -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\OpenLMIScripts.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\OpenLMIScripts.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 diff --git a/doc/mylf/README.md b/doc/mylf/README.md deleted file mode 100644 index b3e7107..0000000 --- a/doc/mylf/README.md +++ /dev/null @@ -1,7 +0,0 @@ -MyLF -==== -A complete source for step-by-step tutorial hosted on -https://fedorahosted.org/openlmi/wiki/scripts/tutorial. - -It provides similar functionality as `logicalfile` script and operates upon the -same set of providers. diff --git a/doc/mylf/doc/Makefile b/doc/mylf/doc/Makefile deleted file mode 100644 index 5efe803..0000000 --- a/doc/mylf/doc/Makefile +++ /dev/null @@ -1,177 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = _build -COMMAND_NAME := mylf - -# 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 cmdregen cmdline.generated - -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)" - @echo " " - @echo " cmdregen to regenerate cmdline.generated with actual content from installed lmi help" - -cmdregen: cmdline.generated - -cmdline.generated: - if ! python -c 'import lmi.scripts.$(COMMAND_NAME)' >/dev/null; then \ - echo "Please install install the command library first." >&2; \ - exit 1; \ - fi - ( \ - echo ".."; \ - echo " !!!!!!!!!"; \ - echo -n " This is generated file. Use 'make cmdregen' to regenerate it"; \ - echo " from installed 'lmi help <CMD_NAME>'"; \ - echo " !!!!!!!!!"; \ - echo ; \ - for i in `sed -n '/entry_points/,/)/p' ../setup.py | \ - sed -n "s/\s*,\?['\"]\s*\([a-z-]\+\)\s*=.*/\1/p"`; do \ - lmi help $$i | python ../../../tools/help2rst $$i | \ - tr -d '\033' |sed 's/..1034h//'; \ - done \ - ) > $@ - -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/OpenLMIMyLFscripts.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/OpenLMIMyLFscripts.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/OpenLMIMyLFscripts" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/OpenLMIMyLFscripts" - @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." diff --git a/doc/mylf/doc/cmdline.rst b/doc/mylf/doc/cmdline.rst deleted file mode 100644 index ae96494..0000000 --- a/doc/mylf/doc/cmdline.rst +++ /dev/null @@ -1,6 +0,0 @@ -LMI command line reference -========================== -.. - Write some description here. - -.. include:: cmdline.generated diff --git a/doc/mylf/doc/conf.py b/doc/mylf/doc/conf.py deleted file mode 100644 index 91e943c..0000000 --- a/doc/mylf/doc/conf.py +++ /dev/null @@ -1,285 +0,0 @@ -# -*- coding: utf-8 -*- -# -# OpenLMI MyLF scripts documentation build configuration file, created by -# sphinx-quickstart on Wed Oct 2 08:58:25 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.todo', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode'] - -# 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'OpenLMI MyLF scripts' -copyright = u'2013-2014, Red Hat, Inc.' - -# 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.0.1' -# The full version, including alpha/beta/rc tags. -release = '0.0.1' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -#language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ['_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 = 'OpenLMIMyLFscriptsdoc' - - -# -- 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', 'OpenLMIMyLFscripts.tex', u'OpenLMI MyLF scripts Documentation', - u'Michal', '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', 'openlmimylfscripts', u'OpenLMI MyLF scripts Documentation', - [u'Michal'], 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', 'OpenLMIMyLFscripts', u'OpenLMI MyLF scripts Documentation', - u'Michal', 'OpenLMIMyLFscripts', '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' - - -# -- Options for Epub output --------------------------------------------------- - -# Bibliographic Dublin Core info. -epub_title = u'OpenLMI MyLF scripts' -epub_author = u'Michal' -epub_publisher = u'Michal' -epub_copyright = u'2013-2014, Red Hat, Inc.' - -# 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 = () - -# 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 = [] - -# The depth of the table of contents in toc.ncx. -#epub_tocdepth = 3 - -# Allow duplicate toc entries. -#epub_tocdup = True diff --git a/doc/mylf/doc/index.rst b/doc/mylf/doc/index.rst deleted file mode 100644 index dc7a55f..0000000 --- a/doc/mylf/doc/index.rst +++ /dev/null @@ -1,24 +0,0 @@ -.. OpenLMI MyLF scripts documentation master file, created by - sphinx-quickstart on Wed Oct 2 08:58:25 2013. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to OpenLMI MyLF scripts's documentation! -================================================ - -Contents: - -.. toctree:: - :maxdepth: 2 - - cmdline - python - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/doc/mylf/doc/make.bat b/doc/mylf/doc/make.bat deleted file mode 100644 index 4fc6844..0000000 --- a/doc/mylf/doc/make.bat +++ /dev/null @@ -1,190 +0,0 @@ -@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\OpenLMIMyLFscripts.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\OpenLMIMyLFscripts.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 diff --git a/doc/mylf/lmi/__init__.py b/doc/mylf/lmi/__init__.py deleted file mode 100644 index b1a2ff0..0000000 --- a/doc/mylf/lmi/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# The views and conclusions contained in the software and documentation are -# those of the authors and should not be interpreted as representing official -# policies, either expressed or implied, of the FreeBSD Project. -__import__('pkg_resources').declare_namespace(__name__) diff --git a/doc/mylf/lmi/scripts/__init__.py b/doc/mylf/lmi/scripts/__init__.py deleted file mode 100644 index b1a2ff0..0000000 --- a/doc/mylf/lmi/scripts/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# The views and conclusions contained in the software and documentation are -# those of the authors and should not be interpreted as representing official -# policies, either expressed or implied, of the FreeBSD Project. -__import__('pkg_resources').declare_namespace(__name__) diff --git a/doc/mylf/lmi/scripts/mylf/__init__.py b/doc/mylf/lmi/scripts/mylf/__init__.py deleted file mode 100644 index 18bebbb..0000000 --- a/doc/mylf/lmi/scripts/mylf/__init__.py +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# The views and conclusions contained in the software and documentation are -# those of the authors and should not be interpreted as representing official -# policies, either expressed or implied, of the FreeBSD Project. -import os - -from lmi.shell import LMIInstance, LMIInstanceName -from lmi.scripts.common import errors -from lmi.scripts.common import get_logger - -LOG = get_logger(__name__) - -def logical_file_type_name(file_identity): - """ - Get a name of file type for supplied instance of ``CIM_LogicalFile``. - """ - namemap = { - 'lmi_datafile' : 'file', - 'lmi_unixdevicefile' : 'device', - 'lmi_unixdirectory' : 'directory', - 'lmi_fifopipefile' : 'fifo', - 'lmi_symboliclink' : 'symlink', - 'lmi_unixsocket' : 'socket' - } - try: - return namemap[file_identity.classname.lower()] - except KeyError: - LOG().warn('Unhandled logical file class "%s".', - file_identity.classname) - return 'unknown' - -def permission_string(file_identity): - """ - Make a ls-like permission string for supplied instance of - ``CIM_LogicalFile``. - """ - return ''.join(l if getattr(file_identity, a) else '-' - for l, a in zip('rwx', ('Readable', 'Writeable', 'Executable'))) - -def get_computer_system(ns): - """ - :returns: Instance of ``Linux_ComputerSystem``. - """ - if not hasattr(get_computer_system, 'instance'): - get_computer_system.instance = ns.Linux_ComputerSystem.first_instance() - return get_computer_system.instance - -def get_unix_file_instance(ns, path, dereference=False): - """ - :param boolean dereference: Whether to follow symbolic links - :returns: Instance of ``LMI_UnixFile`` corresponding to given *path*. - """ - cs = get_computer_system(ns) - uf_name = ns.LMI_UnixFile.new_instance_name({ - 'CSCreationClassName' : cs.classname, - 'CSName' : cs.name, - 'LFName' : path, - 'LFCreationClassName' : 'ignored', - 'FSCreationClassName' : 'ignored', - 'FSName' : 'ignored', - }) - try: - uf = uf_name.to_instance() - if dereference: - lf = get_logical_file_instance(ns, uf, False) - if logical_file_type_name(lf) == 'symlink': - try: - target = lf.TargetFile - if not os.path.isabs(target): - target = os.path.abspath( - os.path.join(os.path.dirname(lf.Name), target)) - # recursively try to dereference - uf = get_unix_file_instance(ns, target, dereference) - except Exception as err: - LOG.warn('failed to get link target "%s": %s', - lf.TargetLink, err) - return uf - except: - raise errors.LmiFailed('No such file or directory: "%s".' % path) - -def get_logical_file_instance(ns, file_ident, dereference=False): - """ - Get an instance of ``CIM_LogicalFile`` corresponding to given file - identity. - - :param file_ident: Either a file path or an instance of ``LMI_UnixFile``. - :param boolean dereference: Whether to follow symbolic links - """ - if isinstance(file_ident, basestring): - uf = get_unix_file_instance(ns, file_ident, dereference) - elif isinstance(file_ident, LMIInstanceName): - uf = file_ident.to_instance() - else: - uf = file_ident - return uf.first_associator(AssocClass='LMI_FileIdentity') - -def make_directory_instance_name(ns, directory): - """ - Retrieve object path of a directory. - - :type directory: string - :param directory: Full path to the directory. - :rtype: :py:class:`lmi.shell.LMIInstanceName` - """ - if directory != '/': - directory = directory.rstrip('/') - cs = get_computer_system(ns) - return ns.LMI_UnixDirectory.new_instance_name( - { 'CSCreationClassName' : cs.classname - , 'CSName' : cs.name - , 'CreationClassName' : 'LMI_UnixDirectory' - , 'FSCreationClassName' : 'LMI_LocalFileSystem' - , 'FSName' : '' - , 'Name' : directory}) - -def get_directory_instance(ns, directory): - """ - Retrieve instance of `LMI_UnixDirectory`. - - :type directory: string of :py:class:`lmi.shell.LMIInstanceName` - :param directory: Full path to the directory or its instance name. - :rtype: :py:class:`lmi.shell.LMIInstance` - """ - if isinstance(directory, basestring): - directory = make_directory_instance_name(ns, directory) - if isinstance(directory, LMIInstanceName): - directory = directory.to_instance() - return directory - -def list_directory(ns, directory, file_type='any'): - """ - Yields instances of ``CIM_LogicalFile`` representing direct children of the - given directory. - - :param directory: Either a file path or an instance of - ``LMI_UnixDirectory``. - :param file_type: Filter of files made by checking their type. One of: :: - - {'any', 'file', 'device', 'directory', 'fifo', 'symlink', 'socket'} - """ - def _generate_children(): - for child in get_directory_instance(ns, directory).associators( - AssocClass='LMI_DirectoryContainsFile', - Role='GroupComponent', - ResultRole='PartComponent'): - if ( file_type and file_type != 'any' - and logical_file_type_name(child) != file_type): - continue - yield child - return sorted(_generate_children(), key=lambda i: i.Name) - -def create_directory(ns, directory): - """ - Create a directory. - - :type directory: string - :param directory: Full path to the directory. - """ - ns.LMI_UnixDirectory.create_instance( - make_directory_instance_name(ns, directory).path.keybindings) - -def delete_directory(ns, directory): - """ - Delete an empty directory. - - :param directory: Either a file path or an instance of - ``LMI_UnixDirectory``. - """ - get_directory_instance(ns, directory).delete() diff --git a/doc/mylf/lmi/scripts/mylf/cmd.py b/doc/mylf/lmi/scripts/mylf/cmd.py deleted file mode 100644 index 59b0f32..0000000 --- a/doc/mylf/lmi/scripts/mylf/cmd.py +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# The views and conclusions contained in the software and documentation are -# those of the authors and should not be interpreted as representing official -# policies, either expressed or implied, of the FreeBSD Project. - -""" -Read informations about file system structure. - -Usage: - %(cmd)s list [options] <directory> - %(cmd)s show [-L] <file> - %(cmd)s create <directory> - %(cmd)s delete <directory> - -Options: - -t --type <type> Filter listed files by their type. One of: - any, file, device, directory, fifo, symlink, socket. - Defaults to any. - -L --dereference Causes symlink to be followed. -""" - -from lmi.scripts import mylf -from lmi.scripts.common import command -from lmi.scripts.common import errors - -class Show(command.LmiLister): - COLUMNS = ('Attribute', 'Value') - - def transform_options(self, options): - options['<path>'] = options.pop('<file>') - - def execute(self, ns, path, _dereference): - uf = mylf.get_unix_file_instance(ns, path, _dereference) - lf = mylf.get_logical_file_instance(ns, uf, _dereference) - return [ - ('Path' , lf.Name), - ('Type' , mylf.logical_file_type_name(lf)), - ('User ID' , uf.UserID), - ('Group ID' , uf.GroupID), - ('Size' , lf.FileSize), - ('Permissions' , mylf.permission_string(lf)) - ] - -class List(command.LmiInstanceLister): - CALLABLE = mylf.list_directory - PROPERTIES = ( - 'Name', - ('Type', mylf.logical_file_type_name), - ('Permissions', mylf.permission_string), - ('Size', 'FileSize')) - - def verify_options(self, options): - if ( options['--type'] is not None - and not options['--type'].lower() in { - 'any', 'file', 'directory', 'symlink', 'dev', 'socket', 'fifo'}): - raise errors.LmiInvalidOptions( - 'Unsupported type: %s' % options['--type']) - - def transform_options(self, options): - file_type = options.pop('--type') - if file_type is None: - file_type = 'any' - options['file-type'] = file_type - -class Create(command.LmiCheckResult): - EXPECT = None - CALLABLE = mylf.create_directory - -class Delete(command.LmiCheckResult): - EXPECT = None - CALLABLE = mylf.delete_directory - -MyLF = command.register_subcommands('MyLF', __doc__, - { 'show' : Show - , 'list' : List - , 'create' : Create - , 'delete' : Delete - }) diff --git a/doc/mylf/setup.py b/doc/mylf/setup.py deleted file mode 100644 index 9281962..0000000 --- a/doc/mylf/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -# -*- encoding: utf-8 -*- - -from setuptools import setup - -try: - long_description = open('README.md', 'rt').read() -except IOError: - long_description = '' - -setup( - name='openlmi-scripts-mylf', - version='0.0.1', - description='OpenLMI scripts for LogicalFile profile', - long_description=long_description, - author=u'Michal', - author_email='Minar', - url='https://github.com/openlmi/openlmi-mylf', - download_url='https://github.com/openlmi/openlmi-mylf/tarball/master', - platforms=['Any'], - license="BSD", - classifiers=[ - 'License :: OSI Approved :: BSD License', - 'Operating System :: POSIX :: Linux', - 'Topic :: System :: Systems Administration', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Intended Audience :: Developers', - 'Environment :: Console', - ], - - install_requires=['openlmi-scripts'], - - namespace_packages=['lmi', 'lmi.scripts'], - packages=['lmi', 'lmi.scripts', 'lmi.scripts.mylf'], - include_package_data=True, - - entry_points={ - 'lmi.scripts.cmd': [ - 'mylf = lmi.scripts.mylf.cmd:MyLF', - ], - }, - ) diff --git a/doc/script-development.rst b/doc/script-development.rst deleted file mode 100644 index a4ec801..0000000 --- a/doc/script-development.rst +++ /dev/null @@ -1,668 +0,0 @@ -Script Development -================== -This provides a general overview on what script is, how is it written -and is interfaced with. - -Prerequisities --------------- -Reader should be familiar about a CIM_ (Common Information Model). He should -have a general idea about, what OpenLMI_ is and what it does. He should get -familiar with ``lmishell``, which is a python binary shipped with -openlmi-tools_. - -Also user should be acquinted with writing help strings for unix command line -utilities [#]_. - -Introduction ------------- -By a *script* in this document we mean: - - * Python library utilizing ``lmishell`` for instrumenting CIM providers - through a CIMOM broker. It resides in ``lmi.scripts.<profile_name>`` - package, where ``<profile_name>`` corresponds to a DMTF profile or an - arbitrary set of ``OpenLMI`` providers. - * Command wrappers for this library as a set of classes inheriting from - :py:class:`~lmi.scripts.common.command.base.LmiBaseCommand`. These may - create a hierarchy of nested subcommands. They are the entry points of - ``lmi`` meta-command to the wrapped functionality of library. - -Command wrappers are part of the library usually grouped in a single -module named after the ``lmi`` subcommand or ``cmd``: :: - - lmi.scripts.<profile_name>.cmd - -Writing a library ------------------ -Library shall consist of a set of functions taking a namespace or -connection object as a first argument. There are no special requirements -on how to divide these functions into submodules. Use common sense. Smaller -scripts can have all functionality in -``lmi/scripts/<profile_name>/__init__.py`` module. With wrappers usually -contained in ``lmi/scripts/<profile_name>/cmd.py``. - -Library should be written with an ease of use in mind. Functions should -represent possible use cases of what can be done with particular -providers instead of wrapping 1-to-1 a CIM class's methods in python -functions. - -Any function that shall be called by a command wrapper must accect a -``namespace`` argument, which by a convention is called ``ns``. It's an -instance of :py:class:`lmi.shell.LMINamespace` providing quick access to -represented CIM namespace [#]_ and its classes. It's also possible to specify -that function shall be passed a raw :py:class:`lmi.shell.LMIConnection` object. -For details see :ref:`function_invocation`. - -Service example -~~~~~~~~~~~~~~~ -Suppose we have a service profile and we want to write a python interface -for. Real provider implementation can be found at ``src/service`` directory -in upstream git [#]_. For more information please refer to `service description`_. - -As you may see, this implements single CIM class ``LMI_Service`` with a few -useful methods such as: - - * ``StartService()`` - * ``StopService()`` - -We'd like our users to provide a way how to list system services, get a -details for one of them and allow to start, stop and restart them. - -Simplified [#]_ version of some of these functions may look like this: :: - - def list_services(ns, kind='enabled'): - for service in sorted(ns.LMI_Service.instances(), - key=lambda i: i.Name): - if kind == 'disabled' and service.EnabledDefault != \ - ns.LMI_Service.EnabledDefaultValues.Disabled: - continue - if kind == 'oneshot' and service.EnabledDefault != \ - ns.LMI_Service.EnabledDefaultValues.NotApplicable: - continue - if kind == 'enabled' and service.EnabledDefault != \ - ns.LMI_Service.EnabledDefaultValues.Enabled: - # list only enabled - continue - yield service - -It yields instances of ``LMI_Service`` class. There is no need to use -exclusively ``yield`` statement instead of ``return``. We prefer to use it in -enumerating functions because of memory usage reduction (which is possible to -occur in the future, when underlying components will also allow for lazy -evaluation). Moreover user may limit the number of instances listed, reducing -the number of instances evaluated. - -:: - - from lmi.shell import LMIInstanceName - from lmi.scripts.common import get_logger - from lmi.scripts.common.errors import LmiFailed - - LOG = get_logger(__name__) - - def start_service(ns, service): - if isinstance(service, basestring): - # let's accept service as a string - inst = ns.LMI_Service.first_instance(key="Name", value=service) - name = service - else: # or as LMIInstance or LMIInstanceName - inst = service - name = inst.path['Name'] - if inst is None: - raise LmiFailed('No such service "%s".' % name) - if isinstance(inst, LMIInstanceName): - # we need LMIInstance - inst = inst.to_instance() - res = inst.StartService() - if res == 0: - LOG().debug('Started service "%s" on hostname "%s".', - name, ns.hostname) - return res - -In similar fashion, ``stop_service``, ``restart_service`` and others could be -written. - -``ns`` argument typically points to ``root/cimv2`` namespace, which is the -main implementation namespace for ``OpenLMI`` providers. One could also write -these functions operating upon a connection object like this: :: - - def get_instance(c, service): - inst = c.root.cimv2.LMI_Service.first_instance( - key="Name", value=service) - if inst is None: - raise LmiFailed('No such service "%s".' % service) - return inst - -User can then easily access any other namespace he may need. Command classes -need to be informed about what wrapped function expects. This will be -explained later in more detail (see :ref:`function_invocation`). - -The ``LOG`` variable provides acces to the logger of this module. Messages -logged in this way end up in a log file [#]_ and console. Implicitly only -warnings and higher priority messages are logged into a console. This is -controllable with ``lmi`` parameters. - -Useful information should not be rendered or printed by these functions -directly. Wrapper commands shall post-process instances or data returned, -render useful information and print it on standard output stream. - -If operation fails due to some not-so-unexpected error, please use -:py:class:`~lmi.scripts.common.errors.LmiFailed` exception with human readable -description. - -For more *real world* examples, take a look on scripts already present in our -`upstream git`_. - -.. _command_wrappers_overview: - -Command wrappers overview -------------------------- -They are a set of commands wrapping up library's functionality in a set of -commands creating a tree invocable by ``lmi`` meta-command. All commands are -subclasses of :py:class:`~lmi.scripts.common.command.base.LmiBaseCommand`. - -Behaviour of commands is controlled by class properties such as these: :: - - class Show(command.LmiShowInstance): - CALLABLE = 'lmi.scripts.service:get_instance' - PROPERTIES = ( - 'Name', - 'Caption', - ('Enabled', lambda i: i.EnabledDefault == 2), - ('Active', 'Started'), - 'Status') - -Example above contains definition of **show** command for instances of -``LMI_Service``. Its associated function is ``get_instance()`` located in -``lmi.scripts.service`` module [#]_. Properties used will be described -in detail later (see :ref:`lmi_instance_commands_properties`). Let's just say, -that ``PROPERTIES`` specify a way how the instance is rendered. - -Top-level commands -~~~~~~~~~~~~~~~~~~ -Are entry points of a script library. They are direct subcommands of ``lmi``. -For example: :: - - $ lmi help - $ lmi service list - $ lmi sw show openlmi-providers - -``help``, ``service`` and ``sw`` are top-level commands. One script library -(such as ``service`` above) can provide one or more of them. They need to be -listed in a ``setup.py`` script in ``entry_points`` argument of ``setup()`` -function. More details will be noted later in `Writing setup.py`_. - -They contain usage string which is a documentation and prescription of -command-line arguments in one string. This string is printed when user -requests command's help: :: - - $ lmi help - -.. _usage_string: - -Usage string -^^^^^^^^^^^^ -looks like this: :: - - """ - System service management. - - Usage: - %(cmd)s list [--all | --disabled] - %(cmd)s start <service> - - Options: - --all List all services available. - --disabled List only disabled services. - """ - -Format of this string is very important, it's parsed by a docopt_ command line -parser, generating options dictionary for commands. Please refer to its -documentation for details. - -.. note:: - - There is one deviation to *classical* usage string. It's the use of - ``%(cmd)s`` formatting mark. This is replaced with full command's name. - Full name means that all subcommands and binary name prefixing current - command on command line are part of it. So for example full name of - command **list** in a following string passed to command line: :: - - lmi sw list pkgs - - is ``lmi sw list``. - - If parsing **sw** usage, it is just ``lmi sw``. - - Please use this notation instead of writing your own usages completely. - Although it may work from command line, it won't work in interactive - mode without ``%(cmd)s`` being used. - -.. _end-point_commands_introduction: - -End-point commands -~~~~~~~~~~~~~~~~~~ -Are associated with one or more function of script library. They handle the -following: - - 1. call docopt_ parser on command line arguments - 2. make some name pre-processing on them (see - :ref:`pre_processing_properties`) - 3. verify them (see :ref:`end-point_commands`) - 4. transform them (see :ref:`end-point_commands`) - 5. pass them to associated function - 6. collect results - 7. render them and print them - -Developper of command wrappers needs to be familiar about each step. We will -describe them later in details. - -There are following end-point commands available for subclassing: - - * ``LmiCheckResult`` (see :ref:`lmi_check_result`) - * ``LmiLister`` (see :ref:`lmi_lister`) - * ``LmiInstanceLister`` (see :ref:`lmi_instance_lister`) - * ``LmiShowInstance`` (see :ref:`lmi_show_instance`) - -They differ in how they render the result obtained from associated function. - -These are listed in depth in :ref:`end-point_commands`. - -.. _command_multiplexers_introduction: - -Command multiplexers -~~~~~~~~~~~~~~~~~~~~ -Provide a way how to group multiple commands under one. Suppose you want to -list packages, repositories and files. All of these use cases need different -arguments, and render different information so logically they should be -represented by independent end-point commands. What binds them together is the -user's wish to *list* something. He may wish for other things like *show*, -*add*, *remove* etc. Having all combination of these wishes and things would -generate a lot of commands under the top-level one. Let's instead group them -under particular *wish* like this: - - * ``sw list packages`` - * ``sw list repositories`` - * ``sw list files`` - * ``sw show package`` - -To reflect it in our commands definition hierarchy, we need to use -:py:class:`~lmi.scripts.common.command.multiplexer.LmiCommandMultiplexer` -command. - -:: - - class Lister(command.LmiCommandMultiplexer): - """ List information about packages, repositories or files. """ - COMMANDS = { - 'packages' : PkgLister, - 'repositories' : RepoLister, - 'files' : FileLister - } - -Where ``COMMANDS`` property maps subcommand classes to their names as will -be passed on command line. Each command multiplexer consumes one command -argument from command line, representing the subcommand and passes the rest -of options to it. In this way we can create arbitrarily tall command trees. - -Top-level command is nothing else than a subclass of ``LmiCommandMultiplexer``. - -Specifying profile and class requirements -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Most commands require some provider installed on managed machine to work -properly. Each such provider should be represented by an instance of -``CIM_RegisteredProfile`` on remote broker. This instance looks like -this (in MOF syntax): :: - - instance of CIM_RegisteredProfile { - InstanceID = "OpenLMI+OpenLMI-Software+0.4.2"; - RegisteredOrganization = 1; - OtherRegisteredOrganization = "OpenLMI"; - RegisteredVersion = "0.4.2"; - AdvertiseTypes = [2]; - RegisteredName = "OpenLMI-Software"; - }; - -We are interested just in ``RegisteredName`` and ``RegisteredVersion`` -properties that we'll use for requirement specification. - -Requirement is written in *LMIReSpL* language. For its formal definition -refer to documentation of :py:mod:`~lmi.scripts.common.versioncheck.parser`. -Since the language is quite simple, few examples should suffice: - - ``'OpenLMI-Software < 0.4.2'`` - Requires OpenLMI Software provider to be installed in version lower - than ``0.4.2``. - ``'OpenLMI-Hardware == 0.4.2 & Openlmi-Software >= 0.4.2'`` - Requires both hardware and software providers to be installed in - particular version. Short-circuit evaluation is utilized here. It - means that in this example OpenLMI Software won't be queried unless - OpenLMI Hardware is installed and having desired version. - ``'profile "OpenLMI-Logical File" > 0.4.2'`` - If you have spaces in the name of profile, surround it in double - quotes. ``profile`` keyword is optional. It could be also present in - previous examples. - -Version requirements are not limited to profiles only. CIM classes may be -specified as well: - - ``'class LMI_SoftwareIdentity >= 0.3.0 & OpenLMI-LogicalFile'`` - In case of class requirements the ``class`` keyword is mandatory. As - you can see, version requirement is optional. - ``'! (class LMI_SoftwareIdentity | class LMI_UnixFile)'`` - Complex expressions can be created with the use of brackets and other - operators. - -One requirement is evaluated in these steps: - - Profile requirement - 1. Query ``CIM_RegisteredProfile`` for instances with - ``RegisteredName`` matching given name. If found, go to 2. Otherwise - query ``CIM_RegisteredSubProfile`` [#subprof]_ for instances with - ``RegisteredName`` matching given name. If not found return - ``False``. - 2. Select the (sub)profile with highest version and go to 3. - 3. If the requirement has version specification then compare it to the - value of ``RegisteredVersion`` using given operator. If the relation - does not apply, return ``False``. - 4. Return ``True``. - - Class requirement - 1. Get specified class. If not found, return ``False``. - 2. If the requirement has version specification then compare it to the - value of ``Version`` [#missing_version]_ qualifier of - obtained class using given operator. And if the relation - does not apply, return ``False``. - 3. Return ``True``. - -Now let's take a look, where these requirements can be specified. -There is a special select command used to specify which command to load -for particular version on remote broker. It can be written like this: :: - - from lmi.scripts.common.command import LmiSelectCommand - - class SoftwareCMD(LmiSelectCommand): - - SELECT = [ - ( 'OpenLMI-Software >= 0.4.2 & OpenLMI-LogicalFile' - , 'lmi.scripts.software.current.SwLFCmd') - , ( 'OpenLMI-Software >= 0.4.2' - , 'lmi.scripts.software.current.SwCmd') - , ('OpenLMI-Software', 'lmi.scripts.software.pre042.SwCmd') - ] - -It says to load ``SwLFCmd`` command in case both OpenLMI Software and -OpenLMI LogicalFile providers are installed. If not, load the ``SwCMD`` from -``current`` module for OpenLMI Software with recent version and fallback to -``SwCmd`` for anything else. If the OpenLMI Software provider is not available -at all, no command will be loaded and exception will be raised. - -Previous command could be used as an entry point in your ``setup.py`` script -(see the :ref:`entry_points`). There is also a utility that makes it look -better: :: - - from lmi.scripts.common.command import select_command - - SoftwareCMD = select_command('SoftwareCMD', - ( 'OpenLMI-Software >= 0.4.2 & OpenLMI-LogicalFile' - , 'lmi.scripts.software.current.SwLFCmd'), - ( 'OpenLMI-Software >= 0.4.2', 'lmi.scripts.software.current.SwCmd'), - ('OpenLMI-Software', 'lmi.scripts.software.pre042.SwCmd') - ) - -.. seealso:: - Documentation of - :py:class:`~lmi.scripts.common.command.select.LmiSelectCommand` and - :py:class:`~lmi.scripts.common.command.helper.select_command`. - - And also notes on related :ref:`lmi_select_command_properties`. - -Command wrappers module -~~~~~~~~~~~~~~~~~~~~~~~ -Usually consists of: - - 1. license header - 2. usage dostring - parseable by docopt_ - 3. end-point command wrappers - 4. single top-level command - -The top-level command is usally defined like this: :: - - Service = command.register_subcommands( - 'Service', __doc__, - { 'list' : Lister - , 'show' : Show - , 'start' : Start - , 'stop' : Stop - , 'restart' : Restart - }, - ) - -Where the ``__doc__`` is a usage string (see usage_string_) and module's doc -string at the same time. It's mentioned in point 2. ``Service`` is a name, -which will be listed in ``entry_points`` dictionary described in section below -(entry_points_). The global variable's name we assign to should be the same as -the value of the first argument to -:py:func:`~lmi.scripts.common.command.helper.register_subcommands`. The last -argument here is the dictionary mapping all subcommands of **service** to their -names [#]_. - -Egg structure -~~~~~~~~~~~~~ -Script library is distributed as an python egg, making it easy to distribute -and install either to system or user directory. - -Following tree shows directory structure of *service* egg residing in -`upstream git`_: - -.. only:: not latex - - :: - - commands/service - ├── lmi - │ ├── __init__.py - │ └── scripts - │ ├── __init__.py - │ └── service - │ ├── cmd.py - │ └── __init__.py - ├── README.md - └── setup.py - -.. raw:: latex - - \begin{center} - \begin{tikzpicture}[dirtree] - \node {commands/service} - child { node {lmi} - child { node {\_\_init\_\_.py} } - child { node {scripts} - child { node {\_\_init\_\_.py} } - child { node {service} - child { node {cmd.py} } - child { node {\_\_init\_\_.py} } - } - } - } - child { node {README.md} } - child { node {setup.py} }; - \end{tikzpicture} \\ - \end{center} - -This library then can be imported with: :: - - from lmi.scripts import service - -``commands/service/scripts/service`` must be a package (directory with -``__init__.py``) because ``lmi.scripts`` is a namespace package. It -can have arbitrary number of modules and subpackages. The care should be taken -to make the API easy to use and learn though. - -Writing ``setup.py`` --------------------- -Follows a minimal example of ``setup.py`` script for service library. :: - - from setuptools import setup, find_packages - setup( - name="openlmi-scripts-service", - version="0.1.0", - description='LMI command for system service administration.', - url='https://github.com/openlmi/openlmi-scripts', - platforms=['Any'], - license="BSD", - install_requires=['openlmi-scripts'], - namespace_packages=['lmi', 'lmi.scripts'], - packages=['lmi', 'lmi.scripts', 'lmi.scripts.service'], - - entry_points={ - 'lmi.scripts.cmd': [ - 'service = lmi.scripts.service.cmd:Service', - ], - }, - ) - -.. _entry_points: - -Entry points -~~~~~~~~~~~~ -The most notable argument here is ``entry_points`` which is a dictionary -containing python namespaces where plugins are registered. In this case, we -register single top-level command (see `Top-level commands`_) called -``service`` in ``lmi.scripts.cmd`` namespace. This particular namespace is used -by ``lmi`` meta-command when searching of registered user commands. ``Service`` -is a command multiplexer, created with a call to -:py:func:`~lmi.scripts.common.command.helper.register_subcommands` grouping -end-point commands together. - -Next example shows setup with more top-level commands -(of storage scripts library): :: - - entry_points={ - 'lmi.scripts.cmd': [ - 'fs = lmi.scripts.storage.fs_cmd:Fs', - 'partition = lmi.scripts.storage.partition_cmd:Partition', - 'raid = lmi.scripts.storage.raid_cmd:Raid', - 'lv = lmi.scripts.storage.lv_cmd:Lv', - 'vg = lmi.scripts.storage.vg_cmd:Vg', - 'storage = lmi.scripts.storage.storage_cmd:Storage', - 'mount = lmi.scripts.storage.mount_cmd:Mount', - ], - }, - -Conventions ------------ -There are several conventions you should try to follow in your shiny scripts. - -Logging messages -~~~~~~~~~~~~~~~~ -In each module where logging facilities are going to be used, define global -varibale ``LOG`` like this: :: - - from lmi.scripts.common import get_logger - - LOG = get_logger(__name__) - -It's a callable used throughout particular module in this way: :: - - LOG().warn('All the data of "%s" will be lost!', partition) - -Each message should be a whole sentence. It shall begin with an upper case -letter and end with a dot or other sentence terminator. - -Bad example: :: - - LOG().info('processing %s', card) - -Exceptions -~~~~~~~~~~ -Again all the exceptions should be initialized with messages forming -a whole sentence. - -They will be catched and printed on *stderr* by lmi meta-command. If the -*Trace* option in :ref:`sect_main` is on, traceback will be printed. There is -just one exception. If the exception inherits from -:py:class:`~lmi.scripts.common.errors.LmiError`, traceback won't be printed -unless verbosity level is highest: :: - - # self refers to some command - self.app.config.verbosity == self.app.config.OUTPUT_DEBUG - -This is a feature allowing for common error use-cases to be gracefully -handled. In your scripts you should stick to using -:py:class:`~lmi.scripts.common.errors.LmiFailed` for such exceptions. - -Following is an example of such a common error-case, where printing traceback -does not add any interesting information: :: - - iname = ns.LMI_Service.new_instance_name({ - "Name": service, - "CreationClassName" : "LMI_Service", - "SystemName" : cs.Name, - "SystemCreationClassName" : cs.CreationClassName - }) - inst = iname.to_instance() - if inst is None: - raise errors.LmiFailed('No such service "%s".' % service) - # process the service instance - -``service`` is a name provided by user. If such a service is not found, -``inst`` will be assigned ``None``. In this case we don't want to continue in -script's execution thus we raise an exception. We provide very clear message -that needs no other comment. We don't want any traceback to be printed, thus -the use of :py:class:`~lmi.scripts.common.errors.LmiFailed`. - -Detailed description --------------------- -These pages provide more details of some aspects: - -.. toctree:: - :maxdepth: 2 - - command-classes - command-properties - -Tutorial --------- - -.. toctree:: - :maxdepth: 2 - - script-tutorial - -------------------------------------------------------------------------------- - -.. seealso:: - - Docopt_ documentation. - - :ref:`command_classes` - - :ref:`command_properties` - - :ref:`script_tutorial` - -------------------------------------------------------------------------------- - -.. [#] Described by a POSIX. -.. [#] Default namespace is ``"root/cimv2"``. -.. [#] view: https://fedorahosted.org/openlmi/browser/openlmi-providers - git: ``ssh://git.fedorahosted.org/git/openlmi-providers.git/`` -.. [#] Simplified here means that there are no documentation strings - and no type checking. -.. [#] If logging to a file is enabled in configuration. -.. [#] Precisely in an ``__init__.py`` module of this package. -.. [#] These names must exactly match the names in usage strings. - -.. [#subprof] This is a subclass of ``CIM_RegisteredProfile`` thus it has the - same properties. -.. [#missing_version] If the Version qualifier is missing, -1 will be used - for comparison instead of empty string. - -.. **************************************************************************** - -.. _CIM: http://dmtf.org/standards/cim -.. _OpenLMI: http://fedorahosted.org/openlmi/ -.. _openlmi-tools: http://fedorahosted.org/openlmi/wiki/shell -.. _docopt: http://docopt.org/ -.. _`service description`: https://fedorahosted.org/openlmi/wiki/service -.. _`upstream git`: https://github.com/openlmi/openlmi-scripts diff --git a/doc/script-tutorial.rst b/doc/script-tutorial.rst deleted file mode 100644 index 517a9dd..0000000 --- a/doc/script-tutorial.rst +++ /dev/null @@ -1,447 +0,0 @@ -.. _script_tutorial: - -Script Tutorial -=============== - -This is a step-by-step tutorial on developing script library for -*OpenLMI* providers. - -Required knowledge ------------------- - -You should be familiar with terms like *CIM*, *cimom*, *schema*, -*provider*, *DMTF* profile. -`This <http://fedorahosted.org/openlmi/wiki/ProviderTutorialIntroduction>`_ -short tutorial should be enough to get you started. - -You should also be familiar with scripting in *python* and -`lmishell <http://www.openlmi.org/using_lmishell>`_ which we use heavily -in snippets below. - -Preparation ------------ - -This tutorial assumes you have ``tog-pegasus`` *cimom* up and running -with ``openlmi-logicalfile`` providers installed and registered on -remote host. We will connect to it from client machine which needs the -following installed: - -* ``openlmi-python-base`` -* ``openlmi-tools`` -* ``openlmi-scripts`` - -Installing python dependencies -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -For the first two items you may use standard rpms build for Fedora. The -first one is available from ''OpenLMI Nightly'' repository having the -newest builds: - -.. code-block:: sh - - cat > /etc/yum.repos.d/openlmi-nightly.repo - [openlmi-nightly] - name=openlmi-nightly - baseurl=http://openlmi-rnovacek.rhcloud.com/rpm/rawhide/ - gpgcheck=0 - enabled = 1 - ^D - -And then run: - -.. code-block:: sh - - yum install openlmi-python-base openlmi-tools - -Or you may install them to your user directory as python eggs with -``pip``: - -.. code-block:: sh - - pip install openlmi-python openlmi-tools - -The last one can only be installed with ``pip``: - -.. code-block:: sh - - pip install openlmi-scripts - -Or directly from git repository (viz `below <#install_from_git>`_). - -Setting up environment -~~~~~~~~~~~~~~~~~~~~~~ - -We'll stick to the process described -`here <https://github.com/openlmi/openlmi-scripts#developing-lmi-scripts>`_ -that let us develop quickly without the need to reinstall anything while -making changes. - -First let's check out our ``openlmi-scripts`` repository: - -:: - - git clone https://github.com/openlmi/openlmi-scripts.git - cd openlmi-scripts - -Optionally we may install ``openlmi-scripts`` to user directory if not -having done yet: - -.. code-block:: sh - - python setup.py install --user - -Then let's set up the workspace directory: - -.. code-block:: sh - - WSP=~/.python_workspace - mkdir $WSP - # may be added to `$HOME/.profile` or `$HOME/.bashrc` - export PYTHONPATH=$WSP:$PYTHONPATH - export PATH="$PATH:$WSP" - -Making our command structure -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -We'll use provided ``commands/make_new.py`` script to create the basic -structure and ``setup.py`` file: - -.. code-block:: sh - - cd commands - # this will ask us additional questions used to create setup.py file - ./make_new.py mylf - -Because a script implementation for ``OpenLMI LogicalFile`` profile is -already present in upstream repository (in ``commands/logicalfile``), we -need to name our library distinctly (e.g. ``mylf``). - -Following structure should be created: - -:: - - mylf - ├── doc - │ ├── _build - │ ├── cmdline.rst - │ ├── conf.py - │ ├── err.log - │ ├── index.rst - │ ├── make.bat - │ ├── _static - │ └── _templates - ├── lmi - │ ├── __init__.py - │ └── scripts - │ ├── __init__.py - │ └── mylf - │ ├── cmd.py - │ └── __init__.py - ├── README.md - └── setup.py - -We should check that everything matches in ``mylf/setup.py`` and correct -any shortcomings. - -OpenLMI LogicalFile introduction --------------------------------- - -*OpenLMI LogicalFile* is a CIM provider which provides a way to read -information about files and directories. The provider also allows to -traverse the file hierarchy, create and remove empty directories. - -.. figure:: _static/logicalfile.png - :align: center - :alt: LogicalFile model - - LogicalFile model - -It consists mainly of few specializations of ``CIM_LogicalFile`` -representing any type of file on filesystem, ``LMI_UnixFile`` holding -unix specific information for each such file and association classes -between them. ``CIM_LogicalFile`` has following key properties inherited -by ``LMI_*`` subclasses above: - -* **Name** -* **CSName** -* **CSCreationClassName** -* ``FSCreationClassName`` -* ``CreationClassName`` -* ``FSName`` - -Only those shown in **bold** are mandatory. Others are ignored when -requesting an instance of ``CIM_LogicalFile``. This applies also to -``LMI_UnixFile`` with **Name** being replaced with **LFName**. None of -the presented classes supports enumeration of instances. Only references -can be obtained. - -With ``CreateInstance()`` and ``DeleteInstance()`` calls issued on -class/object of ``LMI_UnixDirectory`` we are able to create and delete -directories. - -Writing usage string -~~~~~~~~~~~~~~~~~~~~ - -Usage string is a module's documentation, help message and a -prescription for command line parser all-in-one. Writing it is pretty -straightforward. Let's put it to ``mylf/lmi/scripts/mylf/cmd.py``: - -:: - - """ - Read informations about file system structure. - - Usage: - %(cmd)s list [options] <directory> - %(cmd)s show [-L] <file> - %(cmd)s create <directory> - %(cmd)s delete <directory> - - Options: - -t --type <type> Filter listed files by their type. One of: - any, file, device, directory, fifo, symlink, socket. - Defaults to any. - -L --dereference Causes symlink to be followed. - """ - -The first line provides a short description shown in help of ``lmi`` -meta-command for its registered subcommand. Text under ``Usage:`` and -``Options:`` are parsed by ``doctopt``. Please refer to its -documentation at http://docopt.org for more information. - -**Note** the ``%(cmd)s`` string which needs to be present instead of -``lmi mylf`` or similar command names. - -Let's add one more snippet so we can test it: - -:: - - from lmi.scripts.common import command - - MyLF = command.register_subcommands('MyLF', __doc__, {}) - -This creates a command multiplexer without any children (we'll add them -later). - -And finally let's modify our ``mylf/setup.py`` by adding entry point: - -:: - - entry_points={ - 'lmi.scripts.cmd': [ - 'mylf = lmi.scripts.mylf.cmd:MyLF', - ], - } - -Now we can install it and test it: - -.. code-block:: sh - - # make sure the $WSP is in $PYTHONPATH - python mylf/stup.py develop --install-dir=$WSP - lmi help - lmi help mylf - -We should be able to see the usage string we've written. - -Implementing ``list`` -~~~~~~~~~~~~~~~~~~~~~ - -Most of neccessary functionality has been implemented in previous -snippet for the ``show`` command. Following snippet is enough to -generate all the files in directory. Put it again to -``mylf/lmi/scripts/mylf/__init__.py``. - -:: - - def make_directory_instance_name(ns, directory): - """ - Retrieve object path of a directory. - - :type directory: string - :param directory: Full path to the directory. - :rtype: :py:class:`lmi.shell.LMIInstanceName` - """ - if directory != '/': - directory = directory.rstrip('/') - cs = get_computer_system(ns) - return ns.LMI_UnixDirectory.new_instance_name( - { 'CSCreationClassName' : cs.classname - , 'CSName' : cs.name - , 'CreationClassName' : 'LMI_UnixDirectory' - , 'FSCreationClassName' : 'LMI_LocalFileSystem' - , 'FSName' : '' - , 'Name' : directory}) - - def get_directory_instance(ns, directory): - """ - Retrieve instance of `LMI_UnixDirectory`. - - :type directory: string of :py:class:`lmi.shell.LMIInstanceName` - :param directory: Full path to the directory or its instance name. - :rtype: :py:class:`lmi.shell.LMIInstance` - """ - if isinstance(directory, basestring): - directory = make_directory_instance_name(ns, directory) - if isinstance(directory, LMIInstanceName): - directory = directory.to_instance() - return directory - - def list_directory(ns, directory, file_type='any'): - """ - Yields instances of ``CIM_LogicalFile`` representing direct children of the - given directory. - - :param directory: Either a file path or an instance of - ``LMI_UnixDirectory``. - :param file_type: Filter of files made by checking their type. One of: :: - - {'any', 'file', 'device', 'directory', 'fifo', 'symlink', 'socket'} - """ - def _generate_children(): - for child in get_directory_instance(ns, directory).associators( - AssocClass='LMI_DirectoryContainsFile', - Role='GroupComponent', - ResultRole='PartComponent'): - if ( file_type and file_type != 'any' - and logical_file_type_name(child) != file_type): - continue - yield child - return sorted(_generate_children(), key=lambda i: i.Name) - -Note the ``associators()`` call on ``LMI_UnixDirectory`` instance. It -enumerates all ``CIM_LogicalFile`` instances that are referenced by -``LMI_DirectoryContainsFile`` associations. These represent a relation -of parent directory and its direct children. Parent directory is -referenced with ``GroupComponent`` role while the children with -``PartComponent``. It's advisable to always provide as much information -to calls like: - -- ``associators()`` -- ``associator_names()`` -- ``references()`` -- ``reference_names()`` - -as possible. Without the ``AssocClass`` parameter given, broker would -try to enumerate all instrumented association classes possible, -resulting in very poor performance. Both ``Role`` and ``ResultRole`` -parameters need to be given here, otherwise a parent directory of the -one being enumerated would also appear in output. - -Following subclass of ``LmiInstanceLister`` needs to be added to -``mylf/lmi/scripts/mylf/cmd.py`` and added to ``MyLF`` subcommands -dictionary (omitted for now). - -:: - - class List(command.LmiInstanceLister): - CALLABLE = mylf.list_directory - PROPERTIES = ( - 'Name', - ('Type', mylf.logical_file_type_name), - ('Permissions', mylf.permission_string), - ('Size', 'FileSize')) - - def verify_options(self, options): - if ( options['--type'] is not None - and not options['--type'].lower() in { - 'any', 'file', 'directory', 'symlink', 'dev', 'socket', 'fifo'}): - raise errors.LmiInvalidOptions( - 'Unsupported type: %s' % options['--type']) - - def transform_options(self, options): - file_type = options.pop('--type') - if file_type is None: - file_type = 'any' - options['file-type'] = file_type - -Instead of defining our own ``execute()`` method, we just associate -wrapped function defined previously using ``CALLABLE`` property. Thanks -to the ability to transform option names in any way, we are not limited -to the use of arguments as listed in usage string. Apart from renaming -options, we also check for the value of ``--type``. Overriding -``verify_options()`` to check for validity of options is the more -preferred approach compared to delayed checking in associated function. - -Implementing ``create`` and ``delete`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Let's again start with content of ``mylf/lmi/scripts/mylf/__init__.py`` -module. - -:: - - def create_directory(ns, directory): - """ - Create a directory. - - :type directory: string - :param directory: Full path to the directory. - """ - ns.LMI_UnixDirectory.create_instance( - make_directory_instance_name(ns, directory).path.keybindings) - - def delete_directory(ns, directory): - """ - Delete an empty directory. - - :param directory: Either a file path or an instance of - ``LMI_UnixDirectory``. - """ - get_directory_instance(ns, directory).delete() - -``create_instance()`` call of any ``LMIClass`` creates a new instance, -in this case we create an instance of ``LMI_UnixDirectory``. If it -exists already, an exception will be raised. On the other hand, -``delete_directory()`` operates on an ``LMIInstance`` which must exists. -If directory does not exist or it's not empty, an exception will be -raised. - -Now let's move on to ``mylf/lmi/scripts/mylf/cmd.py``: - -:: - - class Create(command.LmiCheckResult): - EXPECT = None - CALLABLE = mylf.create_directory - - class Delete(command.LmiCheckResult): - EXPECT = None - CALLABLE = mylf.delete_directory - -``LmiCheckResult`` is a special command that prints no useful -information. It allows us to check, whether the associated function -returns expected result and prints an error if not. Here we expect -``None``. Associated functions in this case throw an exception upon any -error which have the same effect. For more information please refer to -its -`documentation <http://pythonhosted.org/openlmi-scripts/command-classes.html#lmicheckresult>`_. - -Test it -~~~~~~~ - -:: - - lmi -h $HOST mylf create /root/some_directory - # try it for the second time (it will fail) - lmi -h $HOST mylf create /root/some_directory - # now let's delete it - lmi -h $HOST mylf delete /root/some_directory - # try it for the second time (it will fail) - lmi -h $HOST mylf delete /root/some_directory - -Summary -------- - -Now that the script is ready and tested, we may commit it, push it, do a -pull request (on -`github <https://help.github.com/articles/using-pull-requests>`_) and -host it on `PyPI <https://pypi.python.org/pypi>`_: - -:: - - python setup.py register - python setup.py sdist upload - -You can also download source tarball :download:`tarball <_static/mylf.tar.gz>`. - diff --git a/doc/usage.rst b/doc/usage.rst deleted file mode 100644 index 70e19ca..0000000 --- a/doc/usage.rst +++ /dev/null @@ -1,133 +0,0 @@ -`lmi` meta-command usage -======================== -``lmi`` meta-command is a command line utility build on top of client-side -libraries. Each library for particular set of providers can declare one or -more commands that will be registered with ``lmi`` meta-command and will be -available to user at command line. - -Running from command line -------------------------- -It can run single command given on command line like this: :: - - lmi -h ${hostname} service list --all - -Getting help ------------- -For detailed help run: :: - - lmi --help - -To get a list of available commands with short descriptions: :: - - lmi help - -For help on a particular registered command: :: - - lmi help service - -Running in interactive mode ---------------------------- -Or it can be run in interactive mode when command is omitted: :: - - lmi -h ${hostname} - lmi> help - ... - lmi> sw search django - ... - lmi> sw install python-django - ... - lmi> exit - -The most important command is ``help`` which shows you possible commands. -It also accepts arguments: :: - - lmi> help storage raid - -prints help for raid subcommand of storage command. The same behaviour is achieved -with: :: - - lmi> storage raid --help - -Built-in commands -~~~~~~~~~~~~~~~~~ -Interactive mode comes with few special commands. To get their list together -with help, type: :: - - lmi> : help - -They are prefixed with ``:`` and optional space. Currently only namespace nesting -commands are supported. Those are ``:cd``, ``:..`` and ``:pwd``. - -Command namespaces -~~~~~~~~~~~~~~~~~~ -Most end-point commands (also known as multiplexers) have one or more subcommands -assigned. Namespace of such multiplexer is comprised of these subcommand's names. -The root multiplexer (also known as top-level command) has namespace comprised of -registered commands. - -.. figure:: _static/imode-tree.svg - :align: center - :alt: Command namespaces. - :width: 600px - -Above figure depicts command tree. On the left side is a top-level command. It -has two registered commands (``Storage`` and ``Software``) that creates its -namespace. Each of them has their own sub-commands -- either another -multiplexer (``LVCmd``, ``Repository``, etc.) or an end-point command. - -Under each multiplexer or top-level command is corresponding prompt with path. -This prompt becomes active when ``:cd`` command is used to nest into particular -command's namespace. Such a namespace begins an active one. Just one namespace -can be active at a moment. Commands from non-active namespaces are not -available. For example if ``RAIDCmd`` is currently active -- current command -path is ``/lmi/storage/raid``, just ``list`` and ``delete`` commands are -available ( note that in reality ``RAIDCMD`` has a lot more subcommands). Thus -one can not write ``enable`` or ``disable`` which belongs to ``Repository`` -command's namespace. - -There is also something like global namespace containing static commands and -built-ins. Commands from global namespace are accessible from any active -namespace. - -Static commands -+++++++++++++++ - - +------+------------------------------------------------------------------+ - | EOF | Same as hitting ``^D``. If some nested into some subcommand's | - | | namespace, it will map to ``:cd ..`` and parent namespace will | - | | become active. If the top-level namespace is active, program | - | | will exit. | - +------+------------------------------------------------------------------+ - | exit | Exits immediately. It accepts optional exit code as an argument. | - +------+------------------------------------------------------------------+ - | help | Lists available commands. Accepts command path as an optional | - | | argument. | - +------+------------------------------------------------------------------+ - -Changing command namespaces ---------------------------- -Changing or nesting to some command namespace can be achieved with built-in -commands ``:cd`` and ``:..``. The latter is just a shortcut for ``:cd ..`` that -changes to parent namespace. ``:cd`` accepts a path to command. Whole command -path begins with ``/lmi`` prefix which denotes top-level command. Path -beginning with a ``'/'`` is an absolute path, which means it contains all -command names on a path from top-level command to target one. Other paths are -relative to current command. - -Here is a an example of changing command namespaces: :: - - lmi> :pwd - /lmi - lmi> :cd storage - >storage> :pwd - /lmi/storage - >storage> :cd lv - >>lv> :pwd - /lmi/storage/lv - >>lv> :cd ../raid - >>raid> :cd ../../sw/repo - >>repo> :.. - >sw> :cd /storage # /lmi prefix is optional for absolute paths - >storage :cd / - lmi> - |