Dougal Matthews 8953db2108 Reimplement print_dict and print_list formatters
This partially reverts 948e05d which removed the formatters.
The removal is incorrect as the one in oslo doesn't have the same
functionality. Excessive mocking in the tests hid this problem
originally, so this change adds a test to avoid this in the future.

The plan is to remove these again with a larger refactor, but at the
moment they break master.

Change-Id: I1d075dca66cbaa5d2ae8c4e5034373fb392ff5d9
2015-01-29 15:47:24 +00:00

29 lines
905 B
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import print_function
import sys
import tuskarclient.common.formatting as fmt
def do_role_list(tuskar, args, outfile=sys.stdout):
"""Show a list of the Roles."""
roles = tuskar.roles.list()
fields = ['uuid', 'name', 'version', 'description']
formatters = {
}
fmt.print_list(roles, fields, formatters, outfile=outfile)