Merge "Fix Trivial Changes in [1]"

This commit is contained in:
Jenkins 2017-03-21 08:29:27 +00:00 committed by Gerrit Code Review
commit 2fdd4ff2f6
2 changed files with 14 additions and 14 deletions

View File

@ -25,15 +25,15 @@ Add network to an agent
.. describe:: --dhcp .. describe:: --dhcp
Add a network to DHCP agent. Add a network to DHCP agent
.. describe:: <agent-id> .. describe:: <agent-id>
Agent to which a network is added. (ID only) Agent to which a network is added (ID only)
.. describe:: <network> .. 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 network agent delete
-------------------- --------------------
@ -77,7 +77,7 @@ List network agents
.. option:: --network <network> .. option:: --network <network>
List agents hosting a network. (ID or name) List agents hosting a network (ID or name)
network agent set network agent set
----------------- -----------------
@ -144,8 +144,8 @@ Remove network from an agent
.. describe:: <agent-id> .. describe:: <agent-id>
Agent to which a network is removed. (ID only) Agent to which a network is removed (ID only)
.. describe:: <network> .. describe:: <network>
Network to be removed from an agent. (ID or name) Network to be removed from an agent (ID or name)

View File

@ -56,20 +56,20 @@ class AddNetworkToAgent(command.Command):
parser.add_argument( parser.add_argument(
'agent_id', 'agent_id',
metavar='<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( parser.add_argument(
'network', 'network',
metavar='<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 return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
client = self.app.client_manager.network client = self.app.client_manager.network
agent = client.get_agent(parsed_args.agent_id) agent = client.get_agent(parsed_args.agent_id)
if parsed_args.dhcp:
network = client.find_network( network = client.find_network(
parsed_args.network, ignore_missing=False) parsed_args.network, ignore_missing=False)
if parsed_args.dhcp:
try: try:
client.add_dhcp_agent_to_network(agent, network) client.add_dhcp_agent_to_network(agent, network)
except Exception: except Exception:
@ -225,19 +225,19 @@ class RemoveNetworkFromAgent(command.Command):
parser.add_argument( parser.add_argument(
'agent_id', 'agent_id',
metavar='<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( parser.add_argument(
'network', 'network',
metavar='<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 return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
client = self.app.client_manager.network client = self.app.client_manager.network
agent = client.get_agent(parsed_args.agent_id) agent = client.get_agent(parsed_args.agent_id)
if parsed_args.dhcp:
network = client.find_network( network = client.find_network(
parsed_args.network, ignore_missing=False) parsed_args.network, ignore_missing=False)
if parsed_args.dhcp:
try: try:
client.remove_dhcp_agent_from_network(agent, network) client.remove_dhcp_agent_from_network(agent, network)
except Exception: except Exception: