cinder.services.list() fails with KeyError: service
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-cinderclient |
New
|
Undecided
|
Unassigned |
Bug Description
I have python-cinderclient 1.0.9 installed, and cinder 2014.1 on CentOS 6.5. Performing cinder service list from the CLI succeeds, but using the python API fails with a KeyError: service.
Here is the output of CLI:
(goldstone)
+------
| Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+------
| cinder-scheduler | controller-
| cinder-volume | controller-
| cinder-volume | volume-
+------
Here is the
In [1]: from cinderclient.v1 import client
In [2]: x = client.
In [3]: x.services.list()
Out[3]: -------
AttributeError Traceback (most recent call last)
<ipython-
----> 1 x.services.list()
/Users/
245 self.start_
246 self.write_
--> 247 format_dict, md_dict = self.compute_
248 self.write_
249 self.update_
/Users/
155
156 """
--> 157 return self.shell.
158
159 def write_format_
/Users/
150 md = None
151 try:
--> 152 data = formatter(obj)
153 except:
154 # FIXME: log the exception
/Users/
479 type_pprinters=
480 deferred_
--> 481 printer.pretty(obj)
482 printer.flush()
483 return stream.getvalue()
/Users/
345 if cls in self.type_
346 # printer registered in self.type_pprinters
--> 347 return self.type_
348 else:
349 # deferred printer
/Users/
529 p.text(',')
530 p.breakable()
--> 531 p.pretty(x)
532 if len(obj) == 1 and type(obj) is tuple:
533 # Special case for 1-item tuples.
/Users/
360 if callable(meth):
361 return meth(obj, self, cycle)
--> 362 return _default_
363 finally:
364 self.end_group()
/Users/
480 if getattr(klass, '__repr__', None) not in _baseclass_reprs:
481 # A user-provided repr.
--> 482 p.text(repr(obj))
483 return
484 p.begin_group(1, '<')
/Users/
23
24 def __repr__(self):
---> 25 return "<Service: %s>" % self.service
26
27
/Users/
269 return self.__getattr__(k)
270
--> 271 raise AttributeError(k)
272 else:
273 return self.__dict__[k]
AttributeError: service
Makes the service list call cinder return the list of services but the client tries to shows an attribute that is not contained in __repr__
IMO, a concatenation of binary@host could be used to give a name to the service
Example of list call
{u'services': [{u'binary': u'cinder- scheduler' ,
u'disabled_ reason' : None,
u'host' : u'jmolle- Controller' ,
u'state' : u'up',
u'status' : u'enabled',
u'updated_ at': u'2014- 05-06T13: 06:54.000000' ,
u'zone' : u'nova'},
{u'binary' : u'cinder-backup',
u'disabled_ reason' : None,
u'host' : u'jmolle- Controller' ,
u'state' : u'up',
u'status' : u'enabled',
u'updated_ at': u'2014- 05-06T13: 06:48.000000' ,
u'zone' : u'nova'},
{u'binary' : u'cinder-volume',
u'disabled_ reason' : None,
u'host' : u'jmolle- Controller' ,
u'state' : u'up',
u'status' : u'enabled',
u'updated_ at': u'2014- 05-06T13: 06:49.000000' ,
u'zone' : u'nova'}]}
Any thought?