removed topology-list

there is only one topology at the moment
no need for id also

Change-Id: I65407bd8aef4ea5563023b492d63656759fae145
Implements: blueprint vitrage-cli
This commit is contained in:
Eyal 2015-11-22 09:51:47 +02:00
parent ae3935d7a5
commit 01bf1694c9
4 changed files with 6 additions and 30 deletions

View File

@ -5,7 +5,7 @@ description-file =
README.rst README.rst
author = OpenStack author = OpenStack
author-email = openstack-dev@lists.openstack.org author-email = openstack-dev@lists.openstack.org
home-page = http://www.openstack.org/ home-page = https://launchpad.net/python-vitrageclient
classifier = classifier =
Environment :: OpenStack Environment :: OpenStack
Intended Audience :: Information Technology Intended Audience :: Information Technology

View File

@ -35,7 +35,6 @@ from vitrageclient import __version__
class VitrageCommandManager(commandmanager.CommandManager): class VitrageCommandManager(commandmanager.CommandManager):
COMMANDS = { COMMANDS = {
"topology list": topology.TopologyList,
"topology show": topology.TopologyShow, "topology show": topology.TopologyShow,
} }

View File

@ -10,25 +10,11 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from cliff import lister
from cliff import show from cliff import show
class TopologyList(lister.Lister): # noinspection PyAbstractClass
COLS = ('id', 'name', 'description')
def take_action(self, parsed_args):
topologies = self.app.client.topology.list()
return self.COLS, [tuple([topologies[col] for col in self.COLS])]
class TopologyShow(show.ShowOne): class TopologyShow(show.ShowOne):
def get_parser(self, uuid):
parser = super(TopologyShow, self).get_parser(uuid)
parser.add_argument("id", help="Id of the topology")
return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
topology = self.app.client.topology.get(id=parsed_args.id) topology = self.app.client.topology.get()
return self.dict2columns(topology) return self.dict2columns(topology)

View File

@ -12,21 +12,12 @@
class Topology(object): class Topology(object):
URL = "v1/topologies/" URL = "v1/topology/"
def __init__(self, api): def __init__(self, api):
self.api = api self.api = api
def list(self): def get(self):
"""List topologies""" """Get a topology """
return self.api.get(self.URL).json() return self.api.get(self.URL).json()
def get(self, uuid):
"""Get a topology
:param uuid: Id of topology
:type uuid: str
"""
return self.api.get(self.URL + uuid).json()