cloudera / cm_api

Cloudera Manager API Client
Apache License 2.0
307 stars 284 forks source link

missing property in ApiHdfsReplicationArguments definition causing get_replication_schedules() to fail #31

Open schaffino opened 9 years ago

schaffino commented 9 years ago

I'm getting following error when trying to use get_replication_schedules on the hive service with the latest python release of the cm_api.

>>>hive_service.get_replication_schedules()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/services.py", line 1495, in get_replication_schedules
    api_version=3)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 357, in _get
    api_version)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 380, in _call
    api_version)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 143, in call
    return ApiList.from_json_dict(ret, method.im_self, ret_type)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 421, in from_json_dict
    items = [ attr.from_json(resource_root, x) for x in dic[ApiList.LIST_KEY] ]
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 97, in from_json
    return self._atype.from_json_dict(data, resource_root)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 288, in from_json_dict
    obj._set_attrs(dic, allow_ro=True)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 225, in _set_attrs
    v = attr.from_json(self._get_resource_root(), v)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 97, in from_json
    return self._atype.from_json_dict(data, resource_root)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 288, in from_json_dict
    obj._set_attrs(dic, allow_ro=True)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 225, in _set_attrs
    v = attr.from_json(self._get_resource_root(), v)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 97, in from_json
    return self._atype.from_json_dict(data, resource_root)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 288, in from_json_dict
    obj._set_attrs(dic, allow_ro=True)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 223, in _set_attrs
    attr = self._check_attr(k, allow_ro)
  File "/dhcommon/dhpython/python/lib/python2.7/site-packages/cm_api/endpoints/types.py", line 236, in _check_attr
    (name, self.__class__.__name__))
AttributeError: Invalid property bandwidthPerMap for class ApiHdfsReplicationArguments.

It seems that bandwidthPerMap is missing from the definition of ApiHdfsReplicationArguments in m_api/endpoints/types.py. Adding it to the attributes fixes the problem.