From 0235eb47aaeccc59505931a950f8e6cec132871d Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 13 Mar 2023 10:53:54 +0900 Subject: [PATCH] Remove tenant_* properties These were deprecated[1] during the past cycle so can be removed now. [1] 91c9bc3f33e0b8dadbcaaa90a5013c1c83065e92 Change-Id: Ib1d2a70a8e40680ebb582cbf4e59a0c018c21447 --- examples/base_provision.pp | 12 ++++----- .../provider/neutron_network/openstack.rb | 10 +------- lib/puppet/provider/neutron_port/openstack.rb | 10 +------- .../provider/neutron_router/openstack.rb | 10 +------- .../provider/neutron_subnet/openstack.rb | 10 +------- lib/puppet/type/neutron_network.rb | 25 ++----------------- lib/puppet/type/neutron_port.rb | 25 ++----------------- lib/puppet/type/neutron_router.rb | 25 ++----------------- lib/puppet/type/neutron_subnet.rb | 25 ++----------------- ...remove-tenant-params-63c23e81474b220e.yaml | 11 ++++++++ .../neutron_network/openstack_spec.rb | 14 +++++------ .../provider/neutron_port/openstack_spec.rb | 4 +-- .../provider/neutron_subnet/openstack_spec.rb | 4 +-- 13 files changed, 40 insertions(+), 145 deletions(-) create mode 100644 releasenotes/notes/remove-tenant-params-63c23e81474b220e.yaml diff --git a/examples/base_provision.pp b/examples/base_provision.pp index 028b197a1..092b79122 100644 --- a/examples/base_provision.pp +++ b/examples/base_provision.pp @@ -15,14 +15,14 @@ keystone_tenant { 'admin': neutron_network { 'public': ensure => present, router_external => 'True', - tenant_name => 'admin', + project_name => 'admin', } neutron_subnet { 'public_subnet': ensure => 'present', cidr => '172.24.4.224/28', network_name => 'public', - tenant_name => 'admin', + project_name => 'admin', } keystone_tenant { 'demo': @@ -30,21 +30,21 @@ keystone_tenant { 'demo': } neutron_network { 'private': - ensure => present, - tenant_name => 'demo', + ensure => present, + project_name => 'demo', } neutron_subnet { 'private_subnet': ensure => present, cidr => '10.0.0.0/24', network_name => 'private', - tenant_name => 'demo', + project_name => 'demo', } # Tenant-private router - assumes network namespace isolation neutron_router { 'demo_router': ensure => present, - tenant_name => 'demo', + project_name => 'demo', gateway_network_name => 'public', require => Neutron_subnet['public_subnet'], } diff --git a/lib/puppet/provider/neutron_network/openstack.rb b/lib/puppet/provider/neutron_network/openstack.rb index 0c0ea00ac..6de01482e 100644 --- a/lib/puppet/provider/neutron_network/openstack.rb +++ b/lib/puppet/provider/neutron_network/openstack.rb @@ -42,7 +42,6 @@ Puppet::Type.type(:neutron_network).provide( :provider_segmentation_id => network[:provider_segmentation_id], :router_external => network[:router_external], :shared => network[:shared], - :tenant_id => network[:project_id], :project_id => network[:project_id], :availability_zone_hint => parse_availability_zone_hint(network[:availability_zone_hints]), :mtu => network[:mtu], @@ -80,11 +79,7 @@ Puppet::Type.type(:neutron_network).provide( opts << '--disable' end - if @resource[:tenant_name] - opts << "--project=#{@resource[:tenant_name]}" - elsif @resource[:tenant_id] - opts << "--project=#{@resource[:tenant_id]}" - elsif @resource[:project_name] + if @resource[:project_name] opts << "--project=#{@resource[:project_name]}" elsif @resource[:project_id] opts << "--project=#{@resource[:project_id]}" @@ -130,7 +125,6 @@ Puppet::Type.type(:neutron_network).provide( :provider_segmentation_id => network[:provider_segmentation_id], :router_external => network[:router_external], :shared => network[:shared], - :tenant_id => network[:project_id], :project_id => network[:project_id], :availability_zone_hint => self.class.parse_availability_zone_hint(network[:availability_zone_hints]), :mtu => network[:mtu], @@ -202,8 +196,6 @@ Puppet::Type.type(:neutron_network).provide( :provider_network_type, :provider_physical_network, :provider_segmentation_id, - :tenant_id, - :tenant_name, :project_id, :project_name, ].each do |attr| diff --git a/lib/puppet/provider/neutron_port/openstack.rb b/lib/puppet/provider/neutron_port/openstack.rb index 13304253e..aebc09b3a 100644 --- a/lib/puppet/provider/neutron_port/openstack.rb +++ b/lib/puppet/provider/neutron_port/openstack.rb @@ -38,7 +38,6 @@ Puppet::Type.type(:neutron_port).provide( :name => port[:name], :id => port[:id], :status => port[:status], - :tenant_id => port[:project_id], :project_id => port[:project_id], :network_id => port[:network_id], :network_name => get_network_name(port[:network_id]), @@ -96,11 +95,7 @@ Puppet::Type.type(:neutron_port).provide( end end - if @resource[:tenant_name] - opts << "--project=#{@resource[:tenant_name]}" - elsif @resource[:tenant_id] - opts << "--project=#{@resource[:tenant_id]}" - elsif @resource[:project_name] + if @resource[:project_name] opts << "--project=#{@resource[:project_name]}" elsif @resource[:project_id] opts << "--project=#{@resource[:project_id]}" @@ -122,7 +117,6 @@ Puppet::Type.type(:neutron_port).provide( :name => port[:name], :id => port[:id], :status => port[:status], - :tenant_id => port[:project_id], :project_id => port[:project_id], :network_id => port[:network_id], :network_name => self.class.get_network_name(port[:network_id]), @@ -217,8 +211,6 @@ Puppet::Type.type(:neutron_port).provide( :ip_address, :project_id, :project_name, - :tenant_id, - :tenant_name, ].each do |attr| define_method(attr.to_s + "=") do |value| fail("Property #{attr.to_s} does not support being updated") diff --git a/lib/puppet/provider/neutron_router/openstack.rb b/lib/puppet/provider/neutron_router/openstack.rb index c07634cdf..11e3f61dd 100644 --- a/lib/puppet/provider/neutron_router/openstack.rb +++ b/lib/puppet/provider/neutron_router/openstack.rb @@ -41,7 +41,6 @@ Puppet::Type.type(:neutron_router).provide( :status => router[:status], :distributed => router[:distributed], :ha => router[:ha], - :tenant_id => router[:project_id], :project_id => router[:project_id], :availability_zone_hint => parse_availability_zone_hint(router[:availability_zone_hints]) ) @@ -74,11 +73,7 @@ Puppet::Type.type(:neutron_router).provide( opts << '--disable' end - if @resource[:tenant_name] - opts << "--project=#{@resource[:tenant_name]}" - elsif @resource[:tenant_id] - opts << "--project=#{@resource[:tenant_id]}" - elsif @resource[:project_name] + if @resource[:project_name] opts << "--project=#{@resource[:project_name]}" elsif @resource[:project_id] opts << "--project=#{@resource[:project_id]}" @@ -128,7 +123,6 @@ Puppet::Type.type(:neutron_router).provide( :status => router[:status], :distributed => router[:distributed], :ha => router[:ha], - :tenant_id => router[:project_id], :project_id => router[:project_id], :availability_zone_hint => self.class.parse_availability_zone_hint(router[:availability_zone_hints]) } @@ -213,8 +207,6 @@ Puppet::Type.type(:neutron_router).provide( [ :availability_zone_hint, - :tenant_id, - :tenant_name, :project_id, :project_name ].each do |attr| diff --git a/lib/puppet/provider/neutron_subnet/openstack.rb b/lib/puppet/provider/neutron_subnet/openstack.rb index b538366d5..d712aef94 100644 --- a/lib/puppet/provider/neutron_subnet/openstack.rb +++ b/lib/puppet/provider/neutron_subnet/openstack.rb @@ -47,7 +47,6 @@ Puppet::Type.type(:neutron_subnet).provide( :enable_dhcp => subnet[:enable_dhcp], :network_id => subnet[:network_id], :network_name => get_network_name(subnet[:network_id]), - :tenant_id => subnet[:project_id], :project_id => subnet[:project_id], ) end @@ -159,11 +158,7 @@ Puppet::Type.type(:neutron_subnet).provide( end end - if @resource[:tenant_name] - opts << "--project=#{@resource[:tenant_name]}" - elsif @resource[:tenant_id] - opts << "--project=#{@resource[:tenant_id]}" - elsif @resource[:project_name] + if @resource[:project_name] opts << "--project=#{@resource[:project_name]}" elsif @resource[:project_id] opts << "--project=#{@resource[:project_id]}" @@ -193,7 +188,6 @@ Puppet::Type.type(:neutron_subnet).provide( :enable_dhcp => subnet[:enable_dhcp], :network_id => subnet[:network_id], :network_name => self.class.get_network_name(subnet[:network_id]), - :tenant_id => subnet[:project_id], :project_id => subnet[:project_id], } end @@ -280,8 +274,6 @@ Puppet::Type.type(:neutron_subnet).provide( :ipv6_ra_mode, :ipv6_address_mode, :network_id, - :tenant_id, - :tenant_name, :project_id, :project_name, ].each do |attr| diff --git a/lib/puppet/type/neutron_network.rb b/lib/puppet/type/neutron_network.rb index ce6277cb2..dca419193 100644 --- a/lib/puppet/type/neutron_network.rb +++ b/lib/puppet/type/neutron_network.rb @@ -40,14 +40,6 @@ Puppet::Type.newtype(:neutron_network) do desc 'A uuid identifying the project which will own the network.' end - newparam(:tenant_name) do - desc 'The name of the tenant which will own the network.(DEPRECATED)' - end - - newproperty(:tenant_id) do - desc 'A uuid identifying the tenant which will own the network.(DEPRECATED)' - end - newproperty(:provider_network_type) do desc 'The physical mechanism by which the virtual network is realized.' newvalues(:flat, :vlan, :local, :gre, :l3_ext, :vxlan) @@ -95,11 +87,7 @@ Puppet::Type.newtype(:neutron_network) do end autorequire(:keystone_tenant) do - if self[:tenant_name] - [self[:tenant_name]] - else - [self[:project_name]] if self[:project_name] - end + [self[:project_name]] if self[:project_name] end validate do @@ -107,16 +95,7 @@ Puppet::Type.newtype(:neutron_network) do return end - if self[:tenant_id] - warning('The tenant_id property is deprecated. Use project_id.') - end - if self[:tenant_name] - warning('The tenant_name property is deprecated. Use project_name.') - end - - project_id = self[:tenant_id] or self[:project_id] - project_name = self[:tenant_name] or self[:project_name] - if project_id && project_name + if self[:project_id] && self[:project_name] raise(Puppet::Error, <<-EOT Please provide a value for only one of project_name and project_id. EOT diff --git a/lib/puppet/type/neutron_port.rb b/lib/puppet/type/neutron_port.rb index 4c8998112..45c6a3aa0 100644 --- a/lib/puppet/type/neutron_port.rb +++ b/lib/puppet/type/neutron_port.rb @@ -74,14 +74,6 @@ Puppet::Type.newtype(:neutron_port) do desc 'A uuid identifying the project which will own the port.' end - newparam(:tenant_name) do - desc 'The name of the tenant which will own the port.(DEPRECATED)' - end - - newproperty(:tenant_id) do - desc 'A uuid identifying the tenant which will own the port.(DEPRECATED)' - end - newproperty(:binding_host_id) do desc 'A uuid identifying the host where we will bind the port.' end @@ -101,11 +93,7 @@ Puppet::Type.newtype(:neutron_port) do end autorequire(:keystone_tenant) do - if self[:tenant_name] - [self[:tenant_name]] - else - [self[:project_name]] if self[:project_name] - end + [self[:project_name]] if self[:project_name] end autorequire(:neutron_network) do @@ -117,16 +105,7 @@ Puppet::Type.newtype(:neutron_port) do end validate do - if self[:tenant_id] - warning('The tenant_id property is deprecated. Use project_id.') - end - if self[:tenant_name] - warning('The tenant_name property is deprecated. Use project_name.') - end - - project_id = self[:tenant_id] or self[:project_id] - project_name = self[:tenant_name] or self[:project_name] - if project_id && project_name + if self[:project_id] && self[:project_name] raise(Puppet::Error, <<-EOT Please provide a value for only one of project_name and project_id. EOT diff --git a/lib/puppet/type/neutron_router.rb b/lib/puppet/type/neutron_router.rb index 33b5cbd6b..c44c5cda2 100644 --- a/lib/puppet/type/neutron_router.rb +++ b/lib/puppet/type/neutron_router.rb @@ -64,24 +64,12 @@ Puppet::Type.newtype(:neutron_router) do desc 'A uuid identifying the project which will own the router.' end - newparam(:tenant_name) do - desc 'The name of the tenant which will own the router.(DEPRECATED)' - end - - newproperty(:tenant_id) do - desc 'A uuid identifying the tenant which will own the router.(DEPRECATED)' - end - autorequire(:anchor) do ['neutron::service::end'] end autorequire(:keystone_tenant) do - if self[:tenant_name] - [self[:tenant_name]] - else - [self[:project_name]] if self[:project_name] - end + [self[:project_name]] if self[:project_name] end autorequire(:neutron_network) do @@ -113,16 +101,7 @@ Puppet::Type.newtype(:neutron_router) do return end - if self[:tenant_id] - warning('The tenant_id property is deprecated. Use project_id.') - end - if self[:tenant_name] - warning('The tenant_name property is deprecated. Use project_name.') - end - - project_id = self[:tenant_id] or self[:project_id] - project_name = self[:tenant_name] or self[:project_name] - if project_id && project_name + if self[:project_id] && self[:project_name] raise(Puppet::Error, <<-EOT Please provide a value for only one of project_name and project_id. EOT diff --git a/lib/puppet/type/neutron_subnet.rb b/lib/puppet/type/neutron_subnet.rb index 778206151..1b7acab54 100644 --- a/lib/puppet/type/neutron_subnet.rb +++ b/lib/puppet/type/neutron_subnet.rb @@ -88,24 +88,12 @@ Puppet::Type.newtype(:neutron_subnet) do desc 'A uuid identifying the project which will own the subnet.' end - newparam(:tenant_name) do - desc 'The name of the tenant which will own the subnet.(DEPRECATED)' - end - - newproperty(:tenant_id) do - desc 'A uuid identifying the tenant which will own the subnet.(DEPRECATED)' - end - autorequire(:anchor) do ['neutron::service::end'] end autorequire(:keystone_tenant) do - if self[:tenant_name] - [self[:tenant_name]] - else - [self[:project_name]] if self[:project_name] - end + [self[:project_name]] if self[:project_name] end autorequire(:neutron_network) do @@ -135,16 +123,7 @@ EOT ) end - if self[:tenant_id] - warning('The tenant_id property is deprecated. Use project_id.') - end - if self[:tenant_name] - warning('The tenant_name property is deprecated. Use project_name.') - end - - project_id = self[:tenant_id] or self[:project_id] - project_name = self[:tenant_name] or self[:project_name] - if project_id && project_name + if self[:project_id] && self[:project_name] raise(Puppet::Error, <<-EOT Please provide a value for only one of project_name and project_id. EOT diff --git a/releasenotes/notes/remove-tenant-params-63c23e81474b220e.yaml b/releasenotes/notes/remove-tenant-params-63c23e81474b220e.yaml new file mode 100644 index 000000000..e530a1d73 --- /dev/null +++ b/releasenotes/notes/remove-tenant-params-63c23e81474b220e.yaml @@ -0,0 +1,11 @@ +--- +upgrade: + - | + The ``tenant_name`` property and the ``tenant_id`` property of the resource + types below have been removed. + + - ``neutron_network`` + - ``neutron_subnet`` + - ``neutron_port`` + - ``neutron_router`` + diff --git a/spec/unit/provider/neutron_network/openstack_spec.rb b/spec/unit/provider/neutron_network/openstack_spec.rb index 5880912da..f1a88ab09 100644 --- a/spec/unit/provider/neutron_network/openstack_spec.rb +++ b/spec/unit/provider/neutron_network/openstack_spec.rb @@ -53,7 +53,7 @@ mtu="1500"') provider.create expect(provider.exists?).to be_truthy expect(provider.admin_state_up).to eq('True') - expect(provider.tenant_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') + expect(provider.project_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') expect(provider.router_external).to eq('False') expect(provider.shared).to eq('False') expect(provider.mtu).to eq('1500') @@ -112,12 +112,12 @@ mtu="1500"') end end - context 'with tenant_name' do + context 'with project_name' do let :net_attrs do { - :name => net_name, - :ensure => 'present', - :tenant_name => 'openstack', + :name => net_name, + :ensure => 'present', + :project_name => 'openstack', } end @@ -322,14 +322,14 @@ mtu="9000"') expect(instances[0].name).to eq('net1') expect(instances[0].admin_state_up).to eq('True') expect(instances[0].router_external).to eq('False') - expect(instances[0].tenant_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') + expect(instances[0].project_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') expect(instances[0].shared).to eq('False') expect(instances[0].mtu).to eq('1500') expect(instances[1].id).to eq('34e8f42b-89db-4a5b-92db-76ca7073414d') expect(instances[1].name).to eq('net2') expect(instances[1].admin_state_up).to eq('False') - expect(instances[1].tenant_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') + expect(instances[1].project_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') expect(instances[1].router_external).to eq('True') expect(instances[1].shared).to eq('True') expect(instances[1].mtu).to eq('9000') diff --git a/spec/unit/provider/neutron_port/openstack_spec.rb b/spec/unit/provider/neutron_port/openstack_spec.rb index c70324bac..30badd8ae 100644 --- a/spec/unit/provider/neutron_port/openstack_spec.rb +++ b/spec/unit/provider/neutron_port/openstack_spec.rb @@ -317,7 +317,7 @@ status="DOWN"') expect(instances[0].subnet_name).to eq('subnet1') expect(instances[0].status).to eq('ACTIVE') expect(instances[0].admin_state_up).to eq('True') - expect(instances[0].tenant_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') + expect(instances[0].project_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') expect(instances[1].id).to eq('c880affb-b15e-4632-b5e7-3adba6e3ab35') expect(instances[1].name).to eq('port2') @@ -327,7 +327,7 @@ status="DOWN"') expect(instances[1].subnet_name).to eq('subnet2') expect(instances[1].status).to eq('DOWN') expect(instances[1].admin_state_up).to eq('False') - expect(instances[0].tenant_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') + expect(instances[0].project_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') end end end diff --git a/spec/unit/provider/neutron_subnet/openstack_spec.rb b/spec/unit/provider/neutron_subnet/openstack_spec.rb index b832276b1..811af4ed2 100644 --- a/spec/unit/provider/neutron_subnet/openstack_spec.rb +++ b/spec/unit/provider/neutron_subnet/openstack_spec.rb @@ -294,7 +294,7 @@ project_id="60f9544eb94c42a6b7e8e98c2be981b1"') expect(instances[0].gateway_ip).to eq('10.0.0.1') expect(instances[0].allocation_pools).to eq(['start=10.0.0.2,end=10.0.0.254']) expect(instances[0].enable_dhcp).to eq('True') - expect(instances[0].tenant_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') + expect(instances[0].project_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') expect(instances[1].id).to eq('0da7a631-0f8f-4e51-8b1c-7a29d0d4f7b5') expect(instances[1].name).to eq('subnet2') @@ -305,7 +305,7 @@ project_id="60f9544eb94c42a6b7e8e98c2be981b1"') expect(instances[1].cidr).to eq('10.0.1.0/24') expect(instances[1].allocation_pools).to eq(['start=10.0.1.2,end=10.0.1.254']) expect(instances[1].enable_dhcp).to eq('False') - expect(instances[1].tenant_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') + expect(instances[1].project_id).to eq('60f9544eb94c42a6b7e8e98c2be981b1') end end end