summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/README.md124
-rw-r--r--commands/account/Makefile20
-rw-r--r--commands/account/doc/conf.py.skel (renamed from commands/account/doc/conf.py)4
-rw-r--r--commands/account/setup.cfg2
-rw-r--r--commands/account/setup.py.skel (renamed from commands/account/setup.py)7
-rw-r--r--commands/hardware/Makefile1
-rw-r--r--commands/hardware/doc/conf.py.skel (renamed from commands/hardware/doc/conf.py)4
-rw-r--r--commands/hardware/setup.cfg2
-rw-r--r--commands/hardware/setup.py.skel (renamed from commands/hardware/setup.py)2
-rw-r--r--commands/logicalfile/Makefile20
-rw-r--r--commands/logicalfile/doc/conf.py.skel (renamed from commands/logicalfile/doc/conf.py)4
-rw-r--r--commands/logicalfile/setup.py.skel (renamed from commands/logicalfile/setup.py)7
-rwxr-xr-xcommands/make_new.py49
-rw-r--r--commands/networking/Makefile20
-rw-r--r--commands/networking/doc/conf.py.skel (renamed from commands/powermanagement/doc/conf.py)4
-rw-r--r--commands/networking/setup.py.skel (renamed from commands/networking/setup.py)2
-rw-r--r--commands/powermanagement/Makefile1
-rw-r--r--commands/powermanagement/doc/conf.py.skel (renamed from commands/networking/doc/conf.py)4
-rw-r--r--commands/powermanagement/setup.cfg2
-rw-r--r--commands/powermanagement/setup.py.skel (renamed from commands/powermanagement/setup.py)2
-rw-r--r--commands/service/Makefile20
-rw-r--r--commands/service/doc/conf.py.skel (renamed from commands/service/doc/conf.py)4
-rw-r--r--commands/service/setup.py.skel (renamed from commands/service/setup.py)7
-rw-r--r--commands/software/Makefile20
-rw-r--r--commands/software/doc/conf.py.skel (renamed from commands/software/doc/conf.py)4
-rw-r--r--commands/software/setup.py.skel (renamed from commands/software/setup.py)7
-rw-r--r--commands/storage/Makefile20
-rw-r--r--commands/storage/doc/conf.py.skel (renamed from commands/storage/doc/conf.py)4
-rw-r--r--commands/storage/setup.py.skel (renamed from commands/storage/setup.py)7
-rw-r--r--commands/system/Makefile20
-rw-r--r--commands/system/doc/conf.py.skel (renamed from commands/system/doc/conf.py)4
-rw-r--r--commands/system/lmi/scripts/system/__init__.py45
-rw-r--r--commands/system/setup.py.skel (renamed from commands/system/setup.py)2
33 files changed, 143 insertions, 302 deletions
diff --git a/commands/README.md b/commands/README.md
index 4ff3359..7221422 100644
--- a/commands/README.md
+++ b/commands/README.md
@@ -1,13 +1,12 @@
Subcommands
===========
-
Each provider has a set of subcommands represented by entry points in
`setup.py` script. They are installed as python eggs. Each such command is
located in its own subdirectory under `commands/`.
Structure
---------
-This directory contains all subcommands of lmi metacommand.
+This directory contains all subcommands of LMI Meta-command.
It has the following structrure:
commands
@@ -22,27 +21,28 @@ It has the following structrure:
│   ├── doc # usage and developer documentation
│   │   ├── cmdline.generated
│   │   ├── cmdline.rst # source in reStructured text [rst]
- │   │   ├── conf.py # documentation configuration
+ │   │   ├── conf.py.skel # documentation configuration
│   │   ├── index.rst # top-level documentation source
│   │   ├── Makefile
│   │   └── python.rst # library reference source
│   ├── README.md
- │   └── setup.py
+ │   ├── Makefile
+ │   └── setup.py.skel
│ ... ...
-Single library under `commands/<provider_prefix>/lmi/scripts` may implement
-one or more commands for `lmi` meta-command. To let the meta-command know of
-them, they must be listed in `entry_points` in setup file (see below).
+Single library under `commands/<provider_prefix>/lmi/scripts` may implement one
+or more commands for LMI Meta-command. To let it know of them, they must be
+listed in `entry_points` in setup file (see below).
-There is no limit for complexity of particular command library, it should
-provide easy to use interface for any third party python application for
-system management of remote hosts. Part of the interface is exported via
-commands to `lmi` meta-command. These, by a convention, are defined in
+There is no limit for complexity of particular script, it should provide an
+easy to use interface for any third party python application for system
+management of remote hosts. Part of the interface is exported via commands to
+LMI Meta-command. These, by a convention, are defined in
`lmi.scripts.<provider_prefix>.cmd` module.
### Documentation directory
Please stick to the structure presented above. It makes it easy to include
-library documents into the global documentation.
+library documents in a global documentation.
* `cmdline.generated` is a file in [*reStructuredText*][see rst] format generated
with `tools/help2rst` script from command's usage string.
@@ -51,6 +51,8 @@ library documents into the global documentation.
* `python.rst` just lists the modules from `lmi.scripts.<provider_prefix>` to
document for python reference.
* `index.rst` binds all the other files together.
+ * `conf.py.skel` contains a configuration template with macros replaced
+ with correct values when the `Makefile` is being processed.
### Generating it
You may use `make_new.py` script to generate whole directory structure with
@@ -61,13 +63,13 @@ regard to provided data. See its help message:
Setup file
----------
Allows to install command python egg and register their exported commands to
-particular namespace for `lmi` meta-command. The minimal script can look like
+particular namespace for LMI Meta-command. The minimal script can look like
this:
from setuptools import setup
setup(
name="<PROJECT>",
- version="<VERSION>",
+ version="@@VERSION@@",
install_requires=['openlmi-scripts'],
namespace_packages=['lmi', 'lmi.scripts'],
packages=['lmi', 'lmi.scripts', 'lmi.scripts.<provider_prefix>'],
@@ -78,6 +80,10 @@ this:
},
)
+This text needs to be store in `setup.py.skel` file. Regular `setup.py` will be
+created out of it when `make setup` is run. `@@VERSION@@` string will be
+replaced during this operation with correct version common to all the scripts.
+
It's advisable to fill more information about your command package like
*description* and *author*. Please refer to python documentation for
setuptools and see already created scripts under `commands/` directory for
@@ -92,93 +98,7 @@ description of *Command module* below.
[a-z]+(-[a-z]+)*(\.py)?
-Command module
---------------
-Is a python module named (by a convention) `.cmd` under your command library.
-It has a documentation string passeable to the `docopt` command line parser
-(see `http://docopt.org/`). The structure of this file is following:
-
- """
- Usage:
- %(cmd)s cmd1 [options]
- %(cmd)s cmd2 [options]
-
- """
- from lmi.scripts.common import LmiLister, register_subcommands
-
- class Cmd1(LmiLister):
- CALLABLE = "lmi.scripts.<provider_prefix>:cmd1_func"
-
- class Cmd2(LmiLister):
- CALLABLE = "lmi.scripts.<provider_prefix>:cmd2_func"
-
- Entry = register_subcommands(
- 'Entry', __doc__,
- { 'cmd1' : Cmd1,
- , 'cmd2' : Cmd2
- },
- requires=["<requirement_string>", ...])
-
-### Usage string
-Is very important here. The command line is parsed by
-`docopt` according to it. It must conform to POSIX standard for program help.
-Please refer to http://docopt.org/ for more information and examples.
-
-One notable detail here is the `%(cmd)s` string for command name. This
-is replaced with `lmi CMD_NAME` when running from command line or just
-`CMD_NAME` while in interactive mode. It's important to prefix your usage
-strings exactly this way. This also means that every `%` character must
-be doubled in usage string to avoid collisions in formatting.
-
-### Command classes
-Are defined in `lmi.scripts.common.commands` module. They affect the way how
-output is rendered to user. Please refer to this module for more information.
-
-### Top level command
-Function `register_subcommands` creates top-level command (refered to as
-`<CMD>` in section *Setup script* above), which passes control to one
-particular subcommand. To let the top-level command know, which command class
-instruments which command a mapping must be passed to this function. The
-global variable, which holds the result of this call must be listed in
-`entry_points` dictionary in `setup.py` script, otherwise it won't be
-available in `lmi` meta-command.
-
-### <requirement\_string>
-**This is not yet supported feature**
-
-Allows to specify, which profiles and their specific versions are neccessary
-to run this command. It's format can be described by following grammar:
-
- <requirement_string> :
- <instance_id> <op> <version>
- | <instance_id> ;
-
- <op> : < | > | = | <= | >= | != ;
-
-Where string enclosed in `<>` is a non-terminal symbol. `:` separates
-non-terminal symbol from the sequence of possible transcriptions
-(right-hand-sides of rules). `|` is a separator of individual transcriptions
-and `;` is symbol denoting the end of rules for single symbol.
-
-`<instance_id>` is a value of `LMI_RegisteredProfile::InstanceID` property.
-
-`<version>` is a version that is compared to given comparison operator to the
-version of installed profile with matching `InstanceID` on target system. It
-must match the following regular expression:
-
- [0-9]+\.[0-9]+\.[0-9]+
-
-First sequence of digits will be compared with `MajorVersion`, second to
-`MinorVersion` and third to the `RevisionNumber` of particular
-`LMI_RegisteredProfile` instance.
-
-`class_requirement_string` has equvalent grammar:
-
- <class_requirement_string> :
- <class_name> <op> <version>
- | <class_name> ;
-
-where `<class_name>` denotes the name of CIM class. And `<version>` the value
-of its `Version` qualifier in the mof file.
+For more information please refer to documentation at [script-development][].
+[script-development]: http://pythonhosted.org/openlmi-scripts/script-development.html# "Script Development"
[rst]: http://sphinx-doc.org/rest.html "reStructuredText"
diff --git a/commands/account/Makefile b/commands/account/Makefile
index 8c02686..ee4552b 100644
--- a/commands/account/Makefile
+++ b/commands/account/Makefile
@@ -1,19 +1 @@
-PYTHONPATH?=$(HOME)/workspace/python_sandbox
-DEVELOPDIR?=$(shell echo $(PYTHONPATH) | cut -d : -f 1)
-
-.PHONY: sdist develop upload_docs clean all
-
-all: sdist
-
-sdist:
- python setup.py sdist
-
-develop:
- python setup.py develop --install-dir=$(DEVELOPDIR)
-
-upload_docs:
- make -C doc html
- python setup.py upload_docs
-
-clean:
- make -C doc clean
+include ../../Makefile.inc
diff --git a/commands/account/doc/conf.py b/commands/account/doc/conf.py.skel
index 1f6e78f..9aee71a 100644
--- a/commands/account/doc/conf.py
+++ b/commands/account/doc/conf.py.skel
@@ -48,9 +48,9 @@ copyright = u'2014, Red Hat, Inc.'
# built documents.
#
# The short X.Y version.
-version = '0.0.1'
+version = "@@VERSION@@"
# The full version, including alpha/beta/rc tags.
-release = '0.0.1'
+release = "@@VERSION@@"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/commands/account/setup.cfg b/commands/account/setup.cfg
new file mode 100644
index 0000000..2ddce25
--- /dev/null
+++ b/commands/account/setup.cfg
@@ -0,0 +1,2 @@
+[upload_docs]
+upload-dir = doc/_build/html
diff --git a/commands/account/setup.py b/commands/account/setup.py.skel
index 8d81d71..86df908 100644
--- a/commands/account/setup.py
+++ b/commands/account/setup.py.skel
@@ -1,8 +1,5 @@
#!/usr/bin/env python
-PROJECT = 'openlmi-scripts-account'
-VERSION = '0.0.1'
-
from setuptools import setup, find_packages
try:
@@ -11,8 +8,8 @@ except IOError:
long_description = ''
setup(
- name=PROJECT,
- version=VERSION,
+ name='openlmi-scripts-account',
+ version='@@VERSION@@',
description='LMI command for system account administration.',
long_description=long_description,
author='Roman Rakus',
diff --git a/commands/hardware/Makefile b/commands/hardware/Makefile
new file mode 100644
index 0000000..ee4552b
--- /dev/null
+++ b/commands/hardware/Makefile
@@ -0,0 +1 @@
+include ../../Makefile.inc
diff --git a/commands/hardware/doc/conf.py b/commands/hardware/doc/conf.py.skel
index 79fe291..08b460a 100644
--- a/commands/hardware/doc/conf.py
+++ b/commands/hardware/doc/conf.py.skel
@@ -48,9 +48,9 @@ copyright = u'2013-2014, Red Hat, Inc.'
# built documents.
#
# The short X.Y version.
-version = '0.0.1'
+version = "@@VERSION@@"
# The full version, including alpha/beta/rc tags.
-release = '0.0.1'
+release = "@@VERSION@@"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/commands/hardware/setup.cfg b/commands/hardware/setup.cfg
new file mode 100644
index 0000000..2ddce25
--- /dev/null
+++ b/commands/hardware/setup.cfg
@@ -0,0 +1,2 @@
+[upload_docs]
+upload-dir = doc/_build/html
diff --git a/commands/hardware/setup.py b/commands/hardware/setup.py.skel
index 441612c..7f85956 100644
--- a/commands/hardware/setup.py
+++ b/commands/hardware/setup.py.skel
@@ -10,7 +10,7 @@ except IOError:
setup(
name='openlmi-scripts-hardware',
- version='0.0.3',
+ version='@@VERSION@@',
description='Hardware information available in OpenLMI hardware providers',
long_description=long_description,
author=u'Peter Schiffer',
diff --git a/commands/logicalfile/Makefile b/commands/logicalfile/Makefile
index 7d0a592..ee4552b 100644
--- a/commands/logicalfile/Makefile
+++ b/commands/logicalfile/Makefile
@@ -1,19 +1 @@
-PYTHONPATH?=$(HOME)/workspace/python_sandbox
-DEVELOPDIR?=$(shell echo $(PYTHONPATH) | cut -d : -f 1)
-
-.PHONY: sdist develop upload_docs clean
-
-all: sdist
-
-sdist:
- python setup.py sdist
-
-develop:
- python setup.py develop --install-dir=$(DEVELOPDIR)
-
-upload_docs:
- make -C doc html
- python setup.py upload_docs
-
-clean:
- make -C doc clean
+include ../../Makefile.inc
diff --git a/commands/logicalfile/doc/conf.py b/commands/logicalfile/doc/conf.py.skel
index 841f14b..eba7932 100644
--- a/commands/logicalfile/doc/conf.py
+++ b/commands/logicalfile/doc/conf.py.skel
@@ -48,9 +48,9 @@ copyright = u'2013-2014, Red Hat, Inc.'
# built documents.
#
# The short X.Y version.
-version = '0.0.3'
+version = "@@VERSION@@"
# The full version, including alpha/beta/rc tags.
-release = '0.0.3'
+release = "@@VERSION@@"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/commands/logicalfile/setup.py b/commands/logicalfile/setup.py.skel
index f3f32c8..466c6af 100644
--- a/commands/logicalfile/setup.py
+++ b/commands/logicalfile/setup.py.skel
@@ -1,8 +1,5 @@
#!/usr/bin/env python
-PROJECT = 'openlmi-scripts-logicalfile'
-VERSION = '0.0.3'
-
from setuptools import setup, find_packages
try:
@@ -11,8 +8,8 @@ except IOError:
long_description = ''
setup(
- name=PROJECT,
- version=VERSION,
+ name='openlmi-scripts-logicalfile',
+ version='@@VERSION@@',
description='LMI command for system logical file administration.',
long_description=long_description,
author='Jan Synacek',
diff --git a/commands/make_new.py b/commands/make_new.py
index 96821fc..a2a8111 100755
--- a/commands/make_new.py
+++ b/commands/make_new.py
@@ -7,8 +7,6 @@ Usage:
{cmd} [options] <command>
Options:
- -v --version <version> Version of script library.
- Defaults to {default_version}.
-a --author <author> Full name of library's author.
-e --email <email> Author's email address.
-d --description <description>
@@ -27,8 +25,6 @@ from sphinx import quickstart
RE_COMMAND_NAME = re.compile(r'^([a-z]+(_[a-z]+)*)$')
RE_RST_STATEMENT = re.compile(r'^\s*(:[^:]+:.*)')
-DEFAULT_VERSION = '0.0.1'
-
SETUP_TEMPLATE = \
u"""#!/usr/bin/env python
# -*- encoding: utf-8 -*-
@@ -42,7 +38,7 @@ except IOError:
setup(
name='openlmi-scripts-{name}',
- version={version!r},
+ version='@@VERSION@@',
{_description}description={description!r},
long_description=long_description,
{_author}author=u'{author}',
@@ -78,6 +74,11 @@ setup(
)
"""
+SETUP_CFG_TEMPLATE = """\
+[upload_docs]
+upload-dir = doc/_build/html
+"""
+
BSD_LICENSE_HEADER = \
"""# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
#
@@ -185,6 +186,10 @@ def write_setup(config, output_path):
with open(output_path, 'w') as setup_file:
setup_file.write(SETUP_TEMPLATE.format(**values).encode('utf-8'))
+def write_setup_cfg(config, output_path):
+ with open(output_path, 'w') as setup_file:
+ setup_file.write(SETUP_CFG_TEMPLATE)
+
def write_empty(config, output_path):
with open(output_path, 'w'):
pass
@@ -193,6 +198,10 @@ def write_cmdline(config, output_path):
with open(output_path, 'w') as cmdline_file:
cmdline_file.write(DOC_CMDLINE)
+def write_makefile(config, output_path):
+ with open(output_path, 'w') as cmdline_file:
+ cmdline_file.write('include ../../Makefile.inc')
+
def modify_doc_makefile(config, path):
s_add_cmd, s_add_phony, s_add_cmdregen, s_wait_help_end, s_done = range(5)
state = s_add_cmd
@@ -230,7 +239,8 @@ def modify_doc_index(config, path):
if state == s_wait_toc and line.startswith('.. toctree::'):
state = s_wait_empty_line
new.write(line)
- elif state == s_wait_empty_line and RE_RST_STATEMENT.match(line):
+ elif ( state == s_wait_empty_line
+ and RE_RST_STATEMENT.match(line)):
new.write(' ' +
RE_RST_STATEMENT.match(line).group(1) + '\n')
elif state == s_wait_empty_line and line == '\n':
@@ -248,8 +258,8 @@ def make_doc_directory(config, path):
'dot' : '_',
'project' : config['project_name'],
'author' : config['author'],
- 'version' : config['version'],
- 'release' : config['version'],
+ 'version' : '@@VERSION@@',
+ 'release' : '@@VERSION@@',
'suffix' : '.rst',
'master' : 'index',
'epub' : True,
@@ -265,6 +275,7 @@ def make_doc_directory(config, path):
'makefile' : True,
'batchfile' : True}
quickstart.generate(sphinx_conf)
+ os.rename(os.path.join(path, 'conf.py'), os.path.join(path, 'conf.py.skel'))
write_cmdline(config, os.path.join(path, 'cmdline.rst'))
modify_doc_makefile(config, os.path.join(path, 'Makefile'))
modify_doc_index(config, os.path.join(path, 'index.rst'))
@@ -272,7 +283,7 @@ def make_doc_directory(config, path):
STRUCTURE = {
'doc' : make_doc_directory,
# {
- # 'conf.py' : ...,
+ # 'conf.py.skel': ...,
# 'cmdline.rst' : ...,
# 'python.rst' : ...,
# 'index.rst' : ...,
@@ -287,8 +298,10 @@ STRUCTURE = {
}
}
},
- 'setup.py' : write_setup,
- 'README.md' : write_empty
+ 'setup.py.skel' : write_setup,
+ 'setup.cfg' : write_setup_cfg,
+ 'README.md' : write_empty,
+ 'Makefile' : write_makefile,
}
def make_file(config, filepath, prescription):
@@ -309,29 +322,25 @@ def make_command(config, base_dir):
def parse_command_line(args=None):
if args is None:
args = sys.argv[1:]
- usage = __doc__.format(
- cmd=os.path.basename(sys.argv[0]),
- default_version=DEFAULT_VERSION)
+ usage = __doc__.format(cmd=os.path.basename(sys.argv[0]))
options = docopt(usage, args)
- for opt_name in ('version', 'author', 'email', 'description'):
+ for opt_name in ('author', 'email', 'description'):
options[opt_name] = options.pop('--' + opt_name)
options['command'] = options.pop('<command>')
options['project_name'] = options.pop('--project-name')
if not RE_COMMAND_NAME.match(options['command']):
- die("command name must match regular expression {!r}", RE_COMMAND_NAME.pattern)
+ die("command name must match regular expression {!r}",
+ RE_COMMAND_NAME.pattern)
for info, question, default_value in (
- ('version', 'Library version [{default_version}]: ',
- DEFAULT_VERSION),
('author', 'Your name: ', None),
('email', 'Your email: ', None),
('description', 'Description: ', None)):
if options.get(info, None):
continue
try:
- options[info] = ask(
- question.format(default_version=DEFAULT_VERSION))
+ options[info] = ask(question)
except EOFError:
pass
if not options[info]:
diff --git a/commands/networking/Makefile b/commands/networking/Makefile
index 7d0a592..ee4552b 100644
--- a/commands/networking/Makefile
+++ b/commands/networking/Makefile
@@ -1,19 +1 @@
-PYTHONPATH?=$(HOME)/workspace/python_sandbox
-DEVELOPDIR?=$(shell echo $(PYTHONPATH) | cut -d : -f 1)
-
-.PHONY: sdist develop upload_docs clean
-
-all: sdist
-
-sdist:
- python setup.py sdist
-
-develop:
- python setup.py develop --install-dir=$(DEVELOPDIR)
-
-upload_docs:
- make -C doc html
- python setup.py upload_docs
-
-clean:
- make -C doc clean
+include ../../Makefile.inc
diff --git a/commands/powermanagement/doc/conf.py b/commands/networking/doc/conf.py.skel
index 41ffdb4..f1446f9 100644
--- a/commands/powermanagement/doc/conf.py
+++ b/commands/networking/doc/conf.py.skel
@@ -48,9 +48,9 @@ copyright = u'2013, Radek Novacek'
# built documents.
#
# The short X.Y version.
-version = '0.0.1'
+version = "@@VERSION@@"
# The full version, including alpha/beta/rc tags.
-release = '0.0.1'
+release = "@@VERSION@@"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/commands/networking/setup.py b/commands/networking/setup.py.skel
index b18c030..6dabfdd 100644
--- a/commands/networking/setup.py
+++ b/commands/networking/setup.py.skel
@@ -10,7 +10,7 @@ except IOError:
setup(
name='openlmi-scripts-networking',
- version='0.0.2',
+ version='@@VERSION@@',
description='LMI command for network administration.',
long_description=long_description,
author=u'Radek Novacek',
diff --git a/commands/powermanagement/Makefile b/commands/powermanagement/Makefile
new file mode 100644
index 0000000..ee4552b
--- /dev/null
+++ b/commands/powermanagement/Makefile
@@ -0,0 +1 @@
+include ../../Makefile.inc
diff --git a/commands/networking/doc/conf.py b/commands/powermanagement/doc/conf.py.skel
index 5138a89..f1446f9 100644
--- a/commands/networking/doc/conf.py
+++ b/commands/powermanagement/doc/conf.py.skel
@@ -48,9 +48,9 @@ copyright = u'2013, Radek Novacek'
# built documents.
#
# The short X.Y version.
-version = '0.0.2'
+version = "@@VERSION@@"
# The full version, including alpha/beta/rc tags.
-release = '0.0.2'
+release = "@@VERSION@@"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/commands/powermanagement/setup.cfg b/commands/powermanagement/setup.cfg
new file mode 100644
index 0000000..2ddce25
--- /dev/null
+++ b/commands/powermanagement/setup.cfg
@@ -0,0 +1,2 @@
+[upload_docs]
+upload-dir = doc/_build/html
diff --git a/commands/powermanagement/setup.py b/commands/powermanagement/setup.py.skel
index 6613348..5fe420d 100644
--- a/commands/powermanagement/setup.py
+++ b/commands/powermanagement/setup.py.skel
@@ -10,7 +10,7 @@ except IOError:
setup(
name='openlmi-scripts-powermanagement',
- version='0.0.1',
+ version='@@VERSION@@',
description='LMI command for power management.',
long_description=long_description,
author=u'Radek Novacek',
diff --git a/commands/service/Makefile b/commands/service/Makefile
index 7d0a592..ee4552b 100644
--- a/commands/service/Makefile
+++ b/commands/service/Makefile
@@ -1,19 +1 @@
-PYTHONPATH?=$(HOME)/workspace/python_sandbox
-DEVELOPDIR?=$(shell echo $(PYTHONPATH) | cut -d : -f 1)
-
-.PHONY: sdist develop upload_docs clean
-
-all: sdist
-
-sdist:
- python setup.py sdist
-
-develop:
- python setup.py develop --install-dir=$(DEVELOPDIR)
-
-upload_docs:
- make -C doc html
- python setup.py upload_docs
-
-clean:
- make -C doc clean
+include ../../Makefile.inc
diff --git a/commands/service/doc/conf.py b/commands/service/doc/conf.py.skel
index 8244025..29770eb 100644
--- a/commands/service/doc/conf.py
+++ b/commands/service/doc/conf.py.skel
@@ -48,9 +48,9 @@ copyright = u'2013-2014, Red Hat, Inc.'
# built documents.
#
# The short X.Y version.
-version = '0.1.2'
+version = "@@VERSION@@"
# The full version, including alpha/beta/rc tags.
-release = '0.1.2'
+release = "@@VERSION@@"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/commands/service/setup.py b/commands/service/setup.py.skel
index cb994e3..105379e 100644
--- a/commands/service/setup.py
+++ b/commands/service/setup.py.skel
@@ -1,8 +1,5 @@
#!/usr/bin/env python
-PROJECT = 'openlmi-scripts-service'
-VERSION = '0.1.2'
-
from setuptools import setup, find_packages
try:
@@ -11,8 +8,8 @@ except IOError:
long_description = ''
setup(
- name=PROJECT,
- version=VERSION,
+ name='openlmi-scripts-service',
+ version='@@VERSION@@',
description='LMI command for system service administration.',
long_description=long_description,
author='Michal Minar',
diff --git a/commands/software/Makefile b/commands/software/Makefile
index 7d0a592..ee4552b 100644
--- a/commands/software/Makefile
+++ b/commands/software/Makefile
@@ -1,19 +1 @@
-PYTHONPATH?=$(HOME)/workspace/python_sandbox
-DEVELOPDIR?=$(shell echo $(PYTHONPATH) | cut -d : -f 1)
-
-.PHONY: sdist develop upload_docs clean
-
-all: sdist
-
-sdist:
- python setup.py sdist
-
-develop:
- python setup.py develop --install-dir=$(DEVELOPDIR)
-
-upload_docs:
- make -C doc html
- python setup.py upload_docs
-
-clean:
- make -C doc clean
+include ../../Makefile.inc
diff --git a/commands/software/doc/conf.py b/commands/software/doc/conf.py.skel
index a48fb0f..b5d0634 100644
--- a/commands/software/doc/conf.py
+++ b/commands/software/doc/conf.py.skel
@@ -48,9 +48,9 @@ copyright = u'2013-2014, Red Hat, Inc.'
# built documents.
#
# The short X.Y version.
-version = '0.2.5'
+version = "@@VERSION@@"
# The full version, including alpha/beta/rc tags.
-release = '0.2.5'
+release = "@@VERSION@@"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/commands/software/setup.py b/commands/software/setup.py.skel
index 49522cd..834d05b 100644
--- a/commands/software/setup.py
+++ b/commands/software/setup.py.skel
@@ -1,8 +1,5 @@
#!/usr/bin/env python
-PROJECT = 'openlmi-scripts-software'
-VERSION = '0.2.5'
-
from setuptools import setup, find_packages
try:
@@ -11,8 +8,8 @@ except IOError:
long_description = ''
setup(
- name=PROJECT,
- version=VERSION,
+ name='openlmi-scripts-software',
+ version='@@VERSION@@',
description='LMI command for system software administration.',
long_description=long_description,
author='Michal Minar',
diff --git a/commands/storage/Makefile b/commands/storage/Makefile
index 8c02686..ee4552b 100644
--- a/commands/storage/Makefile
+++ b/commands/storage/Makefile
@@ -1,19 +1 @@
-PYTHONPATH?=$(HOME)/workspace/python_sandbox
-DEVELOPDIR?=$(shell echo $(PYTHONPATH) | cut -d : -f 1)
-
-.PHONY: sdist develop upload_docs clean all
-
-all: sdist
-
-sdist:
- python setup.py sdist
-
-develop:
- python setup.py develop --install-dir=$(DEVELOPDIR)
-
-upload_docs:
- make -C doc html
- python setup.py upload_docs
-
-clean:
- make -C doc clean
+include ../../Makefile.inc
diff --git a/commands/storage/doc/conf.py b/commands/storage/doc/conf.py.skel
index f8c6d91..91e0905 100644
--- a/commands/storage/doc/conf.py
+++ b/commands/storage/doc/conf.py.skel
@@ -48,9 +48,9 @@ copyright = u'2013-2014, Red Hat, Inc.'
# built documents.
#
# The short X.Y version.
-version = '0.0.5'
+version = "@@VERSION@@"
# The full version, including alpha/beta/rc tags.
-release = '0.0.5'
+release = "@@VERSION@@"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/commands/storage/setup.py b/commands/storage/setup.py.skel
index a90b751..93ddf3f 100644
--- a/commands/storage/setup.py
+++ b/commands/storage/setup.py.skel
@@ -1,8 +1,5 @@
#!/usr/bin/env python
-PROJECT = 'openlmi-scripts-storage'
-VERSION = '0.0.5'
-
from setuptools import setup, find_packages
try:
@@ -11,8 +8,8 @@ except IOError:
long_description = ''
setup(
- name=PROJECT,
- version=VERSION,
+ name='openlmi-scripts-storage',
+ version='@@VERSION@@',
description='LMI command for system storage administration.',
long_description=long_description,
author='Jan Safranek',
diff --git a/commands/system/Makefile b/commands/system/Makefile
index 7d0a592..ee4552b 100644
--- a/commands/system/Makefile
+++ b/commands/system/Makefile
@@ -1,19 +1 @@
-PYTHONPATH?=$(HOME)/workspace/python_sandbox
-DEVELOPDIR?=$(shell echo $(PYTHONPATH) | cut -d : -f 1)
-
-.PHONY: sdist develop upload_docs clean
-
-all: sdist
-
-sdist:
- python setup.py sdist
-
-develop:
- python setup.py develop --install-dir=$(DEVELOPDIR)
-
-upload_docs:
- make -C doc html
- python setup.py upload_docs
-
-clean:
- make -C doc clean
+include ../../Makefile.inc
diff --git a/commands/system/doc/conf.py b/commands/system/doc/conf.py.skel
index 4d1fbe7..29c1048 100644
--- a/commands/system/doc/conf.py
+++ b/commands/system/doc/conf.py.skel
@@ -48,9 +48,9 @@ copyright = u'2014, Peter Schiffer'
# built documents.
#
# The short X.Y version.
-version = '0.0.2'
+version = "@@VERSION@@"
# The full version, including alpha/beta/rc tags.
-release = '0.0.2'
+release = "@@VERSION@@"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/commands/system/lmi/scripts/system/__init__.py b/commands/system/lmi/scripts/system/__init__.py
index 9588ec3..8617138 100644
--- a/commands/system/lmi/scripts/system/__init__.py
+++ b/commands/system/lmi/scripts/system/__init__.py
@@ -110,6 +110,7 @@ def get_system_info(ns):
result += get_hwinfo(ns)
result += get_osinfo(ns)
result += get_servicesinfo(ns)
+ result += get_networkinfo(ns)
return result
def get_hostname(ns):
@@ -231,3 +232,47 @@ def get_servicesinfo(ns):
('Firewall:', fw),
('Logging:', logging)]
return result
+
+def get_networkinfo(ns):
+ """
+ :returns: Tabular data of networking status.
+ :rtype: List of tuples
+ """
+ result = [('', ''), ('Networking', '')]
+ try:
+ lan_endpoints = get_all_instances(ns, 'LMI_LANEndpoint')
+ except LMIClassNotFound:
+ result.append((' N/A', ''))
+ return result
+ nic = 1
+ for lan_endpoint in lan_endpoints:
+ if lan_endpoint.Name == 'lo':
+ continue
+ result += [
+ (' NIC %d' % nic, ''),
+ (' Name:', lan_endpoint.Name)]
+ try:
+ ip_net_con = lan_endpoint.associators(
+ ResultClass='LMI_IPNetworkConnection')[0]
+ result.append((' Status:',
+ ns.LMI_IPNetworkConnection.OperatingStatusValues.value_name(
+ ip_net_con.OperatingStatus)))
+ except LMIClassNotFound:
+ pass
+ try:
+ for ip_protocol_endpoint in lan_endpoint.associators(
+ ResultClass='LMI_IPProtocolEndpoint'):
+ if ip_protocol_endpoint.ProtocolIFType == \
+ ns.LMI_IPProtocolEndpoint.ProtocolIFTypeValues.IPv4:
+ result.append((' IPv4 Address:',
+ ip_protocol_endpoint.IPv4Address))
+ elif ip_protocol_endpoint.ProtocolIFType == \
+ ns.LMI_IPProtocolEndpoint.ProtocolIFTypeValues.IPv6:
+ result.append((' IPv6 Address:',
+ ip_protocol_endpoint.IPv6Address))
+ except LMIClassNotFound:
+ pass
+ result += [
+ (' MAC Address:', lan_endpoint.MACAddress)]
+ nic += 1
+ return result
diff --git a/commands/system/setup.py b/commands/system/setup.py.skel
index 57b07a7..71c3bfe 100644
--- a/commands/system/setup.py
+++ b/commands/system/setup.py.skel
@@ -10,7 +10,7 @@ except IOError:
setup(
name='openlmi-scripts-system',
- version='0.0.2',
+ version='@@VERSION@@',
description='Display general system information',
long_description=long_description,
author=u'Peter Schiffer',