From 5ac66619611ab76aa2505875f61f9c903674a237 Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Mon, 27 Jun 2016 19:48:46 +0800 Subject: [PATCH] Use osc_lib instead of cliff Base classes of commands are defined in cliff, but have been encapsulated again in osc-lib for all plugin clients. So use osc-lib instead of cliff. Change-Id: I4697a79ba19934e05564b85a2e71eb3546b28377 --- requirements.txt | 1 - saharaclient/osc/v1/cluster_templates.py | 12 +++++------- saharaclient/osc/v1/clusters.py | 16 +++++++--------- saharaclient/osc/v1/data_sources.py | 12 +++++------- saharaclient/osc/v1/images.py | 16 +++++++--------- saharaclient/osc/v1/job_binaries.py | 12 +++++------- saharaclient/osc/v1/job_templates.py | 12 +++++------- saharaclient/osc/v1/job_types.py | 5 ++--- saharaclient/osc/v1/jobs.py | 12 +++++------- saharaclient/osc/v1/node_group_templates.py | 12 +++++------- saharaclient/osc/v1/plugins.py | 8 +++----- 11 files changed, 49 insertions(+), 69 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6c48f54..a6dbaac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ pbr>=1.6 # Apache-2.0 Babel>=2.3.4 # BSD -cliff!=1.16.0,!=1.17.0,>=1.15.0 # Apache-2.0 keystoneauth1>=2.7.0 # Apache-2.0 osc-lib>=0.1.0 # Apache-2.0 oslo.log>=1.14.0 # Apache-2.0 diff --git a/saharaclient/osc/v1/cluster_templates.py b/saharaclient/osc/v1/cluster_templates.py index e706f8c..52c53b8 100644 --- a/saharaclient/osc/v1/cluster_templates.py +++ b/saharaclient/osc/v1/cluster_templates.py @@ -16,9 +16,7 @@ import json import sys -from cliff import command -from cliff import lister -from cliff import show +from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils as osc_utils from oslo_log import log as logging @@ -63,7 +61,7 @@ def _configure_node_groups(node_groups, client): return plugin, plugin_version, node_groups -class CreateClusterTemplate(show.ShowOne): +class CreateClusterTemplate(command.ShowOne): """Creates cluster template""" log = logging.getLogger(__name__ + ".CreateClusterTemplate") @@ -202,7 +200,7 @@ class CreateClusterTemplate(show.ShowOne): return self.dict2columns(data) -class ListClusterTemplates(lister.Lister): +class ListClusterTemplates(command.Lister): """Lists cluster templates""" log = logging.getLogger(__name__ + ".ListClusterTemplates") @@ -274,7 +272,7 @@ class ListClusterTemplates(lister.Lister): ) -class ShowClusterTemplate(show.ShowOne): +class ShowClusterTemplate(command.ShowOne): """Display cluster template details""" log = logging.getLogger(__name__ + ".ShowClusterTemplate") @@ -329,7 +327,7 @@ class DeleteClusterTemplate(command.Command): 'successfully.\n'.format(ct=ct)) -class UpdateClusterTemplate(show.ShowOne): +class UpdateClusterTemplate(command.ShowOne): """Updates cluster template""" log = logging.getLogger(__name__ + ".UpdateClusterTemplate") diff --git a/saharaclient/osc/v1/clusters.py b/saharaclient/osc/v1/clusters.py index 7f44693..50fc507 100644 --- a/saharaclient/osc/v1/clusters.py +++ b/saharaclient/osc/v1/clusters.py @@ -16,9 +16,7 @@ import json import sys -from cliff import command -from cliff import lister -from cliff import show +from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils as osc_utils from oslo_log import log as logging @@ -61,7 +59,7 @@ def _get_plugin_version(cluster_template, client): return ct.plugin_name, ct.hadoop_version, ct.id -class CreateCluster(show.ShowOne): +class CreateCluster(command.ShowOne): """Creates cluster""" log = logging.getLogger(__name__ + ".CreateCluster") @@ -225,7 +223,7 @@ class CreateCluster(show.ShowOne): return self.dict2columns(data) -class ListClusters(lister.Lister): +class ListClusters(command.Lister): """Lists clusters""" log = logging.getLogger(__name__ + ".ListClusters") @@ -294,7 +292,7 @@ class ListClusters(lister.Lister): ) -class ShowCluster(show.ShowOne): +class ShowCluster(command.ShowOne): """Display cluster details""" log = logging.getLogger(__name__ + ".ShowCluster") @@ -378,7 +376,7 @@ class DeleteCluster(command.Command): 'successfully.\n'.format(cluster=cluster_arg)) -class UpdateCluster(show.ShowOne): +class UpdateCluster(command.ShowOne): """Updates cluster""" log = logging.getLogger(__name__ + ".UpdateCluster") @@ -470,7 +468,7 @@ class UpdateCluster(show.ShowOne): return self.dict2columns(data) -class ScaleCluster(show.ShowOne): +class ScaleCluster(command.ShowOne): """Scales cluster""" log = logging.getLogger(__name__ + ".ScaleCluster") @@ -570,7 +568,7 @@ class ScaleCluster(show.ShowOne): return self.dict2columns(data) -class VerificationUpdateCluster(show.ShowOne): +class VerificationUpdateCluster(command.ShowOne): """Updates cluster verifications""" log = logging.getLogger(__name__ + ".VerificationUpdateCluster") diff --git a/saharaclient/osc/v1/data_sources.py b/saharaclient/osc/v1/data_sources.py index b6961f3..060f779 100644 --- a/saharaclient/osc/v1/data_sources.py +++ b/saharaclient/osc/v1/data_sources.py @@ -15,9 +15,7 @@ import sys -from cliff import command -from cliff import lister -from cliff import show +from osc_lib.command import command from osc_lib import utils as osc_utils from oslo_log import log as logging @@ -28,7 +26,7 @@ DATA_SOURCE_FIELDS = ['name', 'id', 'type', 'url', 'description', 'is_public', DATA_SOURCE_CHOICES = ["swift", "hdfs", "maprfs", "manila"] -class CreateDataSource(show.ShowOne): +class CreateDataSource(command.ShowOne): """Creates data source""" log = logging.getLogger(__name__ + ".CreateDataSource") @@ -102,7 +100,7 @@ class CreateDataSource(show.ShowOne): return self.dict2columns(data) -class ListDataSources(lister.Lister): +class ListDataSources(command.Lister): """Lists data sources""" log = logging.getLogger(__name__ + ".ListDataSources") @@ -149,7 +147,7 @@ class ListDataSources(lister.Lister): ) -class ShowDataSource(show.ShowOne): +class ShowDataSource(command.ShowOne): """Display data source details""" log = logging.getLogger(__name__ + ".ShowDataSource") @@ -203,7 +201,7 @@ class DeleteDataSource(command.Command): 'successfully.\n'.format(ds=ds)) -class UpdateDataSource(show.ShowOne): +class UpdateDataSource(command.ShowOne): """Update data source""" log = logging.getLogger(__name__ + ".UpdateDataSource") diff --git a/saharaclient/osc/v1/images.py b/saharaclient/osc/v1/images.py index 280230e..dd5273c 100644 --- a/saharaclient/osc/v1/images.py +++ b/saharaclient/osc/v1/images.py @@ -15,9 +15,7 @@ import sys -from cliff import command -from cliff import lister -from cliff import show +from osc_lib.command import command from osc_lib import utils as osc_utils from oslo_log import log as logging @@ -26,7 +24,7 @@ from saharaclient.osc.v1 import utils IMAGE_FIELDS = ['name', 'id', 'username', 'tags', 'status', 'description'] -class ListImages(lister.Lister): +class ListImages(command.Lister): """Lists registered images""" log = logging.getLogger(__name__ + ".ListImages") @@ -91,7 +89,7 @@ class ListImages(lister.Lister): ) -class ShowImage(show.ShowOne): +class ShowImage(command.ShowOne): """Display image details""" log = logging.getLogger(__name__ + ".ShowImage") @@ -119,7 +117,7 @@ class ShowImage(show.ShowOne): return self.dict2columns(data) -class RegisterImage(show.ShowOne): +class RegisterImage(command.ShowOne): """Register an image""" log = logging.getLogger(__name__ + ".RegisterImage") @@ -192,7 +190,7 @@ class UnregisterImage(command.Command): 'successfully.\n'.format(image=image)) -class SetImageTags(show.ShowOne): +class SetImageTags(command.ShowOne): """Set image tags (Replace current image tags with provided ones)""" log = logging.getLogger(__name__ + ".AddImageTags") @@ -227,7 +225,7 @@ class SetImageTags(show.ShowOne): return self.dict2columns(data) -class AddImageTags(show.ShowOne): +class AddImageTags(command.ShowOne): """Add image tags""" log = logging.getLogger(__name__ + ".AddImageTags") @@ -264,7 +262,7 @@ class AddImageTags(show.ShowOne): return self.dict2columns(data) -class RemoveImageTags(show.ShowOne): +class RemoveImageTags(command.ShowOne): """Remove image tags""" log = logging.getLogger(__name__ + ".RemoveImageTags") diff --git a/saharaclient/osc/v1/job_binaries.py b/saharaclient/osc/v1/job_binaries.py index e369ded..1bbb2e5 100644 --- a/saharaclient/osc/v1/job_binaries.py +++ b/saharaclient/osc/v1/job_binaries.py @@ -16,9 +16,7 @@ from os import path import sys -from cliff import command -from cliff import lister -from cliff import show +from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils as osc_utils from oslo_log import log as logging @@ -31,7 +29,7 @@ JOB_BINARY_FIELDS = ['name', 'id', 'url', 'description', 'is_public', 'is_protected'] -class CreateJobBinary(show.ShowOne): +class CreateJobBinary(command.ShowOne): """Creates job binary""" log = logging.getLogger(__name__ + ".CreateJobBinary") @@ -152,7 +150,7 @@ class CreateJobBinary(show.ShowOne): return self.dict2columns(data) -class ListJobBinaries(lister.Lister): +class ListJobBinaries(command.Lister): """Lists job binaries""" log = logging.getLogger(__name__ + ".ListJobBinaries") @@ -201,7 +199,7 @@ class ListJobBinaries(lister.Lister): ) -class ShowJobBinary(show.ShowOne): +class ShowJobBinary(command.ShowOne): """Display job binary details""" log = logging.getLogger(__name__ + ".ShowJobBinary") @@ -264,7 +262,7 @@ class DeleteJobBinary(command.Command): 'successfully.\n'.format(jb=jb)) -class UpdateJobBinary(show.ShowOne): +class UpdateJobBinary(command.ShowOne): """Updates job binary""" log = logging.getLogger(__name__ + ".UpdateJobBinary") diff --git a/saharaclient/osc/v1/job_templates.py b/saharaclient/osc/v1/job_templates.py index 1d8ec9f..0632e43 100644 --- a/saharaclient/osc/v1/job_templates.py +++ b/saharaclient/osc/v1/job_templates.py @@ -15,9 +15,7 @@ import sys -from cliff import command -from cliff import lister -from cliff import show +from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils as osc_utils from oslo_log import log as logging @@ -39,7 +37,7 @@ def _format_job_template_output(data): ['%s:%s' % (l['name'], l['id']) for l in data['libs']]) -class CreateJobTemplate(show.ShowOne): +class CreateJobTemplate(command.ShowOne): """Creates job template""" log = logging.getLogger(__name__ + ".CreateJobTemplate") @@ -141,7 +139,7 @@ class CreateJobTemplate(show.ShowOne): return self.dict2columns(data) -class ListJobTemplates(lister.Lister): +class ListJobTemplates(command.Lister): """Lists job templates""" log = logging.getLogger(__name__ + ".ListJobTemplates") @@ -197,7 +195,7 @@ class ListJobTemplates(lister.Lister): ) -class ShowJobTemplate(show.ShowOne): +class ShowJobTemplate(command.ShowOne): """Display job template details""" log = logging.getLogger(__name__ + ".ShowJobTemplate") @@ -252,7 +250,7 @@ class DeleteJobTemplate(command.Command): 'successfully.\n'.format(jt=jt)) -class UpdateJobTemplate(show.ShowOne): +class UpdateJobTemplate(command.ShowOne): """Updates job template""" log = logging.getLogger(__name__ + ".UpdateJobTemplate") diff --git a/saharaclient/osc/v1/job_types.py b/saharaclient/osc/v1/job_types.py index 15cd410..25513e4 100644 --- a/saharaclient/osc/v1/job_types.py +++ b/saharaclient/osc/v1/job_types.py @@ -16,8 +16,7 @@ from os import path import sys -from cliff import command -from cliff import lister +from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils as osc_utils from oslo_log import log as logging @@ -27,7 +26,7 @@ from saharaclient.osc.v1.job_templates import JOB_TYPES_CHOICES from saharaclient.osc.v1 import utils -class ListJobTypes(lister.Lister): +class ListJobTypes(command.Lister): """Lists job types supported by plugins""" log = logging.getLogger(__name__ + ".ListJobTypes") diff --git a/saharaclient/osc/v1/jobs.py b/saharaclient/osc/v1/jobs.py index 73b89bb..0301cc9 100644 --- a/saharaclient/osc/v1/jobs.py +++ b/saharaclient/osc/v1/jobs.py @@ -15,9 +15,7 @@ import sys -from cliff import command -from cliff import lister -from cliff import show +from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils as osc_utils from oslo_log import log as logging @@ -39,7 +37,7 @@ def _format_job_output(data): data['job_template_id'] = data.pop('job_id') -class ExecuteJob(show.ShowOne): +class ExecuteJob(command.ShowOne): """Executes job""" log = logging.getLogger(__name__ + ".ExecuteJob") @@ -198,7 +196,7 @@ class ExecuteJob(show.ShowOne): return self.dict2columns(data) -class ListJobs(lister.Lister): +class ListJobs(command.Lister): """Lists jobs""" log = logging.getLogger(__name__ + ".ListJobs") @@ -251,7 +249,7 @@ class ListJobs(lister.Lister): ) -class ShowJob(show.ShowOne): +class ShowJob(command.ShowOne): """Display job details""" log = logging.getLogger(__name__ + ".ShowJob") @@ -320,7 +318,7 @@ class DeleteJob(command.Command): job=job_id)) -class UpdateJob(show.ShowOne): +class UpdateJob(command.ShowOne): """Updates job""" log = logging.getLogger(__name__ + ".UpdateJob") diff --git a/saharaclient/osc/v1/node_group_templates.py b/saharaclient/osc/v1/node_group_templates.py index 400b3ec..945b33a 100644 --- a/saharaclient/osc/v1/node_group_templates.py +++ b/saharaclient/osc/v1/node_group_templates.py @@ -16,9 +16,7 @@ import json import sys -from cliff import command -from cliff import lister -from cliff import show +from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils as osc_utils from oslo_log import log as logging @@ -45,7 +43,7 @@ def _format_ngt_output(data): del data['volumes_size'] -class CreateNodeGroupTemplate(show.ShowOne): +class CreateNodeGroupTemplate(command.ShowOne): """Creates node group template""" log = logging.getLogger(__name__ + ".CreateNodeGroupTemplate") @@ -276,7 +274,7 @@ class CreateNodeGroupTemplate(show.ShowOne): return self.dict2columns(data) -class ListNodeGroupTemplates(lister.Lister): +class ListNodeGroupTemplates(command.Lister): """Lists node group templates""" log = logging.getLogger(__name__ + ".ListNodeGroupTemplates") @@ -348,7 +346,7 @@ class ListNodeGroupTemplates(lister.Lister): ) -class ShowNodeGroupTemplate(show.ShowOne): +class ShowNodeGroupTemplate(command.ShowOne): """Display node group template details""" log = logging.getLogger(__name__ + ".ShowNodeGroupTemplate") @@ -406,7 +404,7 @@ class DeleteNodeGroupTemplate(command.Command): 'successfully.\n'.format(ngt=ngt)) -class UpdateNodeGroupTemplate(show.ShowOne): +class UpdateNodeGroupTemplate(command.ShowOne): """Updates node group template""" log = logging.getLogger(__name__ + ".UpdateNodeGroupTemplate") diff --git a/saharaclient/osc/v1/plugins.py b/saharaclient/osc/v1/plugins.py index 71dfc39..7a9779f 100644 --- a/saharaclient/osc/v1/plugins.py +++ b/saharaclient/osc/v1/plugins.py @@ -16,9 +16,7 @@ from os import path import sys -from cliff import command -from cliff import lister -from cliff import show +from osc_lib.command import command from osc_lib import utils as osc_utils from oslo_log import log as logging from oslo_serialization import jsonutils @@ -26,7 +24,7 @@ from oslo_serialization import jsonutils from saharaclient.osc.v1 import utils -class ListPlugins(lister.Lister): +class ListPlugins(command.Lister): """Lists plugins""" log = logging.getLogger(__name__ + ".ListPlugins") @@ -67,7 +65,7 @@ class ListPlugins(lister.Lister): ) -class ShowPlugin(show.ShowOne): +class ShowPlugin(command.ShowOne): """Display plugin details""" log = logging.getLogger(__name__ + ".ShowPlugin")