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: I615bd541418df04970c44dee448ac61fae462443
This commit is contained in:
Tang Chen
2016-06-29 19:06:31 +08:00
parent c5e373cc52
commit fdfe5ae5c6
10 changed files with 33 additions and 41 deletions

View File

@@ -17,8 +17,7 @@
import json import json
import logging import logging
from cliff import command from osc_lib.command import command
from cliff import show
from mistralclient.commands.v2 import base from mistralclient.commands.v2 import base
from mistralclient import utils from mistralclient import utils
@@ -60,7 +59,7 @@ def format(action_ex=None, lister=False):
return columns, data return columns, data
class Create(show.ShowOne): class Create(command.ShowOne):
"""Create new Action execution or just run specific action.""" """Create new Action execution or just run specific action."""
def produce_output(self, parsed_args, column_names, data): def produce_output(self, parsed_args, column_names, data):
@@ -156,7 +155,7 @@ class List(base.MistralLister):
) )
class Get(show.ShowOne): class Get(command.ShowOne):
"""Show specific Action execution.""" """Show specific Action execution."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -174,7 +173,7 @@ class Get(show.ShowOne):
return format(execution) return format(execution)
class Update(show.ShowOne): class Update(command.ShowOne):
"""Update specific Action execution.""" """Update specific Action execution."""
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -17,8 +17,7 @@
import argparse import argparse
import logging import logging
from cliff import command from osc_lib.command import command
from cliff import show
from mistralclient.commands.v2 import base from mistralclient.commands.v2 import base
from mistralclient import utils from mistralclient import utils
@@ -78,7 +77,7 @@ class List(base.MistralLister):
return mistral_client.actions.list() return mistral_client.actions.list()
class Get(show.ShowOne): class Get(command.ShowOne):
"""Show specific action.""" """Show specific action."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -203,7 +202,7 @@ class GetDefinition(command.Command):
self.app.stdout.write(definition or "\n") self.app.stdout.write(definition or "\n")
class Validate(show.ShowOne): class Validate(command.ShowOne):
"""Validate action.""" """Validate action."""
def _format(self, result=None): def _format(self, result=None):

View File

@@ -17,12 +17,12 @@
import abc import abc
import textwrap import textwrap
from cliff import lister from osc_lib.command import command
import six import six
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)
class MistralLister(lister.Lister): class MistralLister(command.Lister):
@abc.abstractmethod @abc.abstractmethod
def _get_format_function(self): def _get_format_function(self):
raise NotImplementedError raise NotImplementedError

View File

@@ -17,8 +17,7 @@
import json import json
import logging import logging
from cliff import command from osc_lib.command import command
from cliff import show
from mistralclient.commands.v2 import base from mistralclient.commands.v2 import base
from mistralclient import utils from mistralclient import utils
@@ -82,7 +81,7 @@ class List(base.MistralLister):
return mistral_client.cron_triggers.list() return mistral_client.cron_triggers.list()
class Get(show.ShowOne): class Get(command.ShowOne):
"""Show specific cron trigger.""" """Show specific cron trigger."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -98,7 +97,7 @@ class Get(show.ShowOne):
return format(mistral_client.cron_triggers.get(parsed_args.name)) return format(mistral_client.cron_triggers.get(parsed_args.name))
class Create(show.ShowOne): class Create(command.ShowOne):
"""Create new trigger.""" """Create new trigger."""
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -16,8 +16,7 @@ import argparse
import json import json
import logging import logging
from cliff import command from osc_lib.command import command
from cliff import show
from mistralclient.commands.v2 import base from mistralclient.commands.v2 import base
from mistralclient import utils from mistralclient import utils
@@ -99,7 +98,7 @@ class List(base.MistralLister):
return mistral_client.environments.list() return mistral_client.environments.list()
class Get(show.ShowOne): class Get(command.ShowOne):
"""Show specific environment.""" """Show specific environment."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -119,7 +118,7 @@ class Get(show.ShowOne):
return format(environment) return format(environment)
class Create(show.ShowOne): class Create(command.ShowOne):
"""Create new environment.""" """Create new environment."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -163,7 +162,7 @@ class Delete(command.Command):
) )
class Update(show.ShowOne): class Update(command.ShowOne):
"""Update environment.""" """Update environment."""
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -19,8 +19,7 @@ import json
import logging import logging
import os.path import os.path
from cliff import command from osc_lib.command import command
from cliff import show
from mistralclient.commands.v2 import base from mistralclient.commands.v2 import base
from mistralclient import utils from mistralclient import utils
@@ -119,7 +118,7 @@ class List(base.MistralLister):
) )
class Get(show.ShowOne): class Get(command.ShowOne):
"""Show specific execution.""" """Show specific execution."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -136,7 +135,7 @@ class Get(show.ShowOne):
return format(execution) return format(execution)
class Create(show.ShowOne): class Create(command.ShowOne):
"""Create new execution.""" """Create new execution."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -221,7 +220,7 @@ class Delete(command.Command):
) )
class Update(show.ShowOne): class Update(command.ShowOne):
"""Update execution.""" """Update execution."""
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -13,8 +13,7 @@
# under the License. # under the License.
# #
from cliff import command from osc_lib.command import command
from cliff import show
from mistralclient.commands.v2 import base from mistralclient.commands.v2 import base
from mistralclient import exceptions from mistralclient import exceptions
@@ -83,7 +82,7 @@ class List(base.MistralLister):
) )
class Get(show.ShowOne): class Get(command.ShowOne):
"""Show specific member information.""" """Show specific member information."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -118,7 +117,7 @@ class Get(show.ShowOne):
return format(member) return format(member)
class Create(show.ShowOne): class Create(command.ShowOne):
"""Shares a resource to another tenant.""" """Shares a resource to another tenant."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -192,7 +191,7 @@ class Delete(command.Command):
raise exceptions.MistralClientException(error_msg) raise exceptions.MistralClientException(error_msg)
class Update(show.ShowOne): class Update(command.ShowOne):
"""Update resource sharing status.""" """Update resource sharing status."""
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -19,8 +19,7 @@ import json
import logging import logging
import os.path import os.path
from cliff import command from osc_lib.command import command
from cliff import show
from mistralclient.commands.v2 import base from mistralclient.commands.v2 import base
from mistralclient import utils from mistralclient import utils
@@ -80,7 +79,7 @@ class List(base.MistralLister):
return mistral_client.tasks.list(parsed_args.workflow_execution) return mistral_client.tasks.list(parsed_args.workflow_execution)
class Get(show.ShowOne): class Get(command.ShowOne):
"""Show specific task.""" """Show specific task."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -145,7 +144,7 @@ class GetPublished(command.Command):
self.app.stdout.write(result or "\n") self.app.stdout.write(result or "\n")
class Rerun(show.ShowOne): class Rerun(command.ShowOne):
"""Rerun an existing task.""" """Rerun an existing task."""
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -16,8 +16,7 @@
import argparse import argparse
import logging import logging
from cliff import command from osc_lib.command import command
from cliff import show
from mistralclient.commands.v2 import base from mistralclient.commands.v2 import base
from mistralclient import utils from mistralclient import utils
@@ -63,7 +62,7 @@ class List(base.MistralLister):
return mistral_client.workbooks.list() return mistral_client.workbooks.list()
class Get(show.ShowOne): class Get(command.ShowOne):
"""Show specific workbook.""" """Show specific workbook."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -83,7 +82,7 @@ class Get(show.ShowOne):
return format(workbook) return format(workbook)
class Create(show.ShowOne): class Create(command.ShowOne):
"""Create new workbook.""" """Create new workbook."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -126,7 +125,7 @@ class Delete(command.Command):
) )
class Update(show.ShowOne): class Update(command.ShowOne):
"""Update workbook.""" """Update workbook."""
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -166,7 +165,7 @@ class GetDefinition(command.Command):
self.app.stdout.write(definition or "\n") self.app.stdout.write(definition or "\n")
class Validate(show.ShowOne): class Validate(command.ShowOne):
"""Validate workbook.""" """Validate workbook."""
def _format(self, result=None): def _format(self, result=None):

View File

@@ -33,8 +33,8 @@ import mistralclient.commands.v2.workflows
from mistralclient.openstack.common import cliutils as c from mistralclient.openstack.common import cliutils as c
from cliff import app from cliff import app
from cliff import command
from cliff import commandmanager from cliff import commandmanager
from osc_lib.command import command
import argparse import argparse