diff --git a/doc/source/command-objects/network-agent.rst b/doc/source/command-objects/network-agent.rst index d764f3de1c..f69d0ece69 100644 --- a/doc/source/command-objects/network-agent.rst +++ b/doc/source/command-objects/network-agent.rst @@ -25,15 +25,15 @@ Add network to an agent .. describe:: --dhcp - Add a network to DHCP agent. + Add a network to DHCP agent .. describe:: - Agent to which a network is added. (ID only) + Agent to which a network is added (ID only) .. describe:: - Network to be added to an agent. (ID or name) + Network to be added to an agent (ID or name) network agent delete -------------------- @@ -77,7 +77,7 @@ List network agents .. option:: --network - List agents hosting a network. (ID or name) + List agents hosting a network (ID or name) network agent set ----------------- @@ -144,8 +144,8 @@ Remove network from an agent .. describe:: - Agent to which a network is removed. (ID only) + Agent to which a network is removed (ID only) .. describe:: - Network to be removed from an agent. (ID or name) + Network to be removed from an agent (ID or name) diff --git a/openstackclient/network/v2/network_agent.py b/openstackclient/network/v2/network_agent.py index 7c2edb88e2..dd3fdc2433 100644 --- a/openstackclient/network/v2/network_agent.py +++ b/openstackclient/network/v2/network_agent.py @@ -56,20 +56,20 @@ class AddNetworkToAgent(command.Command): parser.add_argument( 'agent_id', metavar='', - help=_('Agent to which a network is added. (ID only)')) + help=_('Agent to which a network is added (ID only)')) parser.add_argument( 'network', metavar='', - help=_('Network to be added to an agent. (ID or name)')) + help=_('Network to be added to an agent (ID or name)')) return parser def take_action(self, parsed_args): client = self.app.client_manager.network agent = client.get_agent(parsed_args.agent_id) + network = client.find_network( + parsed_args.network, ignore_missing=False) if parsed_args.dhcp: - network = client.find_network( - parsed_args.network, ignore_missing=False) try: client.add_dhcp_agent_to_network(agent, network) except Exception: @@ -225,19 +225,19 @@ class RemoveNetworkFromAgent(command.Command): parser.add_argument( 'agent_id', metavar='', - help=_('Agent to which a network is removed. (ID only)')) + help=_('Agent to which a network is removed (ID only)')) parser.add_argument( 'network', metavar='', - help=_('Network to be removed from an agent. (ID or name)')) + help=_('Network to be removed from an agent (ID or name)')) return parser def take_action(self, parsed_args): client = self.app.client_manager.network agent = client.get_agent(parsed_args.agent_id) + network = client.find_network( + parsed_args.network, ignore_missing=False) if parsed_args.dhcp: - network = client.find_network( - parsed_args.network, ignore_missing=False) try: client.remove_dhcp_agent_from_network(agent, network) except Exception: