Bug 1136557 - LMIInstance.doc() fails outside `lmishell`
Summary: LMIInstance.doc() fails outside `lmishell`
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: openlmi-tools
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Peter Hatina
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-02 21:25 UTC by Alois Mahdal
Modified: 2014-09-03 11:14 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-09-03 11:14:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
a simple reproducer (395 bytes, text/plain)
2014-09-02 21:31 UTC, Alois Mahdal
no flags Details

Description Alois Mahdal 2014-09-02 21:25:28 UTC
Description of problem
======================

With various classes/instances, LMIInstance.doc() always fails if called outside `lmishell`.

The failure propagates as ValueError from textwrap; trace leads to `LMITextFormatter.format` (line 101 of LMIFormatter.py.
    


Version-Release number of selected component (if applicable):
============================================
openlmi-tools-0.10.1 (built from git repo)


How reproducible
================

Always (outside lmiwbem)


Steps to Reproduce:
 1. c = connect(..)
 2. i = c.root.cimv2.CIM_ManagedElement.first_instance()
 3. i.doc()


Actual results
==============

Traceback as described above


Expected results
================

Displaying of documentation


Additional info
===============

  * Observed with LMI and non-LMI instances.

  * With lmishell, this displays lister with a MOF-like documentation

  * Full traceback:

        Traceback (most recent call last):
          File "./docfail.lmishell", line 25, in <module>
            i.doc()
          File "/usr/lib/python2.7/site-packages/openlmi_tools-0.10.1-py2.7.egg/lmi/shell/LMIDecorators.py", line 228, in wrapper
            return fn(self_wr, *args, **kwargs)
          File "/usr/lib/python2.7/site-packages/openlmi_tools-0.10.1-py2.7.egg/lmi/shell/LMIDecorators.py", line 99, in wrapper
            return fn(self_wr, *args, **kwargs)
          File "/usr/lib/python2.7/site-packages/openlmi_tools-0.10.1-py2.7.egg/lmi/shell/LMIInstance.py", line 257, in doc
            formatter.fancy_format(self._conn.client.interactive)
          File "/usr/lib/python2.7/site-packages/openlmi_tools-0.10.1-py2.7.egg/lmi/shell/LMIFormatter.py", line 148, in fancy_format
            self.format(0, 0, self._width)
          File "/usr/lib/python2.7/site-packages/openlmi_tools-0.10.1-py2.7.egg/lmi/shell/LMIFormatter.py", line 308, in format
            formatter.format(indent, width, f)
          File "/usr/lib/python2.7/site-packages/openlmi_tools-0.10.1-py2.7.egg/lmi/shell/LMIFormatter.py", line 101, in format
            for l in wrapper.wrap(self._text):
          File "/usr/lib64/python2.7/textwrap.py", line 329, in wrap
            return self._wrap_chunks(chunks)
          File "/usr/lib64/python2.7/textwrap.py", line 258, in _wrap_chunks
            raise ValueError("invalid width %r (must be > 0)" % self.width)
        ValueError: invalid width 0 (must be > 0)

Comment 1 Alois Mahdal 2014-09-02 21:31:24 UTC
Created attachment 933910 [details]
a simple reproducer

Comment 2 Peter Hatina 2014-09-03 11:14:35 UTC
Fixed:
- git (2354ffe)
- openlmi-tools-0.10.1-2.fc21
- openlmi-tools-0.10.1-2.fc22


Note You need to log in before you can comment on or make changes to this bug.