@@ -56,20 +56,20 @@ def get_parser(self, prog_name):
5656 parser .add_argument (
5757 'agent_id' ,
5858 metavar = '<agent-id>' ,
59- help = _ ('Agent to which a network is added. (ID only)' ))
59+ help = _ ('Agent to which a network is added (ID only)' ))
6060 parser .add_argument (
6161 'network' ,
6262 metavar = '<network>' ,
63- help = _ ('Network to be added to an agent. (ID or name)' ))
63+ help = _ ('Network to be added to an agent (ID or name)' ))
6464
6565 return parser
6666
6767 def take_action (self , parsed_args ):
6868 client = self .app .client_manager .network
6969 agent = client .get_agent (parsed_args .agent_id )
70+ network = client .find_network (
71+ parsed_args .network , ignore_missing = False )
7072 if parsed_args .dhcp :
71- network = client .find_network (
72- parsed_args .network , ignore_missing = False )
7373 try :
7474 client .add_dhcp_agent_to_network (agent , network )
7575 except Exception :
@@ -225,19 +225,19 @@ def get_parser(self, prog_name):
225225 parser .add_argument (
226226 'agent_id' ,
227227 metavar = '<agent-id>' ,
228- help = _ ('Agent to which a network is removed. (ID only)' ))
228+ help = _ ('Agent to which a network is removed (ID only)' ))
229229 parser .add_argument (
230230 'network' ,
231231 metavar = '<network>' ,
232- help = _ ('Network to be removed from an agent. (ID or name)' ))
232+ help = _ ('Network to be removed from an agent (ID or name)' ))
233233 return parser
234234
235235 def take_action (self , parsed_args ):
236236 client = self .app .client_manager .network
237237 agent = client .get_agent (parsed_args .agent_id )
238+ network = client .find_network (
239+ parsed_args .network , ignore_missing = False )
238240 if parsed_args .dhcp :
239- network = client .find_network (
240- parsed_args .network , ignore_missing = False )
241241 try :
242242 client .remove_dhcp_agent_from_network (agent , network )
243243 except Exception :
0 commit comments