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:
parent
1957690754
commit
142c5faae3
@ -74,7 +74,7 @@ _formatters_compute = {
|
|||||||
def _get_columns(item):
|
def _get_columns(item):
|
||||||
# Build the display columns and a list of the property columns
|
# Build the display columns and a list of the property columns
|
||||||
# that need to be mapped (display column name, property name).
|
# that need to be mapped (display column name, property name).
|
||||||
columns = list(item.keys())
|
columns = list(item.to_dict().keys())
|
||||||
property_column_mappings = []
|
property_column_mappings = []
|
||||||
if 'security_group_rules' in columns:
|
if 'security_group_rules' in columns:
|
||||||
columns.append('rules')
|
columns.append('rules')
|
||||||
@ -156,7 +156,7 @@ class CreateSecurityGroup(common.NetworkAndComputeShowOne):
|
|||||||
parsed_args.name,
|
parsed_args.name,
|
||||||
description,
|
description,
|
||||||
)
|
)
|
||||||
display_columns, property_columns = _get_columns(obj._info)
|
display_columns, property_columns = _get_columns(obj)
|
||||||
data = utils.get_dict_properties(
|
data = utils.get_dict_properties(
|
||||||
obj._info,
|
obj._info,
|
||||||
property_columns,
|
property_columns,
|
||||||
@ -336,7 +336,7 @@ class ShowSecurityGroup(common.NetworkAndComputeShowOne):
|
|||||||
client.security_groups,
|
client.security_groups,
|
||||||
parsed_args.group,
|
parsed_args.group,
|
||||||
)
|
)
|
||||||
display_columns, property_columns = _get_columns(obj._info)
|
display_columns, property_columns = _get_columns(obj)
|
||||||
data = utils.get_dict_properties(
|
data = utils.get_dict_properties(
|
||||||
obj._info,
|
obj._info,
|
||||||
property_columns,
|
property_columns,
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import testtools
|
|
||||||
|
|
||||||
from openstackclient.tests.functional import base
|
from openstackclient.tests.functional import base
|
||||||
|
|
||||||
|
|
||||||
@ -25,7 +23,6 @@ class SecurityGroupTests(base.TestCase):
|
|||||||
FIELDS = ['name']
|
FIELDS = ['name']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@testtools.skip('broken SDK testing')
|
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
opts = cls.get_opts(cls.FIELDS)
|
opts = cls.get_opts(cls.FIELDS)
|
||||||
raw_output = cls.openstack('security group create ' + cls.NAME + opts)
|
raw_output = cls.openstack('security group create ' + cls.NAME + opts)
|
||||||
|
@ -26,7 +26,6 @@ class SecurityGroupRuleTests(base.TestCase):
|
|||||||
ID_HEADER = ['ID']
|
ID_HEADER = ['ID']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@testtools.skip('broken SDK testing')
|
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
# Create the security group to hold the rule.
|
# Create the security group to hold the rule.
|
||||||
opts = cls.get_opts(cls.NAME_FIELD)
|
opts = cls.get_opts(cls.NAME_FIELD)
|
||||||
@ -55,6 +54,7 @@ class SecurityGroupRuleTests(base.TestCase):
|
|||||||
cls.SECURITY_GROUP_NAME)
|
cls.SECURITY_GROUP_NAME)
|
||||||
cls.assertOutput('', raw_output)
|
cls.assertOutput('', raw_output)
|
||||||
|
|
||||||
|
@testtools.skip('broken SDK testing')
|
||||||
def test_security_group_rule_list(self):
|
def test_security_group_rule_list(self):
|
||||||
opts = self.get_opts(self.ID_HEADER)
|
opts = self.get_opts(self.ID_HEADER)
|
||||||
raw_output = self.openstack('security group rule list ' +
|
raw_output = self.openstack('security group rule list ' +
|
||||||
|
@ -212,6 +212,9 @@ class FakeResource(object):
|
|||||||
def keys(self):
|
def keys(self):
|
||||||
return self._info.keys()
|
return self._info.keys()
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
return self._info
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def info(self):
|
def info(self):
|
||||||
return self._info
|
return self._info
|
||||||
|
Loading…
Reference in New Issue
Block a user