From 70be059480af2eaac8a0b7afdd91f7ca86b94c05 Mon Sep 17 00:00:00 2001 From: Derek Bekoe Date: Fri, 26 Feb 2016 15:46:44 -0800 Subject: [PATCH] Return a serialized object instead of creating the table output in the command --- src/azure/cli/commands/resourcegroup.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/azure/cli/commands/resourcegroup.py b/src/azure/cli/commands/resourcegroup.py index 0c50f9599fc..6a7eec557b5 100644 --- a/src/azure/cli/commands/resourcegroup.py +++ b/src/azure/cli/commands/resourcegroup.py @@ -1,4 +1,5 @@ -from .._util import TableOutput +from msrest import Serializer + from ..commands import command, description, option from .._profile import Profile @@ -19,14 +20,5 @@ def list_groups(args, unexpected): #groups = rmc.resource_groups.list(filter=None, top=args.get('top')) groups = rmc.resource_groups.list() - with TableOutput() as to: - for grp in groups: - assert isinstance(grp, ResourceGroup) - to.cell('Name', grp.name) - to.cell('Type', grp.properties) - to.cell('Location', grp.location) - to.cell('Tags', grp.tags) - to.end_row() - if not to.any_rows: - print('No resource groups defined') - + serializable = Serializer().serialize_data(groups, "[ResourceGroup]") + return serializable