Fix Trivial Changes in [1]
[1] had some trivial changes in the main code, which are being put forward in this patch, to consider future scenarios. [1]: I77a933f4b3ce875c63cef5b6a32aee78fd844b03 TrivialFix Change-Id: I8e8fbb194cd319e5605f09c94ae09e952d0961b1
This commit is contained in:
parent
49e866174f
commit
8e2bc9cb9c
@ -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-id>
|
||||
|
||||
Agent to which a network is added. (ID only)
|
||||
Agent to which a network is added (ID only)
|
||||
|
||||
.. describe:: <network>
|
||||
|
||||
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 <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-id>
|
||||
|
||||
Agent to which a network is removed. (ID only)
|
||||
Agent to which a network is removed (ID only)
|
||||
|
||||
.. describe:: <network>
|
||||
|
||||
Network to be removed from an agent. (ID or name)
|
||||
Network to be removed from an agent (ID or name)
|
||||
|
@ -56,20 +56,20 @@ class AddNetworkToAgent(command.Command):
|
||||
parser.add_argument(
|
||||
'agent_id',
|
||||
metavar='<agent-id>',
|
||||
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='<network>',
|
||||
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)
|
||||
if parsed_args.dhcp:
|
||||
network = client.find_network(
|
||||
parsed_args.network, ignore_missing=False)
|
||||
if parsed_args.dhcp:
|
||||
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='<agent-id>',
|
||||
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='<network>',
|
||||
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)
|
||||
if parsed_args.dhcp:
|
||||
network = client.find_network(
|
||||
parsed_args.network, ignore_missing=False)
|
||||
if parsed_args.dhcp:
|
||||
try:
|
||||
client.remove_dhcp_agent_from_network(agent, network)
|
||||
except Exception:
|
||||
|
Loading…
Reference in New Issue
Block a user