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: I7b64c4dbedf270720f222471d57b9e20ab5a046c
This commit is contained in:
Tang Chen 2016-06-27 20:14:37 +08:00
parent 9891067bb0
commit 4437ed83be
13 changed files with 42 additions and 57 deletions

View File

@ -4,7 +4,6 @@
Babel>=2.3.4 # BSD
pbr>=1.6 # Apache-2.0
cliff!=1.16.0,!=1.17.0,>=1.15.0 # Apache-2.0
PrettyTable<0.8,>=0.7 # BSD
openstacksdk>=0.8.6 # Apache-2.0
osc-lib>=0.1.0 # Apache-2.0

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from cliff import show
from osc_lib.command import command
class RawFormat(show.ShowOne):
class RawFormat(command.ShowOne):
def produce_output(self, parsed_args, column_names, data):
if data is None:

View File

@ -15,9 +15,8 @@
import logging
import six
from cliff import lister
from cliff import show
from openstack import exceptions as sdk_exc
from osc_lib.command import command
from osc_lib import exceptions as exc
from osc_lib import utils
@ -25,7 +24,7 @@ from senlinclient.common.i18n import _
from senlinclient.common import utils as senlin_utils
class ListAction(lister.Lister):
class ListAction(command.Lister):
"""List actions."""
log = logging.getLogger(__name__ + ".ListAction")
@ -109,7 +108,7 @@ class ListAction(lister.Lister):
)
class ShowAction(show.ShowOne):
class ShowAction(command.ShowOne):
"""Show detailed info about the specified action."""
log = logging.getLogger(__name__ + ".ShowAction")

View File

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

View File

@ -16,10 +16,8 @@ import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstack import exceptions as sdk_exc
from osc_lib.command import command
from osc_lib import exceptions as exc
from osc_lib import utils
@ -28,7 +26,7 @@ from senlinclient.common.i18n import _LI
from senlinclient.common import utils as senlin_utils
class ListCluster(lister.Lister):
class ListCluster(command.Lister):
"""List the user's clusters."""
log = logging.getLogger(__name__ + ".ListCluster")
@ -106,7 +104,7 @@ class ListCluster(lister.Lister):
)
class ShowCluster(show.ShowOne):
class ShowCluster(command.ShowOne):
"""Show details of the cluster."""
log = logging.getLogger(__name__ + ".ShowCluster")
@ -142,7 +140,7 @@ def _show_cluster(senlin_client, cluster_id):
formatters=formatters)
class CreateCluster(show.ShowOne):
class CreateCluster(command.ShowOne):
"""Create the cluster."""
log = logging.getLogger(__name__ + ".CreateCluster")
@ -215,7 +213,7 @@ class CreateCluster(show.ShowOne):
return _show_cluster(senlin_client, cluster.id)
class UpdateCluster(show.ShowOne):
class UpdateCluster(command.ShowOne):
"""Update the cluster."""
log = logging.getLogger(__name__ + ".UpdateCluster")
@ -584,7 +582,7 @@ class ClusterPolicyDetach(command.Command):
print('Request accepted by action: %s' % resp['action'])
class ClusterNodeList(lister.Lister):
class ClusterNodeList(command.Lister):
"""List nodes from cluster."""
log = logging.getLogger(__name__ + ".ClusterNodeList")

View File

@ -15,16 +15,14 @@
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from osc_lib.command import command
from osc_lib import utils
from senlinclient.common.i18n import _
from senlinclient.common import utils as senlin_utils
class ClusterPolicyList(lister.Lister):
class ClusterPolicyList(command.Lister):
"""List policies from cluster."""
log = logging.getLogger(__name__ + ".ClusterPolicyList")
@ -88,7 +86,7 @@ class ClusterPolicyList(lister.Lister):
)
class ClusterPolicyShow(show.ShowOne):
class ClusterPolicyShow(command.ShowOne):
"""Show a specific policy that is bound to the specified cluster."""
log = logging.getLogger(__name__ + ".ClusterPolicyShow")

View File

@ -15,9 +15,8 @@
import logging
import six
from cliff import lister
from cliff import show
from openstack import exceptions as sdk_exc
from osc_lib.command import command
from osc_lib import exceptions as exc
from osc_lib import utils
@ -25,7 +24,7 @@ from senlinclient.common.i18n import _
from senlinclient.common import utils as senlin_utils
class ListEvent(lister.Lister):
class ListEvent(command.Lister):
"""List events."""
log = logging.getLogger(__name__ + ".ListEvent")
@ -106,7 +105,7 @@ class ListEvent(lister.Lister):
)
class ShowEvent(show.ShowOne):
class ShowEvent(command.ShowOne):
"""Describe the event."""
log = logging.getLogger(__name__ + ".ShowEvent")

View File

@ -16,10 +16,8 @@ import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstack import exceptions as sdk_exc
from osc_lib.command import command
from osc_lib import exceptions as exc
from osc_lib import utils
@ -28,7 +26,7 @@ from senlinclient.common.i18n import _LI
from senlinclient.common import utils as senlin_utils
class ListNode(lister.Lister):
class ListNode(command.Lister):
"""Show list of nodes."""
log = logging.getLogger(__name__ + ".ListNode")
@ -118,7 +116,7 @@ class ListNode(lister.Lister):
)
class ShowNode(show.ShowOne):
class ShowNode(command.ShowOne):
"""Show detailed info about the specified node."""
log = logging.getLogger(__name__ + ".ShowNode")
@ -167,7 +165,7 @@ def _show_node(senlin_client, node_id, show_details=False):
formatters=formatters)
class CreateNode(show.ShowOne):
class CreateNode(command.ShowOne):
"""Create the node."""
log = logging.getLogger(__name__ + ".CreateNode")
@ -221,7 +219,7 @@ class CreateNode(show.ShowOne):
return _show_node(senlin_client, node.id)
class UpdateNode(show.ShowOne):
class UpdateNode(command.ShowOne):
"""Update the node."""
log = logging.getLogger(__name__ + ".UpdateNode")

View File

@ -15,10 +15,8 @@
import logging
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstack import exceptions as sdk_exc
from osc_lib.command import command
from osc_lib import exceptions as exc
from osc_lib import utils
@ -27,7 +25,7 @@ from senlinclient.common.i18n import _LI
from senlinclient.common import utils as senlin_utils
class ListPolicy(lister.Lister):
class ListPolicy(command.Lister):
"""List policies that meet the criteria."""
log = logging.getLogger(__name__ + ".ListPolicy")
@ -105,7 +103,7 @@ class ListPolicy(lister.Lister):
)
class ShowPolicy(show.ShowOne):
class ShowPolicy(command.ShowOne):
"""Show the policy details."""
log = logging.getLogger(__name__ + ".ShowPolicy")
@ -151,7 +149,7 @@ def _show_policy(senlin_client, policy_id):
formatters=formatters)
class CreatePolicy(show.ShowOne):
class CreatePolicy(command.ShowOne):
"""Create a policy."""
log = logging.getLogger(__name__ + ".CreatePolicy")
@ -185,7 +183,7 @@ class CreatePolicy(show.ShowOne):
return _show_policy(senlin_client, policy.id)
class UpdatePolicy(show.ShowOne):
class UpdatePolicy(command.ShowOne):
"""Update a policy."""
log = logging.getLogger(__name__ + ".UpdatePolicy")

View File

@ -15,15 +15,15 @@
import logging
import six
from cliff import lister
from openstack import exceptions as sdk_exc
from osc_lib.command import command
from osc_lib import exceptions as exc
from senlinclient.common import format_utils
from senlinclient.common.i18n import _
class PolicyTypeList(lister.Lister):
class PolicyTypeList(command.Lister):
"""List the available policy types."""
log = logging.getLogger(__name__ + ".PolicyTypeList")

View File

@ -15,10 +15,8 @@
import logging
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstack import exceptions as sdk_exc
from osc_lib.command import command
from osc_lib import exceptions as exc
from osc_lib import utils
@ -27,7 +25,7 @@ from senlinclient.common.i18n import _LI
from senlinclient.common import utils as senlin_utils
class ShowProfile(show.ShowOne):
class ShowProfile(command.ShowOne):
"""Show profile details."""
log = logging.getLogger(__name__ + ".ShowProfile")
@ -76,7 +74,7 @@ def _show_profile(senlin_client, profile_id):
formatters=formatters)
class ListProfile(lister.Lister):
class ListProfile(command.Lister):
"""List profiles that meet the criteria."""
log = logging.getLogger(__name__ + ".ListProfile")
@ -207,7 +205,7 @@ class DeleteProfile(command.Command):
print('Profile deleted: %s' % parsed_args.profile)
class CreateProfile(show.ShowOne):
class CreateProfile(command.ShowOne):
"""Create a profile."""
log = logging.getLogger(__name__ + ".CreateProfile")
@ -264,7 +262,7 @@ class CreateProfile(show.ShowOne):
return _show_profile(senlin_client, profile_id=profile.id)
class UpdateProfile(show.ShowOne):
class UpdateProfile(command.ShowOne):
"""Update a profile."""
log = logging.getLogger(__name__ + ".UpdateProfile")

View File

@ -15,14 +15,14 @@
import logging
import six
from cliff import lister
from openstack import exceptions as sdk_exc
from osc_lib.command import command
from osc_lib import exceptions as exc
from senlinclient.common import format_utils
from senlinclient.common.i18n import _
class ProfileTypeList(lister.Lister):
class ProfileTypeList(command.Lister):
"""List the available profile types."""
log = logging.getLogger(__name__ + ".ProfileTypeList")

View File

@ -16,10 +16,8 @@ import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstack import exceptions as sdk_exc
from osc_lib.command import command
from osc_lib import exceptions as exc
from osc_lib import utils
@ -28,7 +26,7 @@ from senlinclient.common.i18n import _LI
from senlinclient.common import utils as senlin_utils
class ListReceiver(lister.Lister):
class ListReceiver(command.Lister):
"""List receivers that meet the criteria."""
log = logging.getLogger(__name__ + ".ListReceiver")
@ -110,7 +108,7 @@ class ListReceiver(lister.Lister):
)
class ShowReceiver(show.ShowOne):
class ShowReceiver(command.ShowOne):
"""Show the receiver details."""
log = logging.getLogger(__name__ + ".ShowReceiver")
@ -147,7 +145,7 @@ def _show_receiver(senlin_client, receiver_id):
formatters=formatters)
class CreateReceiver(show.ShowOne):
class CreateReceiver(command.ShowOne):
"""Create a receiver."""
log = logging.getLogger(__name__ + ".CreateReceiver")