From f8e8ace88abeb8f10f12805732688ff76f5de61c Mon Sep 17 00:00:00 2001 From: Huanxuan Ao Date: Thu, 2 Feb 2017 11:51:47 +0800 Subject: [PATCH] SDK refactor: Set "is_admin_state_up" for network agent OpenStackSDK is >=0.9.13 now in requirement, so we can update "is_admin_state_up" as well for the SDK refactor Change-Id: I02de0ebc752ce602032bbe9d73256ed376993e78 --- openstackclient/network/v2/network_agent.py | 4 ++-- openstackclient/tests/unit/network/v2/test_network_agent.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openstackclient/network/v2/network_agent.py b/openstackclient/network/v2/network_agent.py index d429fa0830..66a024ccbb 100644 --- a/openstackclient/network/v2/network_agent.py +++ b/openstackclient/network/v2/network_agent.py @@ -186,11 +186,11 @@ class SetNetworkAgent(command.Command): attrs = {} if parsed_args.description is not None: attrs['description'] = str(parsed_args.description) - # TODO(huanxuan): Also update by the new attribute name - # "is_admin_state_up" after sdk 0.9.12 if parsed_args.enable: + attrs['is_admin_state_up'] = True attrs['admin_state_up'] = True if parsed_args.disable: + attrs['is_admin_state_up'] = False attrs['admin_state_up'] = False client.update_agent(obj, **attrs) diff --git a/openstackclient/tests/unit/network/v2/test_network_agent.py b/openstackclient/tests/unit/network/v2/test_network_agent.py index 2fc0c04328..650aba3efa 100644 --- a/openstackclient/tests/unit/network/v2/test_network_agent.py +++ b/openstackclient/tests/unit/network/v2/test_network_agent.py @@ -195,8 +195,6 @@ class TestListNetworkAgent(TestNetworkAgent): self.assertEqual(self.data, list(data)) -# TODO(huanxuan): Also update by the new attribute name -# "is_admin_state_up" after sdk 0.9.12 class TestSetNetworkAgent(TestNetworkAgent): _network_agent = ( @@ -245,6 +243,7 @@ class TestSetNetworkAgent(TestNetworkAgent): attrs = { 'description': 'new_description', 'admin_state_up': True, + 'is_admin_state_up': True, } self.network.update_agent.assert_called_once_with( self._network_agent, **attrs) @@ -266,6 +265,7 @@ class TestSetNetworkAgent(TestNetworkAgent): attrs = { 'admin_state_up': False, + 'is_admin_state_up': False, } self.network.update_agent.assert_called_once_with( self._network_agent, **attrs)