Skip to content

Commit

Permalink
[api] OPSAPS-32658. Add pools refresh endpoint
Browse files Browse the repository at this point in the history
Nothing special. It's been MIA for a while.

>>> from cm_api.api_client import ApiResource
>>> api=ApiResource("nightly-1.gce.cloudera.com", username="admin", password="admin")
>>> cluster=api.get_cluster("Cluster 1")
>>> cmd = cluster.pools_refresh()
  • Loading branch information
hermancc committed Mar 10, 2016
1 parent 2151df0 commit c385539
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions python/src/cm_api/endpoints/clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,15 @@ def export(self, export_auto_config=False):
return self._get("export", ApiClusterTemplate, False,
params=dict(exportAutoConfig=export_auto_config), api_version=12)

def pools_refresh(self):
"""
Refresh Dynamic Pools configurations for relevant services..
@return: Reference to the submitted command.
@since: API v12
"""
return self._cmd('poolsRefresh')

def list_dfs_services(self, view=None):
"""
List available DFS (distributed file system) services in a cluster.
Expand Down
9 changes: 9 additions & 0 deletions python/src/cm_api_tests/test_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ def test_export_cluster_template(self):
retdata=ApiClusterTemplate(resource).to_json_dict())
cluster.export(export_auto_config=True)

def test_pools_refresh(self):
resource = utils.MockResource(self)
cluster = ApiCluster(resource, name="foo")

resource.expect("POST", "/clusters/foo/commands/poolsRefresh",
data=None,
retdata={ 'name' : 'foo'})
cluster.pools_refresh()

def test_list_dfs_services(self):
resource = utils.MockResource(self)
cluster = ApiCluster(resource, name="foo")
Expand Down

0 comments on commit c385539

Please sign in to comment.