Fix Octavia gate breakage caused by _get_columns()

The above mentioned function tries to extract keys() from an item which
is type class.

This patch fixes the issue by converting item to dict by using
to_dict().

Change-Id: Ida520ae9fe64171d105f486ba06eda127a24547b
Closes-Bug: #1654887
This commit is contained in:
Nir Magnezi 2017-01-09 12:31:47 +02:00
parent 1957690754
commit 142c5faae3
4 changed files with 7 additions and 7 deletions

View File

@ -74,7 +74,7 @@ _formatters_compute = {
def _get_columns(item):
# Build the display columns and a list of the property columns
# that need to be mapped (display column name, property name).
columns = list(item.keys())
columns = list(item.to_dict().keys())
property_column_mappings = []
if 'security_group_rules' in columns:
columns.append('rules')
@ -156,7 +156,7 @@ class CreateSecurityGroup(common.NetworkAndComputeShowOne):
parsed_args.name,
description,
)
display_columns, property_columns = _get_columns(obj._info)
display_columns, property_columns = _get_columns(obj)
data = utils.get_dict_properties(
obj._info,
property_columns,
@ -336,7 +336,7 @@ class ShowSecurityGroup(common.NetworkAndComputeShowOne):
client.security_groups,
parsed_args.group,
)
display_columns, property_columns = _get_columns(obj._info)
display_columns, property_columns = _get_columns(obj)
data = utils.get_dict_properties(
obj._info,
property_columns,

View File

@ -12,8 +12,6 @@
import uuid
import testtools
from openstackclient.tests.functional import base
@ -25,7 +23,6 @@ class SecurityGroupTests(base.TestCase):
FIELDS = ['name']
@classmethod
@testtools.skip('broken SDK testing')
def setUpClass(cls):
opts = cls.get_opts(cls.FIELDS)
raw_output = cls.openstack('security group create ' + cls.NAME + opts)

View File

@ -26,7 +26,6 @@ class SecurityGroupRuleTests(base.TestCase):
ID_HEADER = ['ID']
@classmethod
@testtools.skip('broken SDK testing')
def setUpClass(cls):
# Create the security group to hold the rule.
opts = cls.get_opts(cls.NAME_FIELD)
@ -55,6 +54,7 @@ class SecurityGroupRuleTests(base.TestCase):
cls.SECURITY_GROUP_NAME)
cls.assertOutput('', raw_output)
@testtools.skip('broken SDK testing')
def test_security_group_rule_list(self):
opts = self.get_opts(self.ID_HEADER)
raw_output = self.openstack('security group rule list ' +

View File

@ -212,6 +212,9 @@ class FakeResource(object):
def keys(self):
return self._info.keys()
def to_dict(self):
return self._info
@property
def info(self):
return self._info