Deprecate tenant and ignore_default_tenant params
Keystone no longer supports tenant/project as a property of user entries and is deprecating it, so we will also deprecate it. Change-Id: I1827724a484eb62c3fc2f4411429b45eac4e6f25 Closes-bug: 1472437
This commit is contained in:
parent
b7739985e7
commit
5797e71f99
@ -36,13 +36,8 @@ Puppet::Type.type(:keystone_user).provide(
|
|||||||
@property_hash = self.class.request('user', 'create', properties)
|
@property_hash = self.class.request('user', 'create', properties)
|
||||||
@property_hash[:domain] = user_domain
|
@property_hash[:domain] = user_domain
|
||||||
if resource[:tenant]
|
if resource[:tenant]
|
||||||
# TODO: Deprecate the tenant parameter. Keystone no longer supports
|
# DEPRECATED - To be removed in next release (Liberty)
|
||||||
# tenant/project as a property of user entries and is deprecating it.
|
|
||||||
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
||||||
# Keystone has already removed the ability for user create --project
|
|
||||||
# $project to add the user as a member of the project. However, to
|
|
||||||
# support current manifests that depend on this behavior, implement
|
|
||||||
# that feature here.
|
|
||||||
project_id = Puppet::Resource.indirection.find("Keystone_tenant/#{resource[:tenant]}")[:id]
|
project_id = Puppet::Resource.indirection.find("Keystone_tenant/#{resource[:tenant]}")[:id]
|
||||||
set_project(resource[:tenant], project_id)
|
set_project(resource[:tenant], project_id)
|
||||||
end
|
end
|
||||||
@ -145,11 +140,8 @@ Puppet::Type.type(:keystone_user).provide(
|
|||||||
end
|
end
|
||||||
|
|
||||||
def find_project_for_user(projname, project_id = nil)
|
def find_project_for_user(projname, project_id = nil)
|
||||||
# TODO deprecate tenant - see above in create
|
# DEPRECATED - To be removed in next release (Liberty)
|
||||||
# If the user list command doesn't report the project, it might still be there
|
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
||||||
# We don't need to know exactly what it is, we just need to know whether it's
|
|
||||||
# the one we're trying to set.
|
|
||||||
# if no domain specified in project name, use user's domain as the default
|
|
||||||
user_name, user_domain = self.class.name_and_domain(resource[:name], resource[:domain])
|
user_name, user_domain = self.class.name_and_domain(resource[:name], resource[:domain])
|
||||||
project_name, project_domain = self.class.name_and_domain(projname, nil, user_domain)
|
project_name, project_domain = self.class.name_and_domain(projname, nil, user_domain)
|
||||||
self.class.request('project', 'list', ['--user', id, '--long']).each do |project|
|
self.class.request('project', 'list', ['--user', id, '--long']).each do |project|
|
||||||
@ -162,7 +154,8 @@ Puppet::Type.type(:keystone_user).provide(
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_project(newproject, project_id = nil)
|
def set_project(newproject, project_id = nil)
|
||||||
# TODO deprecate tenant - see above in create
|
# DEPRECATED - To be removed in next release (Liberty)
|
||||||
|
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
||||||
unless project_id
|
unless project_id
|
||||||
project_id = Puppet::Resource.indirection.find("Keystone_tenant/#{newproject}")[:id]
|
project_id = Puppet::Resource.indirection.find("Keystone_tenant/#{newproject}")[:id]
|
||||||
end
|
end
|
||||||
@ -183,13 +176,15 @@ Puppet::Type.type(:keystone_user).provide(
|
|||||||
newproject
|
newproject
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# DEPRECATED - To be removed in next release (Liberty)
|
||||||
|
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
||||||
def tenant=(value)
|
def tenant=(value)
|
||||||
# TODO deprecate tenant - see above in create
|
|
||||||
@property_hash[:tenant] = set_project(value)
|
@property_hash[:tenant] = set_project(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# DEPRECATED - To be removed in next release (Liberty)
|
||||||
|
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
||||||
def tenant
|
def tenant
|
||||||
# TODO deprecate tenant - see above in create
|
|
||||||
return resource[:tenant] if sym_to_bool(resource[:ignore_default_tenant])
|
return resource[:tenant] if sym_to_bool(resource[:ignore_default_tenant])
|
||||||
# use the one returned from instances
|
# use the one returned from instances
|
||||||
tenant_name = @property_hash[:project]
|
tenant_name = @property_hash[:project]
|
||||||
|
@ -15,9 +15,11 @@ Puppet::Type.newtype(:keystone_user) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
newparam(:ignore_default_tenant) do
|
newparam(:ignore_default_tenant) do
|
||||||
# TODO: Deprecate the tenant parameter. Keystone no longer supports
|
# DEPRECATED - To be removed in next release (Liberty)
|
||||||
# tenant/project as a property of user entries and is deprecating it.
|
|
||||||
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
||||||
|
validate do |v|
|
||||||
|
Puppet.warning('The ignore_default_tenant parameter is deprecated and will be removed in the future.')
|
||||||
|
end
|
||||||
newvalues(/(t|T)rue/, /(f|F)alse/, true, false)
|
newvalues(/(t|T)rue/, /(f|F)alse/, true, false)
|
||||||
defaultto(false)
|
defaultto(false)
|
||||||
munge do |value|
|
munge do |value|
|
||||||
@ -53,9 +55,11 @@ Puppet::Type.newtype(:keystone_user) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
newproperty(:tenant) do
|
newproperty(:tenant) do
|
||||||
# TODO: Deprecate the tenant parameter. Keystone no longer supports
|
# DEPRECATED - To be removed in next release (Liberty)
|
||||||
# tenant/project as a property of user entries and is deprecating it.
|
|
||||||
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
||||||
|
validate do |v|
|
||||||
|
Puppet.warning('The tenant parameter is deprecated and will be removed in the future. Please use keystone_user_role to assign a user to a project.')
|
||||||
|
end
|
||||||
newvalues(/\S+/)
|
newvalues(/\S+/)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -86,8 +90,7 @@ Puppet::Type.newtype(:keystone_user) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
autorequire(:keystone_tenant) do
|
autorequire(:keystone_tenant) do
|
||||||
# TODO: Deprecate the tenant parameter. Keystone no longer supports
|
# DEPRECATED - To be removed in next release (Liberty)
|
||||||
# tenant/project as a property of user entries and is deprecating it.
|
|
||||||
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
# https://bugs.launchpad.net/puppet-keystone/+bug/1472437
|
||||||
self[:tenant]
|
self[:tenant]
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user