Bug 1136557

Summary: LMIInstance.doc() fails outside `lmishell`
Product: [Fedora] Fedora Reporter: Alois Mahdal <amahdal>
Component: openlmi-toolsAssignee: Peter Hatina <phatina>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: agk, miminar, phatina, tsmetana
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-03 11:14:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
a simple reproducer none

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