84 lines
2.9 KiB
Ruby
Raw Normal View History

Add composite namevar for tenant, user, user_role. There are two sides on this patch, the user facing one, and the developer's one. It gives more flexibility for the interface used by the user for the Keystone_tenant, Keystone_user and Keystone_user_roles resources. For instance to specify a user and give the admin role, currently you have to: keystone_user { 'new_admin::admin_domain': ensure => present, enabled => true, tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin::admin_domain@openstackv3::admin_domain': ensure => present, roles => ['admin'], } Now you can specify it like this: keystone_user { 'new_admin': ensure => present, enabled => true, domain => 'admin_domain', tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin@openstackv3': ensure => present, user_domain => 'admin_domain', project_domain => 'admin_domain', roles => ['admin'], } For the developer this simplify the code. Puppet is using composite namevar to make all the resources unique. So guessing what pattern is used in the title is no longer required. For instance this : keystone_tenant { 'project_one': ensure => present } keystone_tenant { 'meaningless': name => 'project_one', domain => 'Default', ensure => present } is detected as the same tenant by puppet. The same is true for dependencies. This is working correctly: keystone_tenant { 'meaningless': name => 'project_one', domain => 'domain_one', ensure => present } file {'/tmp/needed': ensure => present, require => Keystone_tenant['project_one::domain_one'] } In autorequire term in type definition, you just have to pass the fully qualified name (with the domain suffix for user and tenant) of the resource and puppet will do the matching, whatever the original title is. See the examples in user and tenant in keystone_user_role type. Change-Id: I4deb27dc6f71fb7a7ec6a9c72bd0e1412c2e9a30
2015-09-23 20:17:31 +02:00
require 'spec_helper_acceptance'
describe 'basic keystone server with changed domain id' do
after(:context) do
clean_up_manifest = <<-EOM
include ::openstack_integration::keystone
Add composite namevar for tenant, user, user_role. There are two sides on this patch, the user facing one, and the developer's one. It gives more flexibility for the interface used by the user for the Keystone_tenant, Keystone_user and Keystone_user_roles resources. For instance to specify a user and give the admin role, currently you have to: keystone_user { 'new_admin::admin_domain': ensure => present, enabled => true, tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin::admin_domain@openstackv3::admin_domain': ensure => present, roles => ['admin'], } Now you can specify it like this: keystone_user { 'new_admin': ensure => present, enabled => true, domain => 'admin_domain', tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin@openstackv3': ensure => present, user_domain => 'admin_domain', project_domain => 'admin_domain', roles => ['admin'], } For the developer this simplify the code. Puppet is using composite namevar to make all the resources unique. So guessing what pattern is used in the title is no longer required. For instance this : keystone_tenant { 'project_one': ensure => present } keystone_tenant { 'meaningless': name => 'project_one', domain => 'Default', ensure => present } is detected as the same tenant by puppet. The same is true for dependencies. This is working correctly: keystone_tenant { 'meaningless': name => 'project_one', domain => 'domain_one', ensure => present } file {'/tmp/needed': ensure => present, require => Keystone_tenant['project_one::domain_one'] } In autorequire term in type definition, you just have to pass the fully qualified name (with the domain suffix for user and tenant) of the resource and puppet will do the matching, whatever the original title is. See the examples in user and tenant in keystone_user_role type. Change-Id: I4deb27dc6f71fb7a7ec6a9c72bd0e1412c2e9a30
2015-09-23 20:17:31 +02:00
keystone_config { 'identity/default_domain_id': ensure => absent}
EOM
apply_manifest(clean_up_manifest, :catch_failures => true)
end
context 'new domain id' do
let(:pp) do
<<-EOM
include ::openstack_integration
include ::openstack_integration::repos
include ::openstack_integration::mysql
Add composite namevar for tenant, user, user_role. There are two sides on this patch, the user facing one, and the developer's one. It gives more flexibility for the interface used by the user for the Keystone_tenant, Keystone_user and Keystone_user_roles resources. For instance to specify a user and give the admin role, currently you have to: keystone_user { 'new_admin::admin_domain': ensure => present, enabled => true, tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin::admin_domain@openstackv3::admin_domain': ensure => present, roles => ['admin'], } Now you can specify it like this: keystone_user { 'new_admin': ensure => present, enabled => true, domain => 'admin_domain', tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin@openstackv3': ensure => present, user_domain => 'admin_domain', project_domain => 'admin_domain', roles => ['admin'], } For the developer this simplify the code. Puppet is using composite namevar to make all the resources unique. So guessing what pattern is used in the title is no longer required. For instance this : keystone_tenant { 'project_one': ensure => present } keystone_tenant { 'meaningless': name => 'project_one', domain => 'Default', ensure => present } is detected as the same tenant by puppet. The same is true for dependencies. This is working correctly: keystone_tenant { 'meaningless': name => 'project_one', domain => 'domain_one', ensure => present } file {'/tmp/needed': ensure => present, require => Keystone_tenant['project_one::domain_one'] } In autorequire term in type definition, you just have to pass the fully qualified name (with the domain suffix for user and tenant) of the resource and puppet will do the matching, whatever the original title is. See the examples in user and tenant in keystone_user_role type. Change-Id: I4deb27dc6f71fb7a7ec6a9c72bd0e1412c2e9a30
2015-09-23 20:17:31 +02:00
class { '::openstack_integration::keystone':
default_domain => 'my_default_domain',
Add composite namevar for tenant, user, user_role. There are two sides on this patch, the user facing one, and the developer's one. It gives more flexibility for the interface used by the user for the Keystone_tenant, Keystone_user and Keystone_user_roles resources. For instance to specify a user and give the admin role, currently you have to: keystone_user { 'new_admin::admin_domain': ensure => present, enabled => true, tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin::admin_domain@openstackv3::admin_domain': ensure => present, roles => ['admin'], } Now you can specify it like this: keystone_user { 'new_admin': ensure => present, enabled => true, domain => 'admin_domain', tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin@openstackv3': ensure => present, user_domain => 'admin_domain', project_domain => 'admin_domain', roles => ['admin'], } For the developer this simplify the code. Puppet is using composite namevar to make all the resources unique. So guessing what pattern is used in the title is no longer required. For instance this : keystone_tenant { 'project_one': ensure => present } keystone_tenant { 'meaningless': name => 'project_one', domain => 'Default', ensure => present } is detected as the same tenant by puppet. The same is true for dependencies. This is working correctly: keystone_tenant { 'meaningless': name => 'project_one', domain => 'domain_one', ensure => present } file {'/tmp/needed': ensure => present, require => Keystone_tenant['project_one::domain_one'] } In autorequire term in type definition, you just have to pass the fully qualified name (with the domain suffix for user and tenant) of the resource and puppet will do the matching, whatever the original title is. See the examples in user and tenant in keystone_user_role type. Change-Id: I4deb27dc6f71fb7a7ec6a9c72bd0e1412c2e9a30
2015-09-23 20:17:31 +02:00
}
Add composite namevar for tenant, user, user_role. There are two sides on this patch, the user facing one, and the developer's one. It gives more flexibility for the interface used by the user for the Keystone_tenant, Keystone_user and Keystone_user_roles resources. For instance to specify a user and give the admin role, currently you have to: keystone_user { 'new_admin::admin_domain': ensure => present, enabled => true, tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin::admin_domain@openstackv3::admin_domain': ensure => present, roles => ['admin'], } Now you can specify it like this: keystone_user { 'new_admin': ensure => present, enabled => true, domain => 'admin_domain', tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin@openstackv3': ensure => present, user_domain => 'admin_domain', project_domain => 'admin_domain', roles => ['admin'], } For the developer this simplify the code. Puppet is using composite namevar to make all the resources unique. So guessing what pattern is used in the title is no longer required. For instance this : keystone_tenant { 'project_one': ensure => present } keystone_tenant { 'meaningless': name => 'project_one', domain => 'Default', ensure => present } is detected as the same tenant by puppet. The same is true for dependencies. This is working correctly: keystone_tenant { 'meaningless': name => 'project_one', domain => 'domain_one', ensure => present } file {'/tmp/needed': ensure => present, require => Keystone_tenant['project_one::domain_one'] } In autorequire term in type definition, you just have to pass the fully qualified name (with the domain suffix for user and tenant) of the resource and puppet will do the matching, whatever the original title is. See the examples in user and tenant in keystone_user_role type. Change-Id: I4deb27dc6f71fb7a7ec6a9c72bd0e1412c2e9a30
2015-09-23 20:17:31 +02:00
keystone_tenant { 'project_in_my_default_domain':
ensure => present,
enabled => true,
description => 'Project in another default domain',
}
keystone_user { 'user_in_my_default_domain':
ensure => present,
enabled => true,
email => 'test@example.tld',
password => 'a_big_secret',
}
keystone_user_role { 'user_in_my_default_domain@project_in_my_default_domain':
ensure => present,
roles => ['admin'],
}
keystone_domain { 'other_domain': ensure => present }
keystone_user { 'user_in_my_default_domain::other_domain':
ensure => present,
enabled => true,
email => 'test@example.tld',
password => 'a_big_secret',
}
keystone_tenant { 'project_in_my_default_domain::other_domain':
ensure => present,
enabled => true,
description => 'Project in other domain',
}
keystone_user_role { 'user_in_my_default_domain@::other_domain':
ensure => present,
user_domain => 'other_domain',
roles => ['admin'],
}
EOM
end
describe 'puppet apply' do
it 'should work with no errors and catch deprecation warning' do
apply_manifest(pp, :catch_failures => true) do |result|
expect(result.stderr)
.to include_regexp([/Puppet::Type::Keystone_tenant::ProviderOpenstack: Support for a resource without the domain.*using 'Default'.*default domain id is '/])
Add composite namevar for tenant, user, user_role. There are two sides on this patch, the user facing one, and the developer's one. It gives more flexibility for the interface used by the user for the Keystone_tenant, Keystone_user and Keystone_user_roles resources. For instance to specify a user and give the admin role, currently you have to: keystone_user { 'new_admin::admin_domain': ensure => present, enabled => true, tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin::admin_domain@openstackv3::admin_domain': ensure => present, roles => ['admin'], } Now you can specify it like this: keystone_user { 'new_admin': ensure => present, enabled => true, domain => 'admin_domain', tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin@openstackv3': ensure => present, user_domain => 'admin_domain', project_domain => 'admin_domain', roles => ['admin'], } For the developer this simplify the code. Puppet is using composite namevar to make all the resources unique. So guessing what pattern is used in the title is no longer required. For instance this : keystone_tenant { 'project_one': ensure => present } keystone_tenant { 'meaningless': name => 'project_one', domain => 'Default', ensure => present } is detected as the same tenant by puppet. The same is true for dependencies. This is working correctly: keystone_tenant { 'meaningless': name => 'project_one', domain => 'domain_one', ensure => present } file {'/tmp/needed': ensure => present, require => Keystone_tenant['project_one::domain_one'] } In autorequire term in type definition, you just have to pass the fully qualified name (with the domain suffix for user and tenant) of the resource and puppet will do the matching, whatever the original title is. See the examples in user and tenant in keystone_user_role type. Change-Id: I4deb27dc6f71fb7a7ec6a9c72bd0e1412c2e9a30
2015-09-23 20:17:31 +02:00
end
end
it 'should be idempotent' do
apply_manifest(pp, :catch_changes => true) do |result|
expect(result.stderr)
.to include_regexp([/Puppet::Type::Keystone_tenant::ProviderOpenstack: Support for a resource without the domain.*using 'Default'.*default domain id is '/])
Add composite namevar for tenant, user, user_role. There are two sides on this patch, the user facing one, and the developer's one. It gives more flexibility for the interface used by the user for the Keystone_tenant, Keystone_user and Keystone_user_roles resources. For instance to specify a user and give the admin role, currently you have to: keystone_user { 'new_admin::admin_domain': ensure => present, enabled => true, tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin::admin_domain@openstackv3::admin_domain': ensure => present, roles => ['admin'], } Now you can specify it like this: keystone_user { 'new_admin': ensure => present, enabled => true, domain => 'admin_domain', tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin@openstackv3': ensure => present, user_domain => 'admin_domain', project_domain => 'admin_domain', roles => ['admin'], } For the developer this simplify the code. Puppet is using composite namevar to make all the resources unique. So guessing what pattern is used in the title is no longer required. For instance this : keystone_tenant { 'project_one': ensure => present } keystone_tenant { 'meaningless': name => 'project_one', domain => 'Default', ensure => present } is detected as the same tenant by puppet. The same is true for dependencies. This is working correctly: keystone_tenant { 'meaningless': name => 'project_one', domain => 'domain_one', ensure => present } file {'/tmp/needed': ensure => present, require => Keystone_tenant['project_one::domain_one'] } In autorequire term in type definition, you just have to pass the fully qualified name (with the domain suffix for user and tenant) of the resource and puppet will do the matching, whatever the original title is. See the examples in user and tenant in keystone_user_role type. Change-Id: I4deb27dc6f71fb7a7ec6a9c72bd0e1412c2e9a30
2015-09-23 20:17:31 +02:00
end
end
end
describe 'puppet resources are successful created' do
it 'for tenant' do
shell('puppet resource keystone_tenant') do |result|
expect(result.stdout)
.to include_regexp([/keystone_tenant { 'project_in_my_default_domain':/,
Add composite namevar for tenant, user, user_role. There are two sides on this patch, the user facing one, and the developer's one. It gives more flexibility for the interface used by the user for the Keystone_tenant, Keystone_user and Keystone_user_roles resources. For instance to specify a user and give the admin role, currently you have to: keystone_user { 'new_admin::admin_domain': ensure => present, enabled => true, tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin::admin_domain@openstackv3::admin_domain': ensure => present, roles => ['admin'], } Now you can specify it like this: keystone_user { 'new_admin': ensure => present, enabled => true, domain => 'admin_domain', tenant => 'openstackv3::admin_domain', email => 'test@example.tld', password => 'a_big_secret', } keystone_user_role { 'new_admin@openstackv3': ensure => present, user_domain => 'admin_domain', project_domain => 'admin_domain', roles => ['admin'], } For the developer this simplify the code. Puppet is using composite namevar to make all the resources unique. So guessing what pattern is used in the title is no longer required. For instance this : keystone_tenant { 'project_one': ensure => present } keystone_tenant { 'meaningless': name => 'project_one', domain => 'Default', ensure => present } is detected as the same tenant by puppet. The same is true for dependencies. This is working correctly: keystone_tenant { 'meaningless': name => 'project_one', domain => 'domain_one', ensure => present } file {'/tmp/needed': ensure => present, require => Keystone_tenant['project_one::domain_one'] } In autorequire term in type definition, you just have to pass the fully qualified name (with the domain suffix for user and tenant) of the resource and puppet will do the matching, whatever the original title is. See the examples in user and tenant in keystone_user_role type. Change-Id: I4deb27dc6f71fb7a7ec6a9c72bd0e1412c2e9a30
2015-09-23 20:17:31 +02:00
/keystone_tenant { 'project_in_my_default_domain::other_domain':/])
end
end
end
end
end