From 4addc5b4891943d562926ada5d4e08666d53206e Mon Sep 17 00:00:00 2001 From: adobdin Date: Sat, 28 May 2016 17:28:25 +0000 Subject: [PATCH] added: environment file with global parameters for setup and docs --- doc/source/conf.py | 7 ++++--- doc/source/specification.rst | 4 ++-- doc/source/tools.rst | 4 ++-- doc/source/usage.rst | 8 ++++---- setup.py | 5 +++-- sphinx-build.sh | 2 ++ timmy/env.py | 6 ++++++ 7 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 timmy/env.py diff --git a/doc/source/conf.py b/doc/source/conf.py index 0b63b77..1690a88 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -15,6 +15,7 @@ import sys import os import shlex +from timmy.env import version, project_name # 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 @@ -51,7 +52,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'timmy' +project = project_name #copyright = u'2015, Mirantis' author = u'Mirantis' @@ -60,9 +61,9 @@ author = u'Mirantis' # built documents. # # The short X.Y version. -version = u'0.1' +version = version # The full version, including alpha/beta/rc tags. -release = u'0.1' +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/source/specification.rst b/doc/source/specification.rst index 932e3eb..939cd5c 100644 --- a/doc/source/specification.rst +++ b/doc/source/specification.rst @@ -1,6 +1,6 @@ -======= +============= Specification -======= +============= * The tool is based on https://etherpad.openstack.org/p/openstack-diagnostics diff --git a/doc/source/tools.rst b/doc/source/tools.rst index e122cdf..2ada477 100644 --- a/doc/source/tools.rst +++ b/doc/source/tools.rst @@ -1,6 +1,6 @@ -============= +============ Tools module -============= +============ .. automodule:: timmy.tools :members: \ No newline at end of file diff --git a/doc/source/usage.rst b/doc/source/usage.rst index 245d305..a4ac991 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -26,18 +26,18 @@ Basic parameters: Shell mode - rqfile (``rq.yaml`` by default) is skipped, Fuel node is skipped, outputs of commands (specified with ``-C`` options) and scripts (specified with ``-S``) are printed on screen. -===== +======== Examples -===== +======== * ``timmy -C 'uptime; free -m'`` - check uptime and memory on all nodes * ``timmy -G /etc/nova/nova.conf`` - get nova.conf from all nodes * ``timmy -R controller -P package.deb '' -C 'dpkg -i package.deb' -C 'rm package.deb' -C 'dpkg -l | grep [p]ackage'`` - push a package to all nodes, install it, remove the file and check that it is installed * ``timmy -с myconf.yaml`` - use a custom config file and run according to it -===== +=============================== Using custom configuration file -===== +=============================== If you want to do a set of actions on the nodes and you do not want to write a long command line (or you want to use options only available in config), you may want to set up config file instead. An example config structure would be: diff --git a/setup.py b/setup.py index cfaeece..116c80f 100644 --- a/setup.py +++ b/setup.py @@ -2,15 +2,16 @@ from setuptools import setup import os +from timmy.env import project_name, version -pname = 'timmy' +pname = project_name dtm = os.path.join(os.path.abspath(os.sep), 'usr', 'share', pname) rqfiles = [(os.path.join(dtm, root), [os.path.join(root, f) for f in files]) for root, dirs, files in os.walk('rq')] rqfiles.append((os.path.join(dtm, 'configs'), ['config.yaml', 'rq.yaml'])) setup(name=pname, - version='1.2.0', + version=version, author="Aleksandr Dobdin", author_email='dobdin@gmail.com', license='Apache2', diff --git a/sphinx-build.sh b/sphinx-build.sh index 9f532d6..891c7ef 100755 --- a/sphinx-build.sh +++ b/sphinx-build.sh @@ -15,7 +15,9 @@ # under the License. # Builds a Sphinx documentation +rm -rf doc/build/ sphinx-build -b html doc/source/ doc/build/ + rm -f ./*.pyc rm -f ./timmy/*.pyc diff --git a/timmy/env.py b/timmy/env.py new file mode 100644 index 0000000..ba611ba --- /dev/null +++ b/timmy/env.py @@ -0,0 +1,6 @@ +project_name = 'timmy' +version = '1.2.0' + +if __name__ == '__main__': + exit(0) +