diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-05-21 09:25:56 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-05-21 09:25:56 +0000 |
commit | 94d10f951819b0f0024996c367c9479e5ddd9768 (patch) | |
tree | a4db0e1e56d3784b1822c8d6ab4974e9c193ecf5 /heatclient/v1 | |
parent | c183a61d15b2e8d92668ab99afbd47e3afc8dc1b (diff) | |
parent | 5a39aed920baedc58758cf57d9f6d6c539637bc0 (diff) | |
download | python-heatclient-94d10f951819b0f0024996c367c9479e5ddd9768.tar.gz |
Merge "Fix empty resource list index out of range error"
Diffstat (limited to 'heatclient/v1')
-rw-r--r-- | heatclient/v1/shell.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index 09794fc..1ecc880 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -564,11 +564,10 @@ def do_resource_list(hc, args): raise exc.CommandError('Stack not found: %s' % args.id) else: fields = ['resource_type', 'resource_status', 'updated_time'] - if len(resources) >= 1: - if hasattr(resources[0], 'resource_name'): - fields.insert(0, 'resource_name') - else: - fields.insert(0, 'logical_resource_id') + if len(resources) >= 1 and not hasattr(resources[0], 'resource_name'): + fields.insert(0, 'logical_resource_id') + else: + fields.insert(0, 'resource_name') utils.print_list(resources, fields, sortby_index=3) |