File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -365,6 +365,12 @@ def take_action(self, parsed_args):
365365 if not attrs :
366366 msg = "Nothing specified to be set"
367367 raise exceptions .CommandError (msg )
368+ if 'dns_nameservers' in attrs :
369+ attrs ['dns_nameservers' ] += obj .dns_nameservers
370+ if 'host_routes' in attrs :
371+ attrs ['host_routes' ] += obj .host_routes
372+ if 'allocation_pools' in attrs :
373+ attrs ['allocation_pools' ] += obj .allocation_pools
368374 client .update_subnet (obj , ** attrs )
369375 return
370376
Original file line number Diff line number Diff line change @@ -536,6 +536,26 @@ def test_set_nothing(self):
536536 self .assertRaises (exceptions .CommandError , self .cmd .take_action ,
537537 parsed_args )
538538
539+ def test_append_options (self ):
540+ _testsubnet = network_fakes .FakeSubnet .create_one_subnet (
541+ {'dns_nameservers' : ["10.0.0.1" ]})
542+ self .network .find_subnet = mock .Mock (return_value = _testsubnet )
543+ arglist = [
544+ '--dns-nameserver' , '10.0.0.2' ,
545+ _testsubnet .name ,
546+ ]
547+ verifylist = [
548+ ('dns_nameservers' , ['10.0.0.2' ]),
549+ ]
550+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
551+ result = self .cmd .take_action (parsed_args )
552+ attrs = {
553+ 'dns_nameservers' : ['10.0.0.2' , '10.0.0.1' ],
554+ }
555+ self .network .update_subnet .assert_called_once_with (
556+ _testsubnet , ** attrs )
557+ self .assertIsNone (result )
558+
539559
540560class TestShowSubnet (TestSubnet ):
541561 # The subnets to be shown
You can’t perform that action at this time.
0 commit comments