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: I0e430457af3033ebf56e47f85c0cfd71d2227cf7
This commit is contained in:
Tang Chen
2016-06-29 16:15:03 +08:00
parent f1c9930436
commit bfde2f8e09
12 changed files with 36 additions and 47 deletions

View File

@@ -12,12 +12,12 @@
# #
# Copyright 2015 IBM Corp. # Copyright 2015 IBM Corp.
from cliff import show from osc_lib.command import command
import six import six
import sys import sys
class RawFormat(show.ShowOne): class RawFormat(command.ShowOne):
def produce_output(self, parsed_args, column_names, data): def produce_output(self, parsed_args, column_names, data):
if data is None: if data is None:

View File

@@ -16,13 +16,13 @@
import logging import logging
import six import six
from cliff import show from osc_lib.command import command
from osc_lib import utils from osc_lib import utils
from heatclient.common import utils as heat_utils from heatclient.common import utils as heat_utils
class BuildInfo(show.ShowOne): class BuildInfo(command.ShowOne):
"""Retrieve build information.""" """Retrieve build information."""
log = logging.getLogger(__name__ + ".BuildInfo") log = logging.getLogger(__name__ + ".BuildInfo")

View File

@@ -16,8 +16,7 @@ import logging
import time import time
from cliff.formatters import base from cliff.formatters import base
from cliff import lister from osc_lib.command import command
from cliff import show
from osc_lib import utils from osc_lib import utils
from heatclient.common import event_utils from heatclient.common import event_utils
@@ -26,7 +25,7 @@ from heatclient import exc
from heatclient.openstack.common._i18n import _ from heatclient.openstack.common._i18n import _
class ShowEvent(show.ShowOne): class ShowEvent(command.ShowOne):
"""Show event details.""" """Show event details."""
log = logging.getLogger(__name__ + '.ShowEvent') log = logging.getLogger(__name__ + '.ShowEvent')
@@ -82,7 +81,7 @@ class ShowEvent(show.ShowOne):
formatters=formatters) formatters=formatters)
class ListEvent(lister.Lister): class ListEvent(command.Lister):
"""List events.""" """List events."""
log = logging.getLogger(__name__ + '.ListEvent') log = logging.getLogger(__name__ + '.ListEvent')

View File

@@ -13,13 +13,11 @@
"""Orchestration v1 Stack action implementations""" """Orchestration v1 Stack action implementations"""
from cliff import command
import logging import logging
import six import six
from six.moves.urllib import request from six.moves.urllib import request
from cliff import lister from osc_lib.command import command
from cliff import show
from osc_lib import exceptions as exc from osc_lib import exceptions as exc
from osc_lib.i18n import _ from osc_lib.i18n import _
from osc_lib import utils from osc_lib import utils
@@ -30,7 +28,7 @@ from heatclient.common import utils as heat_utils
from heatclient import exc as heat_exc from heatclient import exc as heat_exc
class ResourceShow(show.ShowOne): class ResourceShow(command.ShowOne):
"""Display stack resource.""" """Display stack resource."""
log = logging.getLogger(__name__ + '.ResourceShowStack') log = logging.getLogger(__name__ + '.ResourceShowStack')
@@ -73,7 +71,7 @@ class ResourceShow(show.ShowOne):
return self.dict2columns(resource.to_dict()) return self.dict2columns(resource.to_dict())
class ResourceList(lister.Lister): class ResourceList(command.Lister):
"""List stack resources.""" """List stack resources."""
log = logging.getLogger(__name__ + '.ResourceListStack') log = logging.getLogger(__name__ + '.ResourceListStack')

View File

@@ -16,10 +16,10 @@
import logging import logging
import six import six
from cliff import lister
from heatclient.common import format_utils from heatclient.common import format_utils
from heatclient.common import utils as heat_utils from heatclient.common import utils as heat_utils
from heatclient import exc as heat_exc from heatclient import exc as heat_exc
from osc_lib.command import command
from osc_lib import exceptions as exc from osc_lib import exceptions as exc
from osc_lib.i18n import _ from osc_lib.i18n import _
@@ -84,7 +84,7 @@ def _show_resourcetype(heat_client, parsed_args):
return columns, rows return columns, rows
class ResourceTypeList(lister.Lister): class ResourceTypeList(command.Lister):
"""List resource types.""" """List resource types."""
log = logging.getLogger(__name__ + '.ResourceTypeList') log = logging.getLogger(__name__ + '.ResourceTypeList')

