diff options
-rw-r--r-- | saharaclient/osc/v1/cluster_templates.py | 8 | ||||
-rw-r--r-- | saharaclient/osc/v1/clusters.py | 6 | ||||
-rw-r--r-- | saharaclient/osc/v1/job_templates.py | 7 | ||||
-rw-r--r-- | saharaclient/osc/v1/jobs.py | 9 | ||||
-rw-r--r-- | saharaclient/osc/v1/node_group_templates.py | 8 | ||||
-rw-r--r-- | saharaclient/tests/unit/osc/v1/test_cluster_templates.py | 14 | ||||
-rw-r--r-- | saharaclient/tests/unit/osc/v1/test_clusters.py | 9 | ||||
-rw-r--r-- | saharaclient/tests/unit/osc/v1/test_job_templates.py | 7 | ||||
-rw-r--r-- | saharaclient/tests/unit/osc/v1/test_jobs.py | 3 | ||||
-rw-r--r-- | saharaclient/tests/unit/osc/v1/test_node_group_templates.py | 23 |
10 files changed, 35 insertions, 59 deletions
diff --git a/saharaclient/osc/v1/cluster_templates.py b/saharaclient/osc/v1/cluster_templates.py index aa053a6..440098f 100644 --- a/saharaclient/osc/v1/cluster_templates.py +++ b/saharaclient/osc/v1/cluster_templates.py @@ -473,8 +473,7 @@ class UpdateClusterTemplate(show.ShowOne): 'An error occurred when reading ' 'shares from file %s: %s' % (parsed_args.shares, e)) - data = client.cluster_templates.update( - ct_id, + update_dict = utils.create_dict_from_kwargs( name=parsed_args.name, plugin_name=plugin, hadoop_version=version, @@ -485,7 +484,10 @@ class UpdateClusterTemplate(show.ShowOne): shares=shares, is_public=parsed_args.is_public, is_protected=parsed_args.is_protected - ).to_dict() + ) + + data = client.cluster_templates.update( + ct_id, **update_dict).to_dict() _format_ct_output(data) data = utils.prepare_data(data, CT_FIELDS) diff --git a/saharaclient/osc/v1/clusters.py b/saharaclient/osc/v1/clusters.py index 1602e14..d61135b 100644 --- a/saharaclient/osc/v1/clusters.py +++ b/saharaclient/osc/v1/clusters.py @@ -455,14 +455,14 @@ class UpdateCluster(show.ShowOne): 'An error occurred when reading ' 'shares from file %s: %s' % (parsed_args.shares, e)) - data = client.clusters.update( - cluster_id, + update_dict = utils.create_dict_from_kwargs( name=parsed_args.name, description=parsed_args.description, is_public=parsed_args.is_public, is_protected=parsed_args.is_protected, shares=shares - ).cluster + ) + data = client.clusters.update(cluster_id, **update_dict).cluster _format_cluster_output(data) data = utils.prepare_data(data, CLUSTER_FIELDS) diff --git a/saharaclient/osc/v1/job_templates.py b/saharaclient/osc/v1/job_templates.py index ce8d77e..952666f 100644 --- a/saharaclient/osc/v1/job_templates.py +++ b/saharaclient/osc/v1/job_templates.py @@ -314,13 +314,14 @@ class UpdateJobTemplate(show.ShowOne): jt_id = utils.get_resource_id( client.jobs, parsed_args.job_template) - data = client.jobs.update( - jt_id, + update_data = utils.create_dict_from_kwargs( name=parsed_args.name, description=parsed_args.description, is_public=parsed_args.is_public, is_protected=parsed_args.is_protected - ).job + ) + + data = client.jobs.update(jt_id, **update_data).job _format_job_template_output(data) data = utils.prepare_data(data, JOB_TEMPLATE_FIELDS) diff --git a/saharaclient/osc/v1/jobs.py b/saharaclient/osc/v1/jobs.py index a232c1f..576c7ff 100644 --- a/saharaclient/osc/v1/jobs.py +++ b/saharaclient/osc/v1/jobs.py @@ -368,11 +368,12 @@ class UpdateJob(show.ShowOne): self.log.debug("take_action(%s)" % parsed_args) client = self.app.client_manager.data_processing - data = client.job_executions.update( - parsed_args.job, + update_dict = utils.create_dict_from_kwargs( is_public=parsed_args.is_public, - is_protected=parsed_args.is_protected - ).job_execution + is_protected=parsed_args.is_protected) + + data = client.job_executions.update( + parsed_args.job, **update_dict).job_execution _format_job_output(data) data = utils.prepare_data(data, JOB_FIELDS) diff --git a/saharaclient/osc/v1/node_group_templates.py b/saharaclient/osc/v1/node_group_templates.py index c86c76d..a24253d 100644 --- a/saharaclient/osc/v1/node_group_templates.py +++ b/saharaclient/osc/v1/node_group_templates.py @@ -660,8 +660,7 @@ class UpdateNodeGroupTemplate(show.ShowOne): flavor_id = osc_utils.find_resource( compute_client.flavors, parsed_args.flavor).id - data = client.node_group_templates.update( - ngt_id, + update_dict = utils.create_dict_from_kwargs( name=parsed_args.name, plugin_name=parsed_args.plugin, hadoop_version=parsed_args.version, @@ -683,7 +682,10 @@ class UpdateNodeGroupTemplate(show.ShowOne): node_configs=configs, shares=shares, volumes_availability_zone=parsed_args.volumes_availability_zone - ).to_dict() + ) + + data = client.node_group_templates.update( + ngt_id, **update_dict).to_dict() _format_ngt_output(data) data = utils.prepare_data(data, NGT_FIELDS) diff --git a/saharaclient/tests/unit/osc/v1/test_cluster_templates.py b/saharaclient/tests/unit/osc/v1/test_cluster_templates.py index 1580dce..d98e89b 100644 --- a/saharaclient/tests/unit/osc/v1/test_cluster_templates.py +++ b/saharaclient/tests/unit/osc/v1/test_cluster_templates.py @@ -273,10 +273,7 @@ class TestUpdateClusterTemplate(TestClusterTemplates): self.cmd.take_action(parsed_args) self.ct_mock.update.assert_called_once_with( - '0647061f-ab98-4c89-84e0-30738ea55750', cluster_configs=None, - description=None, hadoop_version=None, is_protected=None, - is_public=None, name=None, node_groups=None, plugin_name=None, - shares=None, use_autoconfig=None) + '0647061f-ab98-4c89-84e0-30738ea55750') def test_ct_update_all_options(self): arglist = ['template', '--name', 'template', '--node-groups', @@ -302,8 +299,7 @@ class TestUpdateClusterTemplate(TestClusterTemplates): {'count': 2, 'name': 'fakeng', 'node_group_template_id': 'd29631fc-0fad-434b-80aa-7a3e9526f57c'}], - plugin_name='fake', use_autoconfig=True, shares=None, - cluster_configs=None) + plugin_name='fake', use_autoconfig=True) # Check that columns are correct expected_columns = ('Anti affinity', 'Description', 'Id', 'Is default', @@ -327,7 +323,5 @@ class TestUpdateClusterTemplate(TestClusterTemplates): self.cmd.take_action(parsed_args) self.ct_mock.update.assert_called_once_with( - '0647061f-ab98-4c89-84e0-30738ea55750', cluster_configs=None, - description=None, hadoop_version=None, is_protected=False, - is_public=False, name=None, node_groups=None, plugin_name=None, - shares=None, use_autoconfig=None) + '0647061f-ab98-4c89-84e0-30738ea55750', is_protected=False, + is_public=False) diff --git a/saharaclient/tests/unit/osc/v1/test_clusters.py b/saharaclient/tests/unit/osc/v1/test_clusters.py index ba48993..1bc0dd3 100644 --- a/saharaclient/tests/unit/osc/v1/test_clusters.py +++ b/saharaclient/tests/unit/osc/v1/test_clusters.py @@ -376,9 +376,7 @@ class TestUpdateCluster(TestClusters): self.cmd.take_action(parsed_args) # Check that correct arguments were passed - self.cl_mock.update.assert_called_once_with( - 'cluster_id', description=None, is_protected=None, is_public=None, - name=None, shares=None) + self.cl_mock.update.assert_called_once_with('cluster_id') def test_cluster_update_all_options(self): arglist = ['fake', '--name', 'fake', '--description', 'descr', @@ -395,7 +393,7 @@ class TestUpdateCluster(TestClusters): # Check that correct arguments were passed self.cl_mock.update.assert_called_once_with( 'cluster_id', description='descr', is_protected=True, - is_public=True, name='fake', shares=None) + is_public=True, name='fake') # Check that columns are correct expected_columns = ('Anti affinity', 'Cluster template id', @@ -425,8 +423,7 @@ class TestUpdateCluster(TestClusters): # Check that correct arguments were passed self.cl_mock.update.assert_called_once_with( - 'cluster_id', description=None, is_protected=False, - is_public=False, name=None, shares=None) + 'cluster_id', is_protected=False, is_public=False) class TestScaleCluster(TestClusters): diff --git a/saharaclient/tests/unit/osc/v1/test_job_templates.py b/saharaclient/tests/unit/osc/v1/test_job_templates.py index 69f83cb..dc6bb23 100644 --- a/saharaclient/tests/unit/osc/v1/test_job_templates.py +++ b/saharaclient/tests/unit/osc/v1/test_job_templates.py @@ -246,9 +246,7 @@ class TestUpdateJobTemplate(TestJobTemplates): self.cmd.take_action(parsed_args) # Check that correct arguments were passed - self.job_mock.update.assert_called_once_with( - 'job_id', description=None, is_protected=None, is_public=None, - name=None) + self.job_mock.update.assert_called_once_with('job_id') def test_job_template_update_all_options(self): arglist = ['pig-job', '--name', 'pig-job', '--description', 'descr', @@ -289,5 +287,4 @@ class TestUpdateJobTemplate(TestJobTemplates): # Check that correct arguments were passed self.job_mock.update.assert_called_once_with( - 'job_id', description=None, is_protected=False, is_public=False, - name=None) + 'job_id', is_protected=False, is_public=False) diff --git a/saharaclient/tests/unit/osc/v1/test_jobs.py b/saharaclient/tests/unit/osc/v1/test_jobs.py index f907a8e..7a97737 100644 --- a/saharaclient/tests/unit/osc/v1/test_jobs.py +++ b/saharaclient/tests/unit/osc/v1/test_jobs.py @@ -278,8 +278,7 @@ class TestUpdateJob(TestJobs): self.cmd.take_action(parsed_args) # Check that correct arguments were passed - self.je_mock.update.assert_called_once_with( - 'job_id', is_protected=None, is_public=None) + self.je_mock.update.assert_called_once_with('job_id') def test_job_update_public_protected(self): arglist = ['job_id', '--public', '--protected'] diff --git a/saharaclient/tests/unit/osc/v1/test_node_group_templates.py b/saharaclient/tests/unit/osc/v1/test_node_group_templates.py index 8e91010..c67dcc0 100644 --- a/saharaclient/tests/unit/osc/v1/test_node_group_templates.py +++ b/saharaclient/tests/unit/osc/v1/test_node_group_templates.py @@ -320,16 +320,7 @@ class TestUpdateNodeGroupTemplate(TestNodeGroupTemplates): self.cmd.take_action(parsed_args) # Check that correct arguments were passed - self.ngt_mock.update.assert_called_once_with( - 'ng_id', auto_security_group=None, - availability_zone=None, description=None, flavor_id=None, - floating_ip_pool=None, hadoop_version=None, is_protected=None, - is_proxy_gateway=None, is_public=None, name=None, - node_configs=None, node_processes=None, plugin_name=None, - security_groups=None, shares=None, use_autoconfig=None, - volume_local_to_instance=None, volume_type=None, - volumes_availability_zone=None, volumes_per_node=None, - volumes_size=None) + self.ngt_mock.update.assert_called_once_with('ng_id') def test_ngt_update_all_options(self): arglist = ['template', '--name', 'template', '--plugin', 'fake', @@ -378,7 +369,7 @@ class TestUpdateNodeGroupTemplate(TestNodeGroupTemplates): plugin_name='fake', security_groups=['secgr'], use_autoconfig=True, volume_local_to_instance=True, volume_type='type', volumes_availability_zone='vavzone', volumes_per_node=2, - volumes_size=2, shares=None, node_configs=None) + volumes_size=2) # Check that columns are correct expected_columns = ( @@ -410,12 +401,4 @@ class TestUpdateNodeGroupTemplate(TestNodeGroupTemplates): # Check that correct arguments were passed self.ngt_mock.update.assert_called_once_with( - 'ng_id', auto_security_group=None, - availability_zone=None, description=None, flavor_id=None, - floating_ip_pool=None, hadoop_version=None, is_protected=False, - is_proxy_gateway=None, is_public=False, name=None, - node_configs=None, node_processes=None, plugin_name=None, - security_groups=None, shares=None, use_autoconfig=None, - volume_local_to_instance=None, volume_type=None, - volumes_availability_zone=None, volumes_per_node=None, - volumes_size=None) + 'ng_id', is_protected=False, is_public=False) |