Browse Source

Merge "Clean up remaining items for glance-registry"

changes/71/783171/2
Zuul 8 months ago
committed by Gerrit Code Review
parent
commit
117d80aea8
  1. 28
      README.md
  2. 10
      lib/puppet/provider/glance_registry_config/ini_setting.rb
  3. 10
      lib/puppet/provider/glance_registry_paste_ini/ini_setting.rb
  4. 54
      lib/puppet/type/glance_registry_config.rb
  5. 53
      lib/puppet/type/glance_registry_paste_ini.rb
  6. 51
      manifests/api.pp
  7. 19
      manifests/config.pp
  8. 2
      manifests/deps.pp
  9. 23
      releasenotes/notes/remove-registry-leftover-28913ae93b9934f8.yaml
  10. 72
      spec/unit/provider/glance_registry_config/ini_setting_spec.rb
  11. 63
      spec/unit/provider/glance_registry_paste_ini/ini_setting_spec.rb
  12. 19
      spec/unit/type/glance_registry_config_spec.rb
  13. 19
      spec/unit/type/glance_registry_paste_ini_spec.rb

28
README.md

@ -149,34 +149,6 @@ Whether to hide the value from Puppet logs. Defaults to `false`.
If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `<SERVICE DEFAULT>`
#### glance_registry_config (DEPRECATED)
The `glance_registry_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/glance/glance-registry.conf` file.
```puppet
glance_registry_config { 'DEFAULT/workers' :
value => 1,
}
```
This will write `workers=1` in the `[DEFAULT]` section.
##### name
Section/setting name to manage from `glance-registry.conf`
##### value
The value of the setting to be defined.
##### secret
Whether to hide the value from Puppet logs. Defaults to `false`.
##### ensure_absent_val
If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `<SERVICE DEFAULT>`
#### glance_cache_config
The `glance_cache_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/glance/glance-cache.conf` file.

10
lib/puppet/provider/glance_registry_config/ini_setting.rb

@ -1,10 +0,0 @@
Puppet::Type.type(:glance_registry_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def self.file_path
'/etc/glance/glance-registry.conf'
end
end

10
lib/puppet/provider/glance_registry_paste_ini/ini_setting.rb

@ -1,10 +0,0 @@
Puppet::Type.type(:glance_registry_paste_ini).provide(
:ini_setting,
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def self.file_path
'/etc/glance/glance-registry-paste.ini'
end
end

54
lib/puppet/type/glance_registry_config.rb

@ -1,54 +0,0 @@
# DEPRECATED
Puppet::Type.newtype(:glance_registry_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from glance-registry.conf'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
newvalues(/^[\S ]*$/)
def is_to_s( currentvalue )
if resource.secret?
return '[old secret redacted]'
else
return currentvalue
end
end
def should_to_s( newvalue )
if resource.secret?
return '[new secret redacted]'
else
return newvalue
end
end
end
newparam(:secret, :boolean => true) do
desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
newvalues(:true, :false)
defaultto false
end
newparam(:ensure_absent_val) do
desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
defaultto('<SERVICE DEFAULT>')
end
autorequire(:anchor) do
['glance::install::end']
end
end

53
lib/puppet/type/glance_registry_paste_ini.rb

@ -1,53 +0,0 @@
# DEPRECATED!
Puppet::Type.newtype(:glance_registry_paste_ini) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from glance-registry-paste.ini'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
def is_to_s( currentvalue )
if resource.secret?
return '[old secret redacted]'
else
return currentvalue
end
end
def should_to_s( newvalue )
if resource.secret?
return '[new secret redacted]'
else
return newvalue
end
end
end
newparam(:secret, :boolean => true) do
desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
newvalues(:true, :false)
defaultto false
end
newparam(:ensure_absent_val) do
desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
defaultto('<SERVICE DEFAULT>')
end
autorequire(:anchor) do
['glance::install::end']
end
end

51
manifests/api.pp

@ -270,32 +270,6 @@
# (optional) Sets the keystone region to use.
# Defaults to undef
#
# [*enable_v1_api*]
# (Optional) Enable or not Glance API v1.
# If you enable this option, you'll get a deprecation warning in Glance
# logs. If enable_v2_api is set to True, glance::registry::enable_v1_registry
# must be configured to True, since Registry is required in API v1.
# Defaults to undef
#
# [*enable_v2_api*]
# (Optional) Enable or not Glance API v2.
# Defaults to undef
#
# [*registry_client_cert_file*]
# (optional) The path to the cert file to use in SSL connections to the
# registry server.
# Defaults to undef
#
# [*registry_client_key_file*]
# (optional) The path to the private key file to use in SSL connections to the
# registry server.
# Defaults to undef
#
# [*registry_client_ca_file*]
# (optional) The path to the CA certificate file to use in SSL connections to the
# registry server.
# Defaults to undef
#
# [*database_connection*]
# (optional) Connection url to connect to glance database.
# Defaults to undef
@ -380,11 +354,6 @@ class glance::api(
$show_multiple_locations = undef,
$database_min_pool_size = undef,
$os_region_name = undef,
$enable_v1_api = undef,
$enable_v2_api = undef,
$registry_client_cert_file = undef,
$registry_client_key_file = undef,
$registry_client_ca_file = undef,
$database_connection = undef,
$database_idle_timeout = undef,
$database_max_pool_size = undef,
@ -402,26 +371,6 @@ class glance::api(
cinder::backend::multistore::cinder::cinder_os_region_name instead.')
}
if $registry_client_cert_file != undef {
warning('glance::api::registry_client_cert_file is deprecated and has no effect')
}
if $registry_client_key_file != undef {
warning('glance::api::registry_client_key_file is deprecated and has no effect')
}
if $registry_client_ca_file != undef {
warning('glance::api::registry_client_ca_file is deprecated and has no effect')
}
if $enable_v1_api != undef {
warning('The glance::api::enable_v1_api parameter was deprecated and has no effect.')
}
if $enable_v2_api != undef {
warning('The glance::api::enable_v2_api parameter was deprecated and has no effect.')
}
if $database_connection != undef {
warning('The database_connection parameter is deprecated and will be \
removed in a future realse. Use glance::api::db::database_connection instead')

19
manifests/config.pp

@ -29,14 +29,6 @@
# [*image_import_config*]
# (optional) Allow configuration of glance-image-import.conf configurations.
#
# DEPRECATED PARAMETERS
#
# [*registry_config*]
# (optional) Allow configuration of glance-registry.conf configurations.
#
# [*registry_paste_ini_config*]
# (optional) Allow configuration of glance-registry-paste.ini configurations.
#
# NOTE: The configuration MUST NOT be already handled by this module
# or Puppet catalog compilation will fail with duplicate resources.
#
@ -45,21 +37,10 @@ class glance::config (
$api_paste_ini_config = {},
$cache_config = {},
$image_import_config = {},
# DEPRECATED PARAMETERS
$registry_config = undef,
$registry_paste_ini_config = undef,
) {
include glance::deps
if $registry_config != undef {
warning('glance::config::registry_config is deprecated and has no effect')
}
if $registry_paste_ini_config != undef {
warning('glance::config::registry_paste_ini_config is deprecated and has no effect')
}
validate_legacy(Hash, 'validate_hash', $api_config)
validate_legacy(Hash, 'validate_hash', $api_paste_ini_config)
validate_legacy(Hash, 'validate_hash', $cache_config)

2
manifests/deps.pp

@ -41,8 +41,6 @@ class glance::deps {
Anchor['glance::config::begin'] -> Glance_api_paste_ini<||> ~> Anchor['glance::config::end']
Anchor['glance::config::begin'] -> Glance_cache_config<||> ~> Anchor['glance::config::end']
Anchor['glance::config::begin'] -> Glance_image_import_config<||> ~> Anchor['glance::config::end']
Anchor['glance::config::begin'] -> Glance_registry_config<||> ~> Anchor['glance::config::end']
Anchor['glance::config::begin'] -> Glance_registry_paste_ini<||> ~> Anchor['glance::config::end']
Anchor['glance::config::begin'] -> Glance_swift_config<||> ~> Anchor['glance::config::end']
# Support packages need to be installed in the install phase, but we don't

23
releasenotes/notes/remove-registry-leftover-28913ae93b9934f8.yaml

@ -0,0 +1,23 @@
---
upgrade:
- |
The following parameters have been removed from the ``glance::api`` class.
- ``enable_v1_api``
- ``enable_v2_api``
- ``registry_client_cert_file``
- ``registry_client_key_file``
- ``registry_client_ca_file``
- |
The following parameters have been removed from the ``glance::config``
class.
- ``registry_config``
- ``registry_paste_ini_config``
- |
The following resource types have been removed.
- ``glance_registry_config``
- ``glance_registry_paste_ini``

72
spec/unit/provider/glance_registry_config/ini_setting_spec.rb

@ -1,72 +0,0 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:glance_registry_config).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Glance_registry_config.new(
{
:name => 'DEFAULT/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Glance_registry_config.new(
{
:name => 'dude/foo',
:value => 'bar'
}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Glance_registry_config.new(
{:name => 'dude/foo', :value => '<SERVICE DEFAULT>'}
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
it 'should ensure absent when value matches ensure_absent_val' do
resource = Puppet::Type::Glance_registry_config.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

63
spec/unit/provider/glance_registry_paste_ini/ini_setting_spec.rb

@ -1,63 +0,0 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'openstacklib',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:glance_registry_paste_ini).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Glance_registry_paste_ini.new(
{:name => 'DEFAULT/foo', :value => 'bar'}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('DEFAULT')
expect(provider.setting).to eq('foo')
end
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Glance_registry_paste_ini.new(
{:name => 'dude/whoa', :value => 'bar'}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('whoa')
end
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Glance_registry_paste_ini.new(
{:name => 'dude/foo', :value => '<SERVICE DEFAULT>'}
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
it 'should ensure absent when value matches ensure_absent_val' do
resource = Puppet::Type::Glance_registry_paste_ini.new(
{:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
)
provider = provider_class.new(resource)
provider.exists?
expect(resource[:ensure]).to eq :absent
end
end

19
spec/unit/type/glance_registry_config_spec.rb

@ -1,19 +0,0 @@
require 'puppet'
require 'puppet/type/glance_registry_config'
describe 'Puppet::Type.type(:glance_registry_config)' do
before :each do
@glance_registry_config = Puppet::Type.type(:glance_registry_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
anchor = Puppet::Type.type(:anchor).new(:name => 'glance::install::end')
catalog.add_resource anchor, @glance_registry_config
dependency = @glance_registry_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@glance_registry_config)
expect(dependency[0].source).to eq(anchor)
end
end

19
spec/unit/type/glance_registry_paste_ini_spec.rb

@ -1,19 +0,0 @@
require 'puppet'
require 'puppet/type/glance_registry_paste_ini'
describe 'Puppet::Type.type(:glance_registry_paste_ini)' do
before :each do
@glance_registry_paste_ini = Puppet::Type.type(:glance_registry_paste_ini).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
anchor = Puppet::Type.type(:anchor).new(:name => 'glance::install::end')
catalog.add_resource anchor, @glance_registry_paste_ini
dependency = @glance_registry_paste_ini.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@glance_registry_paste_ini)
expect(dependency[0].source).to eq(anchor)
end
end
Loading…
Cancel
Save