This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/723/

openlmi-mof-register.py (Diff revision 1)
54
def usage():
This could be turned to docopt parseable usage string. It's pity we don't want to depend on it :(.

Anyway it would be nice to use some smart argument parser, that would do the hard work of checking for us. For example argparse. But this could be done later.

openlmi-mof-register.py (Diff revision 1)
207
def unregister(mofs, reg, version, namespace, cimom):
I'd probably move the body of conditions to separate functions (unregister_sfcbd(), unregister_pegasus()).

openlmi-mof-register.py (Diff revision 1)
218
        devnull = open("/dev/null", "w")
Since ``devnull`` is handy on multiple places like this, I think it would make sense to make it a global variable.

Or make an override for ``subprocess.call()`` like this:

def call(*args, **kwargs):
  with open("/dev/null", "w") as devnull:
    kwargs['stdout'] = devnull
    kwargs['stderr'] = devnull
    return subprocess.call(*args, **kwargs)

usage:
  ret = call(["/usr/sbin/cimserver", "--status"])

openlmi-mof-register.py (Diff revision 1)
225
            regfile = open(reg, "r")
Please use:
  with open("regfile", "w") as regfile:
     # guarded code with ``regfile`` available
  # no explicit ``close()`` call needed

It's more readable and robust.
It applies to other open() calls as well.

- Michal Minar


On August 15th, 2013, 1:50 p.m. UTC, Tomas Smetana wrote:

Review request for OpenLMI Developers.
By Tomas Smetana.

Updated Aug. 15, 2013, 1:50 p.m.

Repository: openlmi-providers

Description

Here's a new registration script. It's a merge of the existing openlmi-mof-register and openlmi-register pegasus and should work as drop-in replacement for the openlmi-mof-register. The only slight difference is that the Pegasus interop namespace is not hard coded into the Pegasus registration calls but now there's an attempt to detect the right one.  And the whole thing is now written in (sort of) Python.

This is only the first step in the registration rewrite: Python should make it easier for manipulating a "side database" that would keep the registration data independently of the CIMOMs and eventually allow for re-registration when a new CIMOM is installed or upgraded.  This will also make possible for the providers package not to depend on a CIMOM.  I will prepare some design sketches of the registration process I envision to gather feedback and ideas: doing this correctly and robustly enough is going to be rather difficult.

Diffs

  • openlmi-mof-register.py (PRE-CREATION)

View Diff