dockertest.dockercmd: Print stdin when provided

It's hard to know, what happened while executing a command, when you
don't know the provided stdin. This patch appends `<<< "..."` after the
docker execute message in case it's non-zero. I used "%r" to make it
easier to discover, that it's not part of the executed command plus to
decrease size of the log.

Example:
Execute /usr/bin/docker -D run --name test_rvSj fedora bash  <<< 'ls /\nexit\n'
Execute /usr/bin/docker -D run --name test_rvSj fedora ls /

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
Merge pull request #305 from ldoktor/stdin

dockertest.dockercmd: Print stdin when provided
subtests.docker_cli.tag: Bugfixes and style cleanup

* --force was impossible to set due to config automatic translation
* exit_code in FAIL branch was incorrectly controlled
* use NoFailDockerCmd and DockerCmd instead of AsyncDockerCmd
* add docstrings
* change bad names and other PEP8/pylint changes

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
subtests.docker_cli.tag: Add double_tag variants

This test tries to tag the same image multiple times:
* without --force: Expected failure
* with --force: Expected pass

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
dockertest: Changes missing image message to be more new user friendly.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
subtests.docker_cli.dockerinspect: Check CamelCase

This patch adds the CamelCase keys check into the
docker_cli/dockerinspect/inspect_all test.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
Merge pull request #378 from jzupka/fix_missing_img

dockertest: Changes missing image message to be more new user friendly.
dockertest.environment: Add support for INI config parser

this parser automatically gathers info from INI files about the subtest
configuration and prints it into the subtest documentation.

It requires #: prefix to store the value as description of following
configuration option.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
config_defaults: Use **string** to emphasize action required

Use **text** to emphasize description of variables, which need to be
changed before using the test.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
Add independent documentation module

*  Avoid playing games with docutils module w/in environment module.
   Make dedicated module for documentation rendering.
*  Break down classes further into a more managable tree w/ defined
   extension points.
*  Update all docstrings, add many more comments.
*  Update unittests
*  Updated Makefile to use new module + classes
*  Updated run_checkdocs.py to use new module + classes

Signed-off-by: Chris Evich <cevich@redhat.com>
Docs: Strip config. section from all docstrings

*  Some empty-section removal
*  Some re-numbering of steps

Signed-off-by: Chris Evich <cevich@redhat.com>
dockertest.documentation: Integrate INI parser

*  Class and static method name changed, but interface
   and behavior same.  Update ConfigINIParser.__init__() to use
   SubtestDoc.module_filenames(root_path).
*  Removed unnecessary support for nested keys and hiding
   certain types of format-parsing errors.  Added unittests
   to verify some DocBase class methods & behavior.
*  Pull in default config. section docs by way of prefixing
   subtest list with documentation substitution key.

Signed-off-by: Chris Evich <cevich@redhat.com>
Docs: Re-implement NoOverwriteDict as namedtuple

Provides similar benefits and instances will be
immutable.  Allows access to keys as if they were
attributes, generates it's own documentation.

The class-generator produces two methods with
private-names, though generated docs suggest
they are intended for subclass use.  Effectivly
renamed them with public names (``fields`` and
``asdict``)

Signed-off-by: Chris Evich <cevich@redhat.com>
Docs: Port Sphinx's rst to text writer module

*  Originally part of the Sphinx source code,
   it provided a convenient starting place
   to allow our tooling to produce regular text output.

*  Moderatly modified original to not
   depend on any other Sphinx-specific resources
   or constructs.

*  Folded several unnecessary abstractions/globals
   into the one or two places that needed them,
   simplifying code.

*  Fixed many areas that were failing PEP8/Pylint
   checks.  There are some I could not fix without
   a ton of work, and others that are simply part
   of the docutils interface.  In these few cases
   I simply locally disabled the specifc warnings
   and added comments.

Signed-off-by: Chris Evich <cevich@redhat.com>
Docs. Re-arrange general methods/classes up tree

*  The SummaryVisitor and various methods that use
   need to be relocated higher up the tree.  Future
   subclasses will need to make use of these as
   they provide generic format conversion facilities.

*  Add new doctree2text() method that makes use
   of previously added textwriter module and class.
   This method takes in RST and spits out nicely
   formatted text, for when html formatting is too
   rich and raw RST is too decorated.

Signed-off-by: Chris Evich <cevich@redhat.com>
Docs: Unify ConfigINIParser expand parsing ability

*  Having a class heirarchy that combined both parsing
   and presentation didn't fit well with the multi-input
   and multi-output needs for this module.  There were also
   several missing parser aspects needed to fully support
   and validating the incoming ConfigParser format.  These
   were added as encountered, along with the guts of the
   original parsing logic.

*  Parsing aspects of BaseConfigDocs, SubtestConfigDocs,
   and SubSubtestConfigDocs integrated into ConfigINIParser
   which now subclasses the builtin tuple, to represent
   the parsed result as an ordered immutable collection
   of DocItem instances (also immutable).  This guarantees
   end-to-end read-only qualities while encapsulating
   the parsed data along with some limited access to
   it's source context.

*  Presentation aspects of the former class heirarchy will
   be reimplemented and integrated later into a configuration-
   documentation specific subclass based on DocBase in order
   to decouple it fully from any dependency on subtest module
   docstring parsing input or output.

Signed-off-by: Chris Evich <cevich@redhat.com>
Docs: Move SummaryVisitor class below ConfigINIParser

Signed-off-by: Chris Evich <cevich@redhat.com>
Docs: Disable */** magic warning for all of dockertest

*  In all cases it shouldn't be abused, however occasional
   use is fine when associated with appropriate safeguards.

Signed-off-by: Chris Evich <cevich@redhat.com>
Docs: Implement ConfigDoc class to handle one section

*  Pass a single ini file through ConfigINIParser()
   and hold onto the result for rendering at a later
   time in some supported format.

*  When necessary, breaks down config docs into a
   general section and one section for each sub-subtest.
   Properly handles empty sections by not including them.

*  Doesn't impose any special-handling for DEFAULTS
   vs. subtest sections.  It's left up to the caller
   or subclasses if they are to be handled differently.

Signed-off-by: Chris Evich <cevich@redhat.com>
Docs: Improve docstrings and base_path insensitivity

*  Several classes accept a default base_path as a
   parameter to begin search for things.  However,
   it will likely be necessary to alter this value,
   possibly for all relevant classes at once.

*  Dropped the unnecessary RSTDoc sub-class and
   moved that functionality into a render method
   on SubtestDoc.

*  Updated docstrings and comments to better clarify
   or correct information.

Signed-off-by: Chris Evich <cevich@redhat.com>