Bug 880641

Summary: RHEVM-CLI: Wrong name of section in .rhevmshell causes to traceback when running rhevm-shell
Product: Red Hat Enterprise Virtualization Manager Reporter: Ilia Meerovich <iliam>
Component: ovirt-engine-cliAssignee: Michael Pasternak <mpastern>
Status: CLOSED ERRATA QA Contact: Ilia Meerovich <iliam>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.2.0CC: aburden, bazulay, dyasny, ecohen, iheim, oramraz, Rhev-m-bugs, sgrinber, ykaul
Target Milestone: ---   
Target Release: 3.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: SF4 Doc Type: Bug Fix
Doc Text:
A misnamed section in 'settings.py' prevented '.rhevmshellrc' from connecting to the interface, resulting in an error. The relevant section has been corrected and using '.rhevmshellrc' to connect to the interface now works as expected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-10 20:28:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 915537    

Description Ilia Meerovich 2012-11-27 13:33:11 UTC
.rhevmshellrc should be validated before used (or find another approach to solve this issue):

[imeerovi@imeerovi ART]$ cat ~/.rhevmshellrc
[rhevm-shell]
username = "admin@internal"
url = "https://jenkins-vm-16.qa.lab.tlv.redhat.com:443/api/"
insecure = True
#filter = False
#timeout = -1
password = 123456
[imeerovi@imeerovi ART]$ /usr/bin/rhevm-shell -c -I
Traceback (most recent call last):
  File "/usr/bin/rhevm-shell", line 9, in <module>
    load_entry_point('rhevm-shell==3.1.0.17-SNAPSHOT', 'console_scripts', 'rhevm-shell')()
  File "/usr/lib/python2.6/site-packages/ovirtcli/main.py", line 27, in main
    context = OvirtCliExecutionContext(sys.argv, parser)
  File "/usr/lib/python2.6/site-packages/ovirtcli/context.py", line 45, in __init__
    super(OvirtCliExecutionContext, self).__init__(args=args, option_parser=option_parser)
  File "/usr/lib/python2.6/site-packages/cli/context.py", line 70, in __init__
    self._load_settings()
  File "/usr/lib/python2.6/site-packages/cli/context.py", line 120, in _load_settings
    found, old_format = self.settings.load_config_file()
  File "/usr/lib/python2.6/site-packages/cli/settings.py", line 120, in load_config_file
    self[conf_key] = value
  File "/usr/lib/python2.6/site-packages/cli/settings.py", line 91, in __setitem__
    raise KeyError, 'unknown setting: %s' % key
KeyError: 'unknown setting: rhevm-shell:username'

Comment 1 Michael Pasternak 2012-11-27 13:43:54 UTC
can you provide reproducer? i.e conf file content + your cli version

Comment 2 Ilia Meerovich 2012-11-27 14:44:05 UTC
sure:
I did cat of my .rhevmshellrc at first message:
[rhevm-shell]
username = "admin@internal"
url = "https://jenkins-vm-16.qa.lab.tlv.redhat.com:443/api/"
insecure = True
#filter = False
#timeout = -1
password = 123456

Comment 3 Ilia Meerovich 2012-11-27 14:45:45 UTC
[imeerovi@imeerovi ART]$ rpm -qa | grep rhevm-cli
rhevm-cli-3.1.0.17-1.el6ev.noarch
[imeerovi@imeerovi ART]$

Comment 4 Michael Pasternak 2012-12-13 10:47:26 UTC
http://gerrit.ovirt.org/10023

Comment 5 Ilia Meerovich 2013-02-05 09:39:48 UTC
[imeerovi@imeerovi ART]$ /usr/bin/rhevm-shell -c --url=https://leonid_rhevm.qa.lab.tlv.redhat.com:443/api/ -u admin@internal -I
Traceback (most recent call last):
  File "/usr/bin/rhevm-shell", line 9, in <module>
    load_entry_point('rhevm-shell==3.2.0.3-SNAPSHOT', 'console_scripts', 'rhevm-shell')()
  File "/usr/lib/python2.6/site-packages/ovirtcli/main.py", line 27, in main
    context = OvirtCliExecutionContext(sys.argv, parser)
  File "/usr/lib/python2.6/site-packages/ovirtcli/context.py", line 45, in __init__
    super(OvirtCliExecutionContext, self).__init__(args=args, option_parser=option_parser)
  File "/usr/lib/python2.6/site-packages/cli/context.py", line 72, in __init__
    self._load_settings()
  File "/usr/lib/python2.6/site-packages/cli/context.py", line 128, in _load_settings
    found, old_format = self.settings.load_config_file()
  File "/usr/lib/python2.6/site-packages/cli/settings.py", line 115, in load_config_file
    if not cp.read(fname):
  File "/usr/lib64/python2.6/ConfigParser.py", line 286, in read
    self._read(fp, filename)
  File "/usr/lib64/python2.6/ConfigParser.py", line 482, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: /home/imeerovi/.rhevmshellrc, line: 1
'username = \n'
[imeerovi@imeerovi ART]$ fg
vim /home/imeerovi/.rhevmshellrc
[imeerovi@imeerovi ART]$ cat /home/imeerovi/.rhevmshellrc 
username = 
url = 
insecure = False
no_paging = False
filter = False
timeout = -1
password = 123456 
[imeerovi@imeerovi ART]$ rpm -q rhevm-cli
rhevm-cli-3.2.0.3-1.el6ev.noarch

Comment 6 Michael Pasternak 2013-02-05 09:57:25 UTC
(In reply to comment #5)
> [imeerovi@imeerovi ART]$ /usr/bin/rhevm-shell -c
> --url=https://leonid_rhevm.qa.lab.tlv.redhat.com:443/api/ -u admin@internal
> -I
> Traceback (most recent call last):
>   File "/usr/bin/rhevm-shell", line 9, in <module>
>     load_entry_point('rhevm-shell==3.2.0.3-SNAPSHOT', 'console_scripts',
> 'rhevm-shell')()
>   File "/usr/lib/python2.6/site-packages/ovirtcli/main.py", line 27, in main
>     context = OvirtCliExecutionContext(sys.argv, parser)
>   File "/usr/lib/python2.6/site-packages/ovirtcli/context.py", line 45, in
> __init__
>     super(OvirtCliExecutionContext, self).__init__(args=args,
> option_parser=option_parser)
>   File "/usr/lib/python2.6/site-packages/cli/context.py", line 72, in
> __init__
>     self._load_settings()
>   File "/usr/lib/python2.6/site-packages/cli/context.py", line 128, in
> _load_settings
>     found, old_format = self.settings.load_config_file()
>   File "/usr/lib/python2.6/site-packages/cli/settings.py", line 115, in
> load_config_file
>     if not cp.read(fname):
>   File "/usr/lib64/python2.6/ConfigParser.py", line 286, in read
>     self._read(fp, filename)
>   File "/usr/lib64/python2.6/ConfigParser.py", line 482, in _read
>     raise MissingSectionHeaderError(fpname, lineno, line)
> ConfigParser.MissingSectionHeaderError: File contains no section headers.
> file: /home/imeerovi/.rhevmshellrc, line: 1
> 'username = \n'
> [imeerovi@imeerovi ART]$ fg
> vim /home/imeerovi/.rhevmshellrc
> [imeerovi@imeerovi ART]$ cat /home/imeerovi/.rhevmshellrc 
> username = 
> url = 
> insecure = False
> no_paging = False
> filter = False
> timeout = -1
> password = 123456 
> [imeerovi@imeerovi ART]$ rpm -q rhevm-cli
> rhevm-cli-3.2.0.3-1.el6ev.noarch

ilia,

This is not what you've initially reported, you reported that "Wrong name of section [1] in .rhevmshell causes traceback",

now you removing "section header" [2], please file another bug on this and verify this one according to your original complaint.

[1] s/username=/usernameXXXX=
[2] s/[ovirt-shell]/nill

Comment 7 Ilia Meerovich 2013-02-07 12:28:55 UTC
will file another bug

Comment 8 errata-xmlrpc 2013-06-10 20:28:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0890.html