Merge "Deprecate tenant_* properties"
This commit is contained in:
commit
3d03306ae4
@ -43,6 +43,7 @@ Puppet::Type.type(:neutron_network).provide(
|
||||
: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])
|
||||
)
|
||||
end
|
||||
@ -82,6 +83,10 @@ Puppet::Type.type(:neutron_network).provide(
|
||||
opts << "--project=#{@resource[:tenant_name]}"
|
||||
elsif @resource[:tenant_id]
|
||||
opts << "--project=#{@resource[:tenant_id]}"
|
||||
elsif @resource[:project_name]
|
||||
opts << "--project=#{@resource[:project_name]}"
|
||||
elsif @resource[:project_id]
|
||||
opts << "--project=#{@resource[:project_id]}"
|
||||
end
|
||||
|
||||
if @resource[:provider_network_type]
|
||||
@ -121,6 +126,7 @@ Puppet::Type.type(:neutron_network).provide(
|
||||
: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])
|
||||
}
|
||||
end
|
||||
@ -187,6 +193,8 @@ Puppet::Type.type(:neutron_network).provide(
|
||||
:provider_segmentation_id,
|
||||
:tenant_id,
|
||||
:tenant_name,
|
||||
:project_id,
|
||||
:project_name,
|
||||
].each do |attr|
|
||||
define_method(attr.to_s + "=") do |value|
|
||||
fail("Property #{attr.to_s} does not support being updated")
|
||||
|
@ -39,6 +39,7 @@ Puppet::Type.type(:neutron_port).provide(
|
||||
: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]),
|
||||
:admin_state_up => port[:admin_state_up],
|
||||
@ -99,6 +100,10 @@ Puppet::Type.type(:neutron_port).provide(
|
||||
opts << "--project=#{@resource[:tenant_name]}"
|
||||
elsif @resource[:tenant_id]
|
||||
opts << "--project=#{@resource[:tenant_id]}"
|
||||
elsif @resource[:project_name]
|
||||
opts << "--project=#{@resource[:project_name]}"
|
||||
elsif @resource[:project_id]
|
||||
opts << "--project=#{@resource[:project_id]}"
|
||||
end
|
||||
|
||||
if @resource[:binding_host_id]
|
||||
@ -118,6 +123,7 @@ Puppet::Type.type(:neutron_port).provide(
|
||||
: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]),
|
||||
:admin_state_up => port[:admin_state_up],
|
||||
@ -209,6 +215,8 @@ Puppet::Type.type(:neutron_port).provide(
|
||||
:network_id,
|
||||
:subnet_id,
|
||||
:ip_address,
|
||||
:project_id,
|
||||
:project_name,
|
||||
:tenant_id,
|
||||
:tenant_name,
|
||||
].each do |attr|
|
||||
|
@ -42,6 +42,7 @@ Puppet::Type.type(:neutron_router).provide(
|
||||
: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])
|
||||
)
|
||||
end
|
||||
@ -77,6 +78,10 @@ Puppet::Type.type(:neutron_router).provide(
|
||||
opts << "--project=#{@resource[:tenant_name]}"
|
||||
elsif @resource[:tenant_id]
|
||||
opts << "--project=#{@resource[:tenant_id]}"
|
||||
elsif @resource[:project_name]
|
||||
opts << "--project=#{@resource[:project_name]}"
|
||||
elsif @resource[:project_id]
|
||||
opts << "--project=#{@resource[:project_id]}"
|
||||
end
|
||||
|
||||
if @resource[:distributed]
|
||||
@ -124,6 +129,7 @@ Puppet::Type.type(:neutron_router).provide(
|
||||
: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])
|
||||
}
|
||||
end
|
||||
|
@ -48,6 +48,7 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
:network_id => subnet[:network_id],
|
||||
:network_name => get_network_name(subnet[:network_id]),
|
||||
:tenant_id => subnet[:project_id],
|
||||
:project_id => subnet[:project_id],
|
||||
)
|
||||
end
|
||||
self.do_not_manage = false
|
||||
@ -164,6 +165,10 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
opts << "--project=#{@resource[:tenant_name]}"
|
||||
elsif @resource[:tenant_id]
|
||||
opts << "--project=#{@resource[:tenant_id]}"
|
||||
elsif @resource[:project_name]
|
||||
opts << "--project=#{@resource[:project_name]}"
|
||||
elsif @resource[:project_id]
|
||||
opts << "--project=#{@resource[:project_id]}"
|
||||
end
|
||||
|
||||
if @resource[:network_name]
|
||||
@ -191,6 +196,7 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
: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
|
||||
|
||||
@ -277,6 +283,9 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
:ipv6_address_mode,
|
||||
:network_id,
|
||||
:tenant_id,
|
||||
:tenant_name,
|
||||
:project_id,
|
||||
:project_name,
|
||||
].each do |attr|
|
||||
define_method(attr.to_s + "=") do |value|
|
||||
fail("Property #{attr.to_s} does not support being updated")
|
||||
|
@ -32,12 +32,20 @@ Puppet::Type.newtype(:neutron_network) do
|
||||
end
|
||||
end
|
||||
|
||||
newparam(:project_name) do
|
||||
desc 'The name of the project which will own the network.(DEPRECATED)'
|
||||
end
|
||||
|
||||
newproperty(:project_id) do
|
||||
desc 'A uuid identifying the project which will own the network.(DEPRECATED)'
|
||||
end
|
||||
|
||||
newparam(:tenant_name) do
|
||||
desc 'The name of the tenant which will own the network.'
|
||||
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.'
|
||||
desc 'A uuid identifying the tenant which will own the network.(DEPRECATED)'
|
||||
end
|
||||
|
||||
newproperty(:provider_network_type) do
|
||||
@ -79,16 +87,30 @@ Puppet::Type.newtype(:neutron_network) do
|
||||
end
|
||||
|
||||
autorequire(:keystone_tenant) do
|
||||
[self[:tenant_name]] if self[:tenant_name]
|
||||
if self[:tenant_name]
|
||||
[self[:tenant_name]]
|
||||
else
|
||||
[self[:project_name]] if self[:project_name]
|
||||
end
|
||||
end
|
||||
|
||||
validate do
|
||||
if self[:ensure] != :present
|
||||
return
|
||||
end
|
||||
if self[:tenant_id] && self[:tenant_name]
|
||||
|
||||
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_id.')
|
||||
end
|
||||
|
||||
project_id = self[:tenant_id] or self[:project_id]
|
||||
project_name = self[:tenant_name] or self[:project_name]
|
||||
if project_id && project_name
|
||||
raise(Puppet::Error, <<-EOT
|
||||
Please provide a value for only one of tenant_name and tenant_id.
|
||||
Please provide a value for only one of project_name and project_id.
|
||||
EOT
|
||||
)
|
||||
end
|
||||
|
@ -66,12 +66,20 @@ Puppet::Type.newtype(:neutron_port) do
|
||||
end
|
||||
end
|
||||
|
||||
newparam(:project_name) do
|
||||
desc 'The name of the project which will own the port.'
|
||||
end
|
||||
|
||||
newproperty(:project_id) 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.'
|
||||
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.'
|
||||
desc 'A uuid identifying the tenant which will own the port.(DEPRECATED)'
|
||||
end
|
||||
|
||||
newproperty(:binding_host_id) do
|
||||
@ -93,7 +101,11 @@ Puppet::Type.newtype(:neutron_port) do
|
||||
end
|
||||
|
||||
autorequire(:keystone_tenant) do
|
||||
[self[:tenant_name]] if self[:tenant_name]
|
||||
if self[:tenant_name]
|
||||
[self[:tenant_name]]
|
||||
else
|
||||
[self[:project_name]] if self[:project_name]
|
||||
end
|
||||
end
|
||||
|
||||
autorequire(:neutron_network) do
|
||||
@ -105,9 +117,22 @@ Puppet::Type.newtype(:neutron_port) do
|
||||
end
|
||||
|
||||
validate do
|
||||
if self[:tenant_id] && self[:tenant_name]
|
||||
raise(Puppet::Error, 'Please provide a value for only one of tenant_name and tenant_id.')
|
||||
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_id.')
|
||||
end
|
||||
|
||||
project_id = self[:tenant_id] or self[:project_id]
|
||||
project_name = self[:tenant_name] or self[:project_name]
|
||||
if project_id && project_name
|
||||
raise(Puppet::Error, <<-EOT
|
||||
Please provide a value for only one of project_name and project_id.
|
||||
EOT
|
||||
)
|
||||
end
|
||||
|
||||
if self[:ip_address] && self[:subnet_name]
|
||||
raise(Puppet::Error, 'Please provide a value for only one of ip_address and subnet_name.')
|
||||
end
|
||||
|
@ -56,12 +56,20 @@ Puppet::Type.newtype(:neutron_router) do
|
||||
end
|
||||
end
|
||||
|
||||
newparam(:project_name) do
|
||||
desc 'The name of the project which will own the router.'
|
||||
end
|
||||
|
||||
newproperty(:project_id) 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.'
|
||||
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.'
|
||||
desc 'A uuid identifying the tenant which will own the router.(DEPRECATED)'
|
||||
end
|
||||
|
||||
autorequire(:anchor) do
|
||||
@ -69,7 +77,11 @@ Puppet::Type.newtype(:neutron_router) do
|
||||
end
|
||||
|
||||
autorequire(:keystone_tenant) do
|
||||
[self[:tenant_name]] if self[:tenant_name]
|
||||
if self[:tenant_name]
|
||||
[self[:tenant_name]]
|
||||
else
|
||||
[self[:project_name]] if self[:project_name]
|
||||
end
|
||||
end
|
||||
|
||||
autorequire(:neutron_network) do
|
||||
@ -100,9 +112,19 @@ Puppet::Type.newtype(:neutron_router) do
|
||||
if self[:ensure] != :present
|
||||
return
|
||||
end
|
||||
if self[:tenant_id] && self[:tenant_name]
|
||||
|
||||
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_id.')
|
||||
end
|
||||
|
||||
project_id = self[:tenant_id] or self[:project_id]
|
||||
project_name = self[:tenant_name] or self[:project_name]
|
||||
if project_id && project_name
|
||||
raise(Puppet::Error, <<-EOT
|
||||
Please provide a value for only one of tenant_name and tenant_id.
|
||||
Please provide a value for only one of project_name and project_id.
|
||||
EOT
|
||||
)
|
||||
end
|
||||
|
@ -80,12 +80,20 @@ Puppet::Type.newtype(:neutron_subnet) do
|
||||
desc 'The name of the network this subnet is associated with.'
|
||||
end
|
||||
|
||||
newparam(:project_name) do
|
||||
desc 'The name of the project which will own the subnet.(DEPRECATED)'
|
||||
end
|
||||
|
||||
newproperty(:project_id) do
|
||||
desc 'A uuid identifying the project which will own the subnet.(DEPRECATED)'
|
||||
end
|
||||
|
||||
newparam(:tenant_name) do
|
||||
desc 'The name of the tenant which will own the subnet.'
|
||||
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.'
|
||||
desc 'A uuid identifying the tenant which will own the subnet.(DEPRECATED)'
|
||||
end
|
||||
|
||||
autorequire(:anchor) do
|
||||
@ -93,7 +101,11 @@ Puppet::Type.newtype(:neutron_subnet) do
|
||||
end
|
||||
|
||||
autorequire(:keystone_tenant) do
|
||||
[self[:tenant_name]] if self[:tenant_name]
|
||||
if self[:tenant_name]
|
||||
[self[:tenant_name]]
|
||||
else
|
||||
[self[:project_name]] if self[:project_name]
|
||||
end
|
||||
end
|
||||
|
||||
autorequire(:neutron_network) do
|
||||
@ -104,24 +116,41 @@ Puppet::Type.newtype(:neutron_subnet) do
|
||||
if self[:ensure] != :present
|
||||
return
|
||||
end
|
||||
|
||||
if ! self[:cidr]
|
||||
raise(Puppet::Error, 'Please provide a valid CIDR')
|
||||
elsif ! (self[:network_id] || self[:network_name])
|
||||
end
|
||||
|
||||
if ! (self[:network_id] || self[:network_name])
|
||||
raise(Puppet::Error, <<-EOT
|
||||
A value for one of network_name or network_id must be provided.
|
||||
EOT
|
||||
)
|
||||
elsif self[:network_id] && self[:network_name]
|
||||
end
|
||||
|
||||
if self[:network_id] && self[:network_name]
|
||||
raise(Puppet::Error, <<-EOT
|
||||
Please provide a value for only one of network_name and network_id.
|
||||
EOT
|
||||
)
|
||||
elsif self[:tenant_id] && self[:tenant_name]
|
||||
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_id.')
|
||||
end
|
||||
|
||||
project_id = self[:tenant_id] or self[:project_id]
|
||||
project_name = self[:tenant_name] or self[:project_name]
|
||||
if project_id && project_name
|
||||
raise(Puppet::Error, <<-EOT
|
||||
Please provide a value for only one of tenant_name and tenant_id.
|
||||
Please provide a value for only one of project_name and project_id.
|
||||
EOT
|
||||
)
|
||||
end
|
||||
|
||||
if (self[:ipv6_ra_mode] || self[:ipv6_address_mode]) && String(self[:ip_version]) != '6'
|
||||
raise(Puppet::Error, <<-EOT
|
||||
ipv6_ra_mode and ipv6_address_mode can only be used with ip_version set to '6'
|
||||
|
@ -0,0 +1,11 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
The ``tenant_name`` property and the ``tenant_id`` property of the resource
|
||||
types below have been deprecated and will be removed in a future release.
|
||||
Use the ``project_name`` property and the ``project_id`` property instead.
|
||||
|
||||
- ``neutron_network``
|
||||
- ``neutron_subnet``
|
||||
- ``neutron_port``
|
||||
- ``neutron_router``
|
Loading…
x
Reference in New Issue
Block a user