View File

@@ -15,11 +15,11 @@
import logging import logging
from cliff import lister from osc_lib.command import command
from osc_lib import utils from osc_lib import utils
class ListService(lister.Lister): class ListService(command.Lister):
"""List the Heat engines.""" """List the Heat engines."""
log = logging.getLogger(__name__ + ".ListService") log = logging.getLogger(__name__ + ".ListService")

View File

@@ -16,9 +16,7 @@
import logging import logging
import six import six
from cliff import command from osc_lib.command import command
from cliff import lister
from cliff import show
from osc_lib import exceptions as exc from osc_lib import exceptions as exc
from osc_lib.i18n import _ from osc_lib.i18n import _
from osc_lib import utils from osc_lib import utils
@@ -27,7 +25,7 @@ from heatclient.common import format_utils
from heatclient import exc as heat_exc from heatclient import exc as heat_exc
class ListSnapshot(lister.Lister): class ListSnapshot(command.Lister):
"""List stack snapshots.""" """List stack snapshots."""
log = logging.getLogger(__name__ + ".ListSnapshot") log = logging.getLogger(__name__ + ".ListSnapshot")
@@ -137,7 +135,7 @@ class RestoreSnapshot(command.Command):
'snapshot': parsed_args.snapshot}) 'snapshot': parsed_args.snapshot})
class CreateSnapshot(show.ShowOne): class CreateSnapshot(command.ShowOne):
"""Create stack snapshot.""" """Create stack snapshot."""
log = logging.getLogger(__name__ + ".CreateSnapshot") log = logging.getLogger(__name__ + ".CreateSnapshot")

View File

@@ -19,8 +19,7 @@ import six
from six.moves.urllib import request from six.moves.urllib import request
import yaml import yaml
from cliff import command from osc_lib.command import command
from cliff import lister
from osc_lib import exceptions as exc from osc_lib import exceptions as exc
from osc_lib import utils from osc_lib import utils
@@ -73,7 +72,7 @@ def _delete_config(heat_client, args):
'total': len(args.config)}) 'total': len(args.config)})
class ListConfig(lister.Lister): class ListConfig(command.Lister):
"""List software configs""" """List software configs"""
log = logging.getLogger(__name__ + ".ListConfig") log = logging.getLogger(__name__ + ".ListConfig")

View File

@@ -16,10 +16,7 @@
import logging import logging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from cliff import command from osc_lib.command import command
from cliff import lister
from cliff import show
from osc_lib import exceptions as exc from osc_lib import exceptions as exc
from osc_lib import utils from osc_lib import utils
@@ -182,7 +179,7 @@ class DeleteDeployment(command.Command):
'total': len(parsed_args.deployment)}) 'total': len(parsed_args.deployment)})
class ListDeployment(lister.Lister): class ListDeployment(command.Lister):
"""List software deployments.""" """List software deployments."""
log = logging.getLogger(__name__ + '.ListDeployment') log = logging.getLogger(__name__ + '.ListDeployment')
@@ -222,7 +219,7 @@ def _list_deployment(heat_client, args=None):
) )
class ShowDeployment(show.ShowOne): class ShowDeployment(command.ShowOne):
"""Show SoftwareDeployment Details.""" """Show SoftwareDeployment Details."""
log = logging.getLogger(__name__ + ".ShowSoftwareDeployment") log = logging.getLogger(__name__ + ".ShowSoftwareDeployment")

View File

@@ -16,10 +16,8 @@
import logging import logging
import sys import sys
from cliff import command
from cliff import lister
from cliff import show
from osc_lib.cli import parseractions from osc_lib.cli import parseractions
from osc_lib.command import command
from osc_lib import exceptions as exc from osc_lib import exceptions as exc
from osc_lib import utils from osc_lib import utils
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
@@ -37,7 +35,7 @@ from heatclient.openstack.common._i18n import _
from heatclient.openstack.common._i18n import _LI from heatclient.openstack.common._i18n import _LI
class CreateStack(show.ShowOne): class CreateStack(command.ShowOne):
"""Create a stack.""" """Create a stack."""
log = logging.getLogger(__name__ + '.CreateStack') log = logging.getLogger(__name__ + '.CreateStack')
@@ -188,7 +186,7 @@ class CreateStack(show.ShowOne):
return _show_stack(client, stack['id'], format='table', short=True) return _show_stack(client, stack['id'], format='table', short=True)
class UpdateStack(show.ShowOne): class UpdateStack(command.ShowOne):
"""Update a stack.""" """Update a stack."""
log = logging.getLogger(__name__ + '.UpdateStack') log = logging.getLogger(__name__ + '.UpdateStack')
@@ -359,7 +357,7 @@ class UpdateStack(show.ShowOne):
short=True) short=True)
class ShowStack(show.ShowOne): class ShowStack(command.ShowOne):
"""Show stack details.""" """Show stack details."""
log = logging.getLogger(__name__ + ".ShowStack") log = logging.getLogger(__name__ + ".ShowStack")
@@ -427,7 +425,7 @@ def _show_stack(heat_client, stack_id, format='', short=False):
formatters=formatters) formatters=formatters)
class ListStack(lister.Lister): class ListStack(command.Lister):
"""List stacks.""" """List stacks."""
log = logging.getLogger(__name__ + '.ListStack') log = logging.getLogger(__name__ + '.ListStack')
@@ -696,7 +694,7 @@ class DeleteStack(command.Command):
raise exc.CommandError(msg) raise exc.CommandError(msg)
class AdoptStack(show.ShowOne): class AdoptStack(command.ShowOne):
"""Adopt a stack.""" """Adopt a stack."""
log = logging.getLogger(__name__ + '.AdoptStack') log = logging.getLogger(__name__ + '.AdoptStack')
@@ -823,7 +821,7 @@ class AbandonStack(format_utils.JsonFormat):
return columns, data return columns, data
class OutputShowStack(show.ShowOne): class OutputShowStack(command.ShowOne):
"""Show stack output.""" """Show stack output."""
log = logging.getLogger(__name__ + '.OutputShowStack') log = logging.getLogger(__name__ + '.OutputShowStack')
@@ -908,7 +906,7 @@ class OutputShowStack(show.ShowOne):
return self.dict2columns(output) return self.dict2columns(output)
class OutputListStack(lister.Lister): class OutputListStack(command.Lister):
"""List stack outputs.""" """List stack outputs."""
log = logging.getLogger(__name__ + '.OutputListStack') log = logging.getLogger(__name__ + '.OutputListStack')
@@ -973,7 +971,7 @@ class TemplateShowStack(format_utils.YamlFormat):
return self.dict2columns(template) return self.dict2columns(template)
class StackActionBase(lister.Lister): class StackActionBase(command.Lister):
"""Stack actions base.""" """Stack actions base."""
log = logging.getLogger(__name__ + '.StackActionBase') log = logging.getLogger(__name__ + '.StackActionBase')
@@ -1161,7 +1159,7 @@ class CancelStack(StackActionBase):
return (columns, rows) return (columns, rows)
class StackHookPoll(lister.Lister): class StackHookPoll(command.Lister):
'''List resources with pending hook for a stack.''' '''List resources with pending hook for a stack.'''
log = logging.getLogger(__name__ + '.StackHookPoll') log = logging.getLogger(__name__ + '.StackHookPoll')

View File

@@ -14,7 +14,7 @@
import collections import collections
from cliff import command from osc_lib.command import command
from heatclient.common import format_utils from heatclient.common import format_utils
from heatclient import exc from heatclient import exc

View File

@@ -16,7 +16,7 @@ import logging
import six import six
from cliff import lister from osc_lib.command import command
from osc_lib import utils from osc_lib import utils
from heatclient.common import format_utils from heatclient.common import format_utils
@@ -27,7 +27,7 @@ from heatclient import exc
from heatclient.openstack.common._i18n import _ from heatclient.openstack.common._i18n import _
class VersionList(lister.Lister): class VersionList(command.Lister):
"""List the available template versions.""" """List the available template versions."""
log = logging.getLogger(__name__ + '.VersionList') log = logging.getLogger(__name__ + '.VersionList')
@@ -46,7 +46,7 @@ class VersionList(lister.Lister):
) )
class FunctionList(lister.Lister): class FunctionList(command.Lister):
"""List the available functions.""" """List the available functions."""
log = logging.getLogger(__name__ + '.FunctionList') log = logging.getLogger(__name__ + '.FunctionList')