From 1123f79809090a4ae699720c3965bb4e6ee5b289 Mon Sep 17 00:00:00 2001 From: Denis Egorenko Date: Mon, 13 Mar 2017 12:51:44 +0400 Subject: [PATCH] Drop Glare service from puppet-glance Glare service is now totally dropped from Glance [1] and now should be configured only with puppet-glare module. [1] https://review.openstack.org/#/c/427535/ Change-Id: I695ad518285a92a80dd7a9d5bebd11e804359224 --- .../glance_glare_config/ini_setting.rb | 10 - .../glance_glare_paste_ini/ini_setting.rb | 10 - lib/puppet/type/glance_glare_config.rb | 57 ---- lib/puppet/type/glance_glare_paste_ini.rb | 56 ---- manifests/backend/cinder.pp | 21 +- manifests/backend/file.pp | 18 +- manifests/backend/rbd.pp | 23 +- manifests/backend/s3.pp | 32 +-- manifests/backend/swift.pp | 31 +- manifests/backend/vsphere.pp | 32 +-- manifests/config.pp | 30 +- manifests/deps.pp | 2 - manifests/glare.pp | 192 ++----------- manifests/glare/authtoken.pp | 264 +++-------------- manifests/glare/db.pp | 56 +--- manifests/glare/logging.pp | 151 +++------- manifests/keystone/glare_auth.pp | 100 ++----- manifests/params.pp | 4 - ...op_glare_from_glance-8a1d09f8a0613229.yaml | 4 + spec/acceptance/glance_config_spec.rb | 31 -- spec/classes/glance_backend_cinder_spec.rb | 15 - spec/classes/glance_backend_file_spec.rb | 10 +- spec/classes/glance_backend_rbd_spec.rb | 10 - spec/classes/glance_backend_s3_spec.rb | 28 -- spec/classes/glance_backend_swift_spec.rb | 21 -- spec/classes/glance_backend_vsphere_spec.rb | 19 -- spec/classes/glance_config_spec.rb | 20 -- spec/classes/glance_glare_authtoken_spec.rb | 147 ---------- spec/classes/glance_glare_db_spec.rb | 94 ------ spec/classes/glance_glare_logging_spec.rb | 138 --------- spec/classes/glance_glare_spec.rb | 272 ------------------ .../glance_keystone_glare_auth_spec.rb | 172 ----------- .../glance_glare_config/ini_setting_spec.rb | 71 ----- .../ini_setting_spec.rb | 63 ---- spec/unit/type/glance_glare_config_spec.rb | 41 --- spec/unit/type/glance_glare_paste_ini_spec.rb | 87 ------ 36 files changed, 204 insertions(+), 2128 deletions(-) delete mode 100644 lib/puppet/provider/glance_glare_config/ini_setting.rb delete mode 100644 lib/puppet/provider/glance_glare_paste_ini/ini_setting.rb delete mode 100644 lib/puppet/type/glance_glare_config.rb delete mode 100644 lib/puppet/type/glance_glare_paste_ini.rb create mode 100644 releasenotes/notes/drop_glare_from_glance-8a1d09f8a0613229.yaml delete mode 100644 spec/classes/glance_glare_authtoken_spec.rb delete mode 100644 spec/classes/glance_glare_db_spec.rb delete mode 100644 spec/classes/glance_glare_logging_spec.rb delete mode 100644 spec/classes/glance_glare_spec.rb delete mode 100644 spec/classes/glance_keystone_glare_auth_spec.rb delete mode 100644 spec/unit/provider/glance_glare_config/ini_setting_spec.rb delete mode 100644 spec/unit/provider/glance_glare_paste_ini/ini_setting_spec.rb delete mode 100644 spec/unit/type/glance_glare_config_spec.rb delete mode 100644 spec/unit/type/glance_glare_paste_ini_spec.rb diff --git a/lib/puppet/provider/glance_glare_config/ini_setting.rb b/lib/puppet/provider/glance_glare_config/ini_setting.rb deleted file mode 100644 index 5d8d2458..00000000 --- a/lib/puppet/provider/glance_glare_config/ini_setting.rb +++ /dev/null @@ -1,10 +0,0 @@ -Puppet::Type.type(:glance_glare_config).provide( - :ini_setting, - :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) -) do - - def self.file_path - '/etc/glance/glance-glare.conf' - end - -end diff --git a/lib/puppet/provider/glance_glare_paste_ini/ini_setting.rb b/lib/puppet/provider/glance_glare_paste_ini/ini_setting.rb deleted file mode 100644 index e32e9cfd..00000000 --- a/lib/puppet/provider/glance_glare_paste_ini/ini_setting.rb +++ /dev/null @@ -1,10 +0,0 @@ -Puppet::Type.type(:glance_glare_paste_ini).provide( - :ini_setting, - :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) -) do - - def self.file_path - '/etc/glance/glance-glare-paste.ini' - end - -end diff --git a/lib/puppet/type/glance_glare_config.rb b/lib/puppet/type/glance_glare_config.rb deleted file mode 100644 index b4a1593d..00000000 --- a/lib/puppet/type/glance_glare_config.rb +++ /dev/null @@ -1,57 +0,0 @@ -Puppet::Type.newtype(:glance_glare_config) do - - ensurable - - newparam(:name, :namevar => true) do - desc 'Section/setting name to manage from glance-api.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('') - end - - autorequire(:package) do - if Facter.value(:osfamily) == 'Debian' - 'glance-glare' - elsif Facter.value(:osfamily) == 'RedHat' - 'openstack-glance' - end - end - -end diff --git a/lib/puppet/type/glance_glare_paste_ini.rb b/lib/puppet/type/glance_glare_paste_ini.rb deleted file mode 100644 index 8e96ead7..00000000 --- a/lib/puppet/type/glance_glare_paste_ini.rb +++ /dev/null @@ -1,56 +0,0 @@ -Puppet::Type.newtype(:glance_glare_paste_ini) do - - ensurable - - newparam(:name, :namevar => true) do - desc 'Section/setting name to manage from glance-glare-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('') - end - - autorequire(:package) do - if Facter.value(:osfamily) == 'Debian' - 'glance-glare' - elsif Facter.value(:osfamily) == 'RedHat' - 'openstack-glance' - end - end - -end diff --git a/manifests/backend/cinder.pp b/manifests/backend/cinder.pp index 308246f5..866b4363 100644 --- a/manifests/backend/cinder.pp +++ b/manifests/backend/cinder.pp @@ -56,9 +56,11 @@ # (optional) Boolean describing if multiple backends will be configured # Defaults to false # +# === Deprecated parameters +# # [*glare_enabled*] # (optional) Whether enabled Glance Glare API. -# Defaults to false +# Defaults to undef # class glance::backend::cinder( $os_region_name = undef, @@ -68,7 +70,8 @@ class glance::backend::cinder( $cinder_endpoint_template = $::os_service_default, $cinder_http_retries = $::os_service_default, $multi_store = false, - $glare_enabled = false, + # deprecated + $glare_enabled = undef, ) { include ::glance::deps @@ -87,9 +90,6 @@ class glance::backend::cinder( if !$multi_store { glance_api_config { 'glance_store/default_store': value => 'cinder'; } - if $glare_enabled { - glance_glare_config { 'glance_store/default_store': value => 'cinder'; } - } } glance_cache_config { @@ -100,14 +100,9 @@ class glance::backend::cinder( 'glance_store/cinder_ca_certificates_file': value => $cinder_ca_certificates_file; } - if $glare_enabled { - glance_glare_config { - 'glance_store/cinder_api_insecure': value => $cinder_api_insecure; - 'glance_store/cinder_catalog_info': value => $cinder_catalog_info; - 'glance_store/cinder_http_retries': value => $cinder_http_retries; - 'glance_store/cinder_endpoint_template': value => $cinder_endpoint_template; - 'glance_store/cinder_ca_certificates_file': value => $cinder_ca_certificates_file; - } + if $glare_enabled != undef { + warning("Since Glare was removed from Glance and now it is separate project, \ +you should use puppet-glare module for configuring Glare service.") } } diff --git a/manifests/backend/file.pp b/manifests/backend/file.pp index 4efa17ed..6c75c87e 100644 --- a/manifests/backend/file.pp +++ b/manifests/backend/file.pp @@ -13,14 +13,16 @@ # (optional) Boolean describing if multiple backends will be configured # Defaults to false # +# === Deprecated parameters: +# # [*glare_enabled*] # (optional) Whether enabled Glance Glare API. -# Defaults to false +# Defaults to undef # class glance::backend::file( $filesystem_store_datadir = '/var/lib/glance/images/', $multi_store = false, - $glare_enabled = false, + $glare_enabled = undef, ) { include ::glance::deps @@ -29,19 +31,13 @@ class glance::backend::file( 'glance_store/filesystem_store_datadir': value => $filesystem_store_datadir; } - if $glare_enabled { - glance_glare_config { - 'glance_store/filesystem_store_datadir': value => $filesystem_store_datadir; - } + if $glare_enabled != undef { + warning("Since Glare was removed from Glance and now it is separate project, \ +you should use puppet-glare module for configuring Glare service.") } if !$multi_store { glance_api_config { 'glance_store/default_store': value => 'file'; } - if $glare_enabled { - glance_glare_config { - 'glance_store/default_store': value => 'file'; - } - } } glance_cache_config { diff --git a/manifests/backend/rbd.pp b/manifests/backend/rbd.pp index 0284eb05..831c883f 100644 --- a/manifests/backend/rbd.pp +++ b/manifests/backend/rbd.pp @@ -40,9 +40,11 @@ # Optional. Boolean describing if multiple backends will be configured # Defaults to false # +# === Deprecated parameters: +# # [*glare_enabled*] -# Optional. Whether enabled Glance Glare API. -# Defaults to false +# (optional) Whether enabled Glance Glare API. +# Defaults to undef # class glance::backend::rbd( $rbd_store_user = $::os_service_default, @@ -54,7 +56,8 @@ class glance::backend::rbd( $package_ensure = 'present', $rados_connect_timeout = $::os_service_default, $multi_store = false, - $glare_enabled = false, + # deprecated + $glare_enabled = undef, ) { include ::glance::deps @@ -72,21 +75,13 @@ class glance::backend::rbd( 'glance_store/rados_connect_timeout': value => $rados_connect_timeout; } - if $glare_enabled { - glance_glare_config { - 'glance_store/rbd_store_ceph_conf': value => $rbd_store_ceph_conf; - 'glance_store/rbd_store_user': value => $rbd_store_user; - 'glance_store/rbd_store_pool': value => $rbd_store_pool; - 'glance_store/rbd_store_chunk_size': value => $rbd_store_chunk_size; - 'glance_store/rados_connect_timeout': value => $rados_connect_timeout; - } + if $glare_enabled != undef { + warning("Since Glare was removed from Glance and now it is separate project, \ +you should use puppet-glare module for configuring Glare service.") } if !$multi_store { glance_api_config { 'glance_store/default_store': value => 'rbd'; } - if $glare_enabled { - glance_glare_config { 'glance_store/default_store': value => 'rbd'; } - } } if $manage_packages { diff --git a/manifests/backend/s3.pp b/manifests/backend/s3.pp index 438ba709..73959b1e 100644 --- a/manifests/backend/s3.pp +++ b/manifests/backend/s3.pp @@ -50,15 +50,14 @@ # (optional) Boolean describing if multiple backends will be configured # Defaults to false # -# [*glare_enabled*] -# (optional) Whether enabled Glance Glare API. -# Defaults to false -# # === deprecated parameters: # # [*default_store*] # (Optional) DEPRECATED Whether to set S3 as the default backend store. # Default: undef +# [*glare_enabled*] +# (optional) Whether enabled Glance Glare API. +# Defaults to undef # class glance::backend::s3( $access_key, @@ -72,9 +71,9 @@ class glance::backend::s3( $object_buffer_dir = $::os_service_default, $thread_pools = $::os_service_default, $multi_store = false, - $glare_enabled = false, # deprecated parameters $default_store = undef, + $glare_enabled = undef, ) { include ::glance::deps @@ -96,6 +95,11 @@ class glance::backend::s3( warning('The default_store parameter is deprecated in glance::backend::s3, you should declare it in glance::api') } + if $glare_enabled != undef { + warning("Since Glare was removed from Glance and now it is separate project, \ +you should use puppet-glare module for configuring Glare service.") + } + glance_api_config { 'glance_store/s3_store_access_key': value => $access_key; 'glance_store/s3_store_secret_key': value => $secret_key; @@ -109,26 +113,8 @@ class glance::backend::s3( 'glance_store/s3_store_object_buffer_dir': value => $object_buffer_dir; } - if $glare_enabled { - glance_glare_config { - 'glance_store/s3_store_access_key': value => $access_key; - 'glance_store/s3_store_secret_key': value => $secret_key; - 'glance_store/s3_store_host': value => $host; - 'glance_store/s3_store_bucket': value => $bucket; - 'glance_store/s3_store_bucket_url_format': value => $bucket_url_format; - 'glance_store/s3_store_create_bucket_on_put': value => $create_bucket_on_put; - 'glance_store/s3_store_large_object_size': value => $large_object_size; - 'glance_store/s3_store_large_object_chunk_size': value => $large_object_chunk_size; - 'glance_store/s3_store_thread_pools': value => $thread_pools; - 'glance_store/s3_store_object_buffer_dir': value => $object_buffer_dir; - } - } - if !$multi_store { glance_api_config { 'glance_store/default_store': value => 's3'; } - if $glare_enabled { - glance_glare_config { 'glance_store/default_store': value => 's3'; } - } } } diff --git a/manifests/backend/swift.pp b/manifests/backend/swift.pp index b5730b1a..516d5515 100644 --- a/manifests/backend/swift.pp +++ b/manifests/backend/swift.pp @@ -48,9 +48,11 @@ # (optional) Boolean describing if multiple backends will be configured # Defaults to false # +# === Deprecated parameters +# # [*glare_enabled*] # (optional) Whether enabled Glance Glare API. -# Defaults to false +# Defaults to undef # class glance::backend::swift( $swift_store_user, @@ -66,7 +68,8 @@ class glance::backend::swift( $swift_store_region = $::os_service_default, $default_swift_reference = 'ref1', $multi_store = false, - $glare_enabled = false, + # deprecated + $glare_enabled = undef, ) { include ::glance::deps @@ -74,6 +77,11 @@ class glance::backend::swift( Class['swift::client'] -> Anchor['glance::install::end'] Service<| tag == 'swift-service' |> -> Service['glance-api'] + if $glare_enabled != undef { + warning("Since Glare was removed from Glance and now it is separate project, \ +you should use puppet-glare module for configuring Glare service.") + } + glance_api_config { 'glance_store/swift_store_region': value => $swift_store_region; 'glance_store/swift_store_container': value => $swift_store_container; @@ -88,27 +96,8 @@ class glance::backend::swift( 'glance_store/default_swift_reference': value => $default_swift_reference; } - if $glare_enabled { - glance_glare_config { - 'glance_store/swift_store_region': value => $swift_store_region; - 'glance_store/swift_store_container': value => $swift_store_container; - 'glance_store/swift_store_create_container_on_put': - value => $swift_store_create_container_on_put; - 'glance_store/swift_store_large_object_size': - value => $swift_store_large_object_size; - 'glance_store/swift_store_endpoint_type': - value => $swift_store_endpoint_type; - - 'glance_store/swift_store_config_file': value => '/etc/glance/glance-swift.conf'; - 'glance_store/default_swift_reference': value => $default_swift_reference; - } - } - if !$multi_store { glance_api_config { 'glance_store/default_store': value => 'swift'; } - if $glare_enabled { - glance_glare_config { 'glance_store/default_store': value => 'swift'; } - } } glance_swift_config { diff --git a/manifests/backend/vsphere.pp b/manifests/backend/vsphere.pp index 7a37a96a..559e7fb8 100644 --- a/manifests/backend/vsphere.pp +++ b/manifests/backend/vsphere.pp @@ -78,10 +78,6 @@ # (optional) Boolean describing if multiple backends will be configured # Defaults to false. # -# [*glare_enabled*] -# (optional) Whether enabled Glance Glare API. -# Defaults to false. -# # DEPRECATED PARAMETERS # # [*vcenter_api_insecure*] @@ -102,6 +98,10 @@ # and will be removed. # Defaults to undef. # +# [*glare_enabled*] +# (optional) Whether enabled Glance Glare API. +# Defaults to undef. +# class glance::backend::vsphere( $vcenter_host, $vcenter_user, @@ -113,15 +113,20 @@ class glance::backend::vsphere( $vcenter_task_poll_interval = $::os_service_default, $vcenter_api_retry_count = $::os_service_default, $multi_store = false, - $glare_enabled = false, # DEPRECATED PARAMETERS $vcenter_datacenter = undef, $vcenter_datastore = undef, $vcenter_api_insecure = undef, + $glare_enabled = undef, ) { include ::glance::deps + if $glare_enabled != undef { + warning("Since Glare was removed from Glance and now it is separate project, \ +you should use puppet-glare module for configuring Glare service.") + } + if $vcenter_api_insecure { warning('The vcenter_api_insecure parameter is deprecated, use parameter vcenter_insecure') $vmware_insecure_real = $vcenter_api_insecure @@ -153,24 +158,7 @@ class glance::backend::vsphere( 'glance_store/vmware_datastores': value => $vmware_datastores_real; } - if $glare_enabled { - glance_glare_config { - 'glance_store/vmware_insecure': value => $vmware_insecure_real; - 'glance_store/vmware_ca_file': value => $vcenter_ca_file; - 'glance_store/vmware_server_host': value => $vcenter_host; - 'glance_store/vmware_server_username': value => $vcenter_user; - 'glance_store/vmware_server_password': value => $vcenter_password, secret => true; - 'glance_store/vmware_store_image_dir': value => $vcenter_image_dir; - 'glance_store/vmware_task_poll_interval': value => $vcenter_task_poll_interval; - 'glance_store/vmware_api_retry_count': value => $vcenter_api_retry_count; - 'glance_store/vmware_datastores': value => $vmware_datastores_real; - } - } - if !$multi_store { glance_api_config { 'glance_store/default_store': value => 'vsphere'; } - if $glare_enabled { - glance_glare_config { 'glance_store/default_store': value => 'vsphere'; } - } } } diff --git a/manifests/config.pp b/manifests/config.pp index a1463628..f40aa73a 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -29,43 +29,49 @@ # [*registry_paste_ini_config*] # (optional) Allow configuration of glance-registry-paste.ini configurations. # -# [*glare_config*] -# (optional) Allow configuration of glance-glare.conf configurations. -# -# [*glare_paste_ini_config*] -# (optional) Allow configuration of glance-glare-paste.ini configurations. -# # [*cache_config*] # (optional) Allow configuration of glance-cache.conf configurations. # # NOTE: The configuration MUST NOT be already handled by this module # or Puppet catalog compilation will fail with duplicate resources. # +# === Deprecated parameters +# +# [*glare_config*] +# (optional) Allow configuration of glance-glare.conf configurations. +# Defaults to undef. +# +# [*glare_paste_ini_config*] +# (optional) Allow configuration of glance-glare-paste.ini configurations. +# Defaults to undef. +# class glance::config ( $api_config = {}, $api_paste_ini_config = {}, $registry_config = {}, $registry_paste_ini_config = {}, - $glare_config = {}, - $glare_paste_ini_config = {}, $cache_config = {}, + # deprecated + $glare_config = undef, + $glare_paste_ini_config = undef, ) { include ::glance::deps + if $glare_config != undef or $glare_paste_ini_config != undef{ + warning("Since Glare was removed from Glance and now it is separate project, \ +you should use puppet-glare module for configuring Glare service.") + } + validate_hash($api_config) validate_hash($api_paste_ini_config) validate_hash($registry_config) validate_hash($registry_paste_ini_config) validate_hash($cache_config) - validate_hash($glare_config) - validate_hash($glare_paste_ini_config) create_resources('glance_api_config', $api_config) create_resources('glance_api_paste_ini', $api_paste_ini_config) create_resources('glance_registry_config', $registry_config) create_resources('glance_registry_paste_ini', $registry_paste_ini_config) create_resources('glance_cache_config', $cache_config) - create_resources('glance_glare_config', $glare_config) - create_resources('glance_glare_paste_ini', $glare_paste_ini_config) } diff --git a/manifests/deps.pp b/manifests/deps.pp index 4dea006a..6881fe5b 100644 --- a/manifests/deps.pp +++ b/manifests/deps.pp @@ -40,8 +40,6 @@ class glance::deps { Anchor['glance::config::begin'] -> Glance_api_config<||> ~> Anchor['glance::config::end'] 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_glare_config<||> ~> Anchor['glance::config::end'] - Anchor['glance::config::begin'] -> Glance_glare_paste_ini<||> ~> 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'] diff --git a/manifests/glare.pp b/manifests/glare.pp index be3849f7..f99a6e6e 100644 --- a/manifests/glare.pp +++ b/manifests/glare.pp @@ -1,195 +1,47 @@ # == Class glance::glare # -# Configure Glare Glare service in glance +# Configure Glare Glare service in glance. Deprecated. # -# == Parameters +# == Deprecated parameters # # [*package_ensure*] -# (optional) Ensure state for package. On RedHat platforms this -# setting is ignored and the setting from the glance class is used -# because there is only one glance package. Defaults to 'present'. -# # [*bind_host*] -# (optional) The address of the host to bind to. -# Default: 0.0.0.0 -# # [*bind_port*] -# (optional) The port the server should bind to. -# Default: 9494 -# # [*backlog*] -# (optional) Backlog requests when creating socket -# Default: 4096 -# # [*workers*] -# (optional) Number of Glance Glare worker processes to start -# Default: $::os_workers. -# # [*auth_strategy*] -# (optional) Type is authorization being used. -# Defaults to 'keystone' -# # [*pipeline*] -# (optional) Partial name of a pipeline in your paste configuration file with the -# service name removed. -# Defaults to 'keystone'. -# # [*manage_service*] -# (optional) If Puppet should manage service startup / shutdown. -# Defaults to true. -# # [*enabled*] -# (optional) Whether to enable services. -# Defaults to true. -# # [*cert_file*] -# (optinal) Certificate file to use when starting API server securely -# Defaults to $::os_service_default -# # [*key_file*] -# (optional) Private key file to use when starting API server securely -# Defaults to $::os_service_default -# # [*ca_file*] -# (optional) CA certificate file to use to verify connecting clients -# Defaults to $::os_service_default -# # [*stores*] -# (optional) List of which store classes and store class locations are -# currently known to glance at startup. -# Defaults to false. -# Example: ['glance.store.filesystem.Store','glance.store.http.Store'] -# # [*default_store*] -# (optional) The default backend store, should be given as a string. Value -# must be provided if more than one store is listed in 'stores'. -# Defaults to undef -# # [*multi_store*] -# (optional) Boolean describing if multiple backends will be configured -# Defaults to false -# # [*os_region_name*] -# (optional) Sets the keystone region to use. -# Defaults to 'RegionOne'. # class glance::glare( - $package_ensure = 'present', - $bind_host = '0.0.0.0', - $bind_port = '9494', - $backlog = '4096', - $workers = $::os_workers, - $auth_strategy = 'keystone', - $pipeline = 'keystone', - $manage_service = true, - $enabled = true, - $cert_file = $::os_service_default, - $key_file = $::os_service_default, - $ca_file = $::os_service_default, - $stores = false, - $default_store = undef, - $multi_store = false, - $os_region_name = 'RegionOne', -) inherits glance { + $package_ensure = undef, + $bind_host = undef, + $bind_port = undef, + $backlog = undef, + $workers = undef, + $auth_strategy = undef, + $pipeline = undef, + $manage_service = undef, + $enabled = undef, + $cert_file = undef, + $key_file = undef, + $ca_file = undef, + $stores = undef, + $default_store = undef, + $multi_store = undef, + $os_region_name = undef, +) { - include ::glance::deps - include ::glance::policy - include ::glance::glare::db - include ::glance::glare::logging + warning("Class ::glance::glare is deprecated since Glare was removed from Glance. \ +Now Glare is separated project and all configuration was moved to \ +puppet-glare module as well.") - if ( $glance::params::glare_package_name != $glance::params::registry_package_name ) { - ensure_packages('glance-glare', { - ensure => $package_ensure, - tag => ['openstack', 'glance-package'], - }) - } - - glance_glare_config { - 'DEFAULT/bind_host': value => $bind_host; - 'DEFAULT/bind_port': value => $bind_port; - 'DEFAULT/backlog': value => $backlog; - 'DEFAULT/workers': value => $workers; - 'glance_store/os_region_name': value => $os_region_name; - } - - if $default_store { - $default_store_real = $default_store - } - - if $stores { - validate_array($stores) - $stores_real = $stores - } - - if !empty($stores_real) { - $final_stores_real = join($stores_real, ',') - if !$default_store_real { - warning("default_store not provided, it will be automatically set to ${stores_real[0]}") - $default_store_real = $stores_real[0] - } - } elsif $default_store_real { - $final_stores_real = $default_store - } else { - warning('Glance-Glare is being provisioned without any stores configured') - } - - if $default_store_real and $multi_store { - glance_glare_config { - 'glance_store/default_store': value => $default_store_real; - } - } elsif $multi_store { - glance_glare_config { - 'glance_store/default_store': ensure => absent; - } - } - - if $final_stores_real { - glance_glare_config { - 'glance_store/stores': value => $final_stores_real; - } - } else { - glance_glare_config { - 'glance_store/stores': ensure => absent; - } - } - - if $pipeline != '' { - validate_re($pipeline, '^(\w+([+]\w+)*)*$') - glance_glare_config { - 'paste_deploy/flavor': - ensure => present, - value => $pipeline, - } - } else { - glance_glare_config { 'paste_deploy/flavor': ensure => absent } - } - - # keystone config - if $auth_strategy == 'keystone' { - include ::glance::glare::authtoken - } - - # SSL Options - glance_glare_config { - 'DEFAULT/cert_file': value => $cert_file; - 'DEFAULT/key_file' : value => $key_file; - 'DEFAULT/ca_file' : value => $ca_file; - } - - if $manage_service { - if $enabled { - $service_ensure = 'running' - } else { - $service_ensure = 'stopped' - } - } - - service { 'glance-glare': - ensure => $service_ensure, - name => $::glance::params::glare_service_name, - enable => $enabled, - hasstatus => true, - hasrestart => true, - tag => 'glance-service', - } } diff --git a/manifests/glare/authtoken.pp b/manifests/glare/authtoken.pp index b5e79191..8a032dda 100644 --- a/manifests/glare/authtoken.pp +++ b/manifests/glare/authtoken.pp @@ -1,267 +1,87 @@ # class: glance::glare::authtoken # -# Configure the keystone_authtoken section in the Glance Glare configuration file +# Configure the keystone_authtoken section in the Glance Glare configuration file. Deprecated. # -# === Parameters +# === Deprecated parameters # # [*username*] -# (Optional) The name of the service user -# Defaults to 'glance' -# # [*password*] -# (Optional) Password to create for the service user -# Defaults to $::os_service_default -# # [*auth_url*] -# (Optional) The URL to use for authentication. -# Defaults to 'http://127.0.0.1:35357' -# # [*project_name*] -# (Optional) Service project name -# Defaults to 'services' -# # [*user_domain_name*] -# (Optional) Name of domain for $username -# Defaults to $::os_service_default -# # [*project_domain_name*] -# (Optional) Name of domain for $project_name -# Defaults to $::os_service_default -# # [*insecure*] -# (Optional) If true, explicitly allow TLS without checking server cert -# against any certificate authorities. WARNING: not recommended. Use with -# caution. -# Defaults to $:os_service_default -# # [*auth_section*] -# (Optional) Config Section from which to load plugin specific options -# Defaults to $::os_service_default. -# # [*auth_type*] -# (Optional) Authentication type to load -# Defaults to 'password' -# # [*auth_uri*] -# (Optional) Complete public Identity API endpoint. -# Defaults to 'http://127.0.0.1:5000'. -# # [*auth_version*] -# (Optional) API version of the admin Identity API endpoint. -# Defaults to $::os_service_default. -# # [*cache*] -# (Optional) Env key for the swift cache. -# Defaults to $::os_service_default. -# # [*cafile*] -# (Optional) A PEM encoded Certificate Authority to use when verifying HTTPs -# connections. -# Defaults to $::os_service_default. -# # [*certfile*] -# (Optional) Required if identity server requires client certificate -# Defaults to $::os_service_default. -# # [*check_revocations_for_cached*] -# (Optional) If true, the revocation list will be checked for cached tokens. -# This requires that PKI tokens are configured on the identity server. -# boolean value. -# Defaults to $::os_service_default. -# # [*delay_auth_decision*] -# (Optional) Do not handle authorization requests within the middleware, but -# delegate the authorization decision to downstream WSGI components. Boolean -# value -# Defaults to $::os_service_default. -# # [*enforce_token_bind*] -# (Optional) Used to control the use and type of token binding. Can be set -# to: "disabled" to not check token binding. "permissive" (default) to -# validate binding information if the bind type is of a form known to the -# server and ignore it if not. "strict" like "permissive" but if the bind -# type is unknown the token will be rejected. "required" any form of token -# binding is needed to be allowed. Finally the name of a binding method that -# must be present in tokens. String value. -# Defaults to $::os_service_default. -# # [*hash_algorithms*] -# (Optional) Hash algorithms to use for hashing PKI tokens. This may be a -# single algorithm or multiple. The algorithms are those supported by Python -# standard hashlib.new(). The hashes will be tried in the order given, so put -# the preferred one first for performance. The result of the first hash will -# be stored in the cache. This will typically be set to multiple values only -# while migrating from a less secure algorithm to a more secure one. Once all -# the old tokens are expired this option should be set to a single value for -# better performance. List value. -# Defaults to $::os_service_default. -# # [*http_connect_timeout*] -# (Optional) Request timeout value for communicating with Identity API -# server. -# Defaults to $::os_service_default. -# # [*http_request_max_retries*] -# (Optional) How many times are we trying to reconnect when communicating -# with Identity API Server. Integer value -# Defaults to $::os_service_default. -# # [*include_service_catalog*] -# (Optional) Indicate whether to set the X-Service-Catalog header. If False, -# middleware will not ask for service catalog on token validation and will -# not set the X-Service-Catalog header. Boolean value. -# Defaults to $::os_service_default. -# # [*keyfile*] -# (Optional) Required if identity server requires client certificate -# Defaults to $::os_service_default. -# # [*memcache_pool_conn_get_timeout*] -# (Optional) Number of seconds that an operation will wait to get a memcached -# client connection from the pool. Integer value -# Defaults to $::os_service_default. -# # [*memcache_pool_dead_retry*] -# (Optional) Number of seconds memcached server is considered dead before it -# is tried again. Integer value -# Defaults to $::os_service_default. -# # [*memcache_pool_maxsize*] -# (Optional) Maximum total number of open connections to every memcached -# server. Integer value -# Defaults to $::os_service_default. -# # [*memcache_pool_socket_timeout*] -# (Optional) Number of seconds a connection to memcached is held unused in -# the pool before it is closed. Integer value -# Defaults to $::os_service_default. -# # [*memcache_pool_unused_timeout*] -# (Optional) Number of seconds a connection to memcached is held unused in -# the pool before it is closed. Integer value -# Defaults to $::os_service_default. -# # [*memcache_secret_key*] -# (Optional, mandatory if memcache_security_strategy is defined) This string -# is used for key derivation. -# Defaults to $::os_service_default. -# # [*memcache_security_strategy*] -# (Optional) If defined, indicate whether token data should be authenticated or -# authenticated and encrypted. If MAC, token data is authenticated (with HMAC) -# in the cache. If ENCRYPT, token data is encrypted and authenticated in the -# cache. If the value is not one of these options or empty, auth_token will -# raise an exception on initialization. -# Defaults to $::os_service_default. -# # [*memcache_use_advanced_pool*] -# (Optional) Use the advanced (eventlet safe) memcached client pool. The -# advanced pool will only work under python 2.x Boolean value -# Defaults to $::os_service_default. -# # [*memcached_servers*] -# (Optional) Optionally specify a list of memcached server(s) to use for -# caching. If left undefined, tokens will instead be cached in-process. -# Defaults to $::os_service_default. -# # [*manage_memcache_package*] -# (Optional) Whether to install the python-memcache package. -# Defaults to false. -# # [*region_name*] -# (Optional) The region in which the identity server can be found. -# Defaults to $::os_service_default. -# # [*revocation_cache_time*] -# (Optional) Determines the frequency at which the list of revoked tokens is -# retrieved from the Identity service (in seconds). A high number of -# revocation events combined with a low cache duration may significantly -# reduce performance. Only valid for PKI tokens. Integer value -# Defaults to $::os_service_default. -# # [*token_cache_time*] -# (Optional) In order to prevent excessive effort spent validating tokens, -# the middleware caches previously-seen tokens for a configurable duration -# (in seconds). Set to -1 to disable caching completely. Integer value -# Defaults to $::os_service_default. +# [*signing_dir*] # class glance::glare::authtoken( - $username = 'glance', - $password = $::os_service_default, - $auth_url = 'http://127.0.0.1:35357', - $project_name = 'services', - $user_domain_name = $::os_service_default, - $project_domain_name = $::os_service_default, - $insecure = $::os_service_default, - $auth_section = $::os_service_default, - $auth_type = 'password', - $auth_uri = 'http://127.0.0.1:5000', - $auth_version = $::os_service_default, - $cache = $::os_service_default, - $cafile = $::os_service_default, - $certfile = $::os_service_default, - $check_revocations_for_cached = $::os_service_default, - $delay_auth_decision = $::os_service_default, - $enforce_token_bind = $::os_service_default, - $hash_algorithms = $::os_service_default, - $http_connect_timeout = $::os_service_default, - $http_request_max_retries = $::os_service_default, - $include_service_catalog = $::os_service_default, - $keyfile = $::os_service_default, - $memcache_pool_conn_get_timeout = $::os_service_default, - $memcache_pool_dead_retry = $::os_service_default, - $memcache_pool_maxsize = $::os_service_default, - $memcache_pool_socket_timeout = $::os_service_default, - $memcache_pool_unused_timeout = $::os_service_default, - $memcache_secret_key = $::os_service_default, - $memcache_security_strategy = $::os_service_default, - $memcache_use_advanced_pool = $::os_service_default, - $memcached_servers = $::os_service_default, - $manage_memcache_package = false, - $region_name = $::os_service_default, - $revocation_cache_time = $::os_service_default, - $token_cache_time = $::os_service_default, + $username = undef, + $password = undef, + $auth_url = undef, + $project_name = undef, + $user_domain_name = undef, + $project_domain_name = undef, + $insecure = undef, + $auth_section = undef, + $auth_type = undef, + $auth_uri = undef, + $auth_version = undef, + $cache = undef, + $cafile = undef, + $certfile = undef, + $check_revocations_for_cached = undef, + $delay_auth_decision = undef, + $enforce_token_bind = undef, + $hash_algorithms = undef, + $http_connect_timeout = undef, + $http_request_max_retries = undef, + $include_service_catalog = undef, + $keyfile = undef, + $memcache_pool_conn_get_timeout = undef, + $memcache_pool_dead_retry = undef, + $memcache_pool_maxsize = undef, + $memcache_pool_socket_timeout = undef, + $memcache_pool_unused_timeout = undef, + $memcache_secret_key = undef, + $memcache_security_strategy = undef, + $memcache_use_advanced_pool = undef, + $memcached_servers = undef, + $manage_memcache_package = undef, + $region_name = undef, + $revocation_cache_time = undef, + $token_cache_time = undef, + $signing_dir = undef, ) { - if is_service_default($password) and $::glance::glare::keystone_password == undef { - fail('Please set password for Glance service user') - } + warning("Class ::glance::glare::authtoken is deprecated since Glare was removed \ +from Glance. Now Glare is separated project and all configuration was moved to \ +puppet-glare module as well.") - keystone::resource::authtoken { 'glance_glare_config': - username => $username, - password => $password, - project_name => $project_name, - auth_url => $auth_url, - auth_uri => $auth_uri, - auth_version => $auth_version, - auth_type => $auth_type, - auth_section => $auth_section, - user_domain_name => $user_domain_name, - project_domain_name => $project_domain_name, - insecure => $insecure, - cache => $cache, - cafile => $cafile, - certfile => $certfile, - check_revocations_for_cached => $check_revocations_for_cached, - delay_auth_decision => $delay_auth_decision, - enforce_token_bind => $enforce_token_bind, - hash_algorithms => $hash_algorithms, - http_connect_timeout => $http_connect_timeout, - http_request_max_retries => $http_request_max_retries, - include_service_catalog => $include_service_catalog, - keyfile => $keyfile, - memcache_pool_conn_get_timeout => $memcache_pool_conn_get_timeout, - memcache_pool_dead_retry => $memcache_pool_dead_retry, - memcache_pool_maxsize => $memcache_pool_maxsize, - memcache_pool_socket_timeout => $memcache_pool_socket_timeout, - memcache_secret_key => $memcache_secret_key, - memcache_security_strategy => $memcache_security_strategy, - memcache_use_advanced_pool => $memcache_use_advanced_pool, - memcache_pool_unused_timeout => $memcache_pool_unused_timeout, - memcached_servers => $memcached_servers, - manage_memcache_package => $manage_memcache_package, - region_name => $region_name, - revocation_cache_time => $revocation_cache_time, - token_cache_time => $token_cache_time, - } } diff --git a/manifests/glare/db.pp b/manifests/glare/db.pp index 6c07469c..10bacdd9 100644 --- a/manifests/glare/db.pp +++ b/manifests/glare/db.pp @@ -1,61 +1,29 @@ # == Class: glance::glare::db # -# Configure the Glance Glare database +# Configure the Glance Glare database. Deprecated. # -# === Parameters +# === Deprecated parameters # # [*database_connection*] -# Url used to connect to database. -# (Optional) Defaults to 'sqlite:///var/lib/glance/glance.sqlite'. -# # [*database_idle_timeout*] -# Timeout when db connections should be reaped. -# (Optional) Defaults to $::os_service_default. -# # [*database_min_pool_size*] -# Minimum number of SQL connections to keep open in a pool. -# (Optional) Defaults to $::os_service_default. -# # [*database_max_pool_size*] -# Maximum number of SQL connections to keep open in a pool. -# (Optional) Defaults to $::os_service_default. -# # [*database_max_retries*] -# Maximum db connection retries during startup. -# Setting -1 implies an infinite retry count. -# (Optional) Defaults to $::os_service_default. -# # [*database_retry_interval*] -# Interval between retries of opening a sql connection. -# (Optional) Defaults to $::os_service_default. -# # [*database_max_overflow*] -# If set, use this value for max_overflow with sqlalchemy. -# (Optional) Defaults to $::os_service_default. # class glance::glare::db ( - $database_connection = 'sqlite:///var/lib/glance/glance.sqlite', - $database_idle_timeout = $::os_service_default, - $database_min_pool_size = $::os_service_default, - $database_max_pool_size = $::os_service_default, - $database_max_retries = $::os_service_default, - $database_retry_interval = $::os_service_default, - $database_max_overflow = $::os_service_default, + $database_connection = undef, + $database_idle_timeout = undef, + $database_min_pool_size = undef, + $database_max_pool_size = undef, + $database_max_retries = undef, + $database_retry_interval = undef, + $database_max_overflow = undef, ) { - include ::glance::deps - - validate_re($database_connection, - '^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') - - oslo::db { 'glance_glare_config': - connection => $database_connection, - idle_timeout => $database_idle_timeout, - min_pool_size => $database_min_pool_size, - max_retries => $database_max_retries, - retry_interval => $database_retry_interval, - max_pool_size => $database_max_pool_size, - max_overflow => $database_max_overflow, - } + warning("Class ::glance::glare::db is deprecated since Glare was removed from Glance. \ +Now Glare is separated project and all configuration was moved to \ +puppet-glare module as well.") } diff --git a/manifests/glare/logging.pp b/manifests/glare/logging.pp index 0785a4a0..103c96da 100644 --- a/manifests/glare/logging.pp +++ b/manifests/glare/logging.pp @@ -1,134 +1,49 @@ # == Class glance::glare::logging # -# glance glare extended logging configuration +# glance glare extended logging configuration. Deprecated. # -# === Parameters +# === Deprecated parameters # # [*debug*] -# (Optional) Should the daemons log debug messages. -# Defaults to $::os_service_default. -# # [*use_syslog*] -# (Optional) Use syslog for logging. -# Defaults to $::os_service_default. -# # [*use_stderr*] -# (optional) Use stderr for logging. -# Defaults to $::os_service_default. -# # [*log_facility*] -# (Optional) Syslog facility to receive log lines. -# Defaults to $::os_service_default. -# # [*log_dir*] -# (optional) Directory where logs should be stored. -# If set to $::os_service_default, it will not log to any directory. -# Defaults to '/var/log/glance' -# # [*log_file*] -# (optional) File where logs should be stored. -# Defaults to '/var/log/glance/glare.log' -# -# [*logging_context_format_string*] -# (optional) Format string to use for log messages with context. -# Defaults to $::os_service_default -# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\ -# [%(request_id)s %(user_identity)s] %(instance)s%(message)s' -# -# [*logging_default_format_string*] -# (optional) Format string to use for log messages without context. -# Defaults to $::os_service_default. -# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\ -# [-] %(instance)s%(message)s' -# -# [*logging_debug_format_suffix*] -# (optional) Formatted data to append to log format when level is DEBUG. -# Defaults to $::os_service_default. -# Example: '%(funcName)s %(pathname)s:%(lineno)d' -# -# [*logging_exception_prefix*] -# (optional) Prefix each line of exception output with this format. -# Defaults to $::os_service_default. -# Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s' -# -# [*log_config_append*] -# The name of an additional logging configuration file. -# Defaults to $::os_service_default. -# See https://docs.python.org/2/howto/logging.html -# -# [*default_log_levels*] -# (optional) Hash of logger (keys) and level (values) pairs. -# Defaults to $::os_service_default. -# Example: -# {'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN', -# 'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN', -# 'requests.packages.urllib3.connectionpool' => 'WARN' } -# -# [*publish_errors*] -# (optional) Publish error events (boolean value). -# Defaults to $::os_service_default. -# -# [*fatal_deprecations*] -# (optional) Make deprecations fatal (boolean value). -# Defaults to $::os_service_default. -# -# [*instance_format*] -# (optional) If an instance is passed with the log message, format it -# like this (string value). -# Defaults to $::os_service_default. -# Example: '[instance: %(uuid)s] ' -# -# [*instance_uuid_format*] -# (optional) If an instance UUID is passed with the log message, format -# It like this (string value). -# Defaults to $::os_service_default. -# Example: instance_uuid_format='[instance: %(uuid)s] ' - -# [*log_date_format*] -# (optional) Format string for %%(asctime)s in log records. -# Defaults to $::os_service_default. -# Example: 'Y-%m-%d %H:%M:%S' +# [*logging_context_format_string*] +# [*logging_default_format_string*] +# [*logging_debug_format_suffix*] +# [*logging_exception_prefix*] +# [*log_config_append*] +# [*default_log_levels*] +# [*publish_errors*] +# [*fatal_deprecations*] +# [*instance_format*] +# [*instance_uuid_format*] +# [*log_date_format*] # class glance::glare::logging( - $use_syslog = $::os_service_default, - $use_stderr = $::os_service_default, - $log_facility = $::os_service_default, - $log_dir = '/var/log/glance', - $log_file = '/var/log/glance/glare.log', - $debug = $::os_service_default, - $logging_context_format_string = $::os_service_default, - $logging_default_format_string = $::os_service_default, - $logging_debug_format_suffix = $::os_service_default, - $logging_exception_prefix = $::os_service_default, - $log_config_append = $::os_service_default, - $default_log_levels = $::os_service_default, - $publish_errors = $::os_service_default, - $fatal_deprecations = $::os_service_default, - $instance_format = $::os_service_default, - $instance_uuid_format = $::os_service_default, - $log_date_format = $::os_service_default, + $use_syslog = undef, + $use_stderr = undef, + $log_facility = undef, + $log_dir = undef, + $log_file = undef, + $debug = undef, + $logging_context_format_string = undef, + $logging_default_format_string = undef, + $logging_debug_format_suffix = undef, + $logging_exception_prefix = undef, + $log_config_append = undef, + $default_log_levels = undef, + $publish_errors = undef, + $fatal_deprecations = undef, + $instance_format = undef, + $instance_uuid_format = undef, + $log_date_format = undef, ) { - include ::glance::deps - - oslo::log { 'glance_glare_config': - debug => $debug, - use_stderr => $use_stderr, - use_syslog => $use_syslog, - log_dir => $log_dir, - log_file => $log_file, - syslog_log_facility => $log_facility, - logging_context_format_string => $logging_context_format_string, - logging_default_format_string => $logging_default_format_string, - logging_debug_format_suffix => $logging_debug_format_suffix, - logging_exception_prefix => $logging_exception_prefix, - log_config_append => $log_config_append, - default_log_levels => $default_log_levels, - publish_errors => $publish_errors, - fatal_deprecations => $fatal_deprecations, - instance_format => $instance_format, - instance_uuid_format => $instance_uuid_format, - log_date_format => $log_date_format, - } + warning("Class ::glance::glare::logging is deprecated since Glare was \ +removed from Glance. Now Glare is separated project and all configuration \ +was moved to puppet-glare module as well.") } diff --git a/manifests/keystone/glare_auth.pp b/manifests/keystone/glare_auth.pp index 9112e9ab..30d9640d 100644 --- a/manifests/keystone/glare_auth.pp +++ b/manifests/keystone/glare_auth.pp @@ -1,105 +1,43 @@ # == Class: glance::keystone::glare_auth # -# Sets up glare users, service and endpoint for Glance Glare +# Sets up glare users, service and endpoint for Glance Glare. Deprecated. # -# == Parameters: +# == Deprecated parameters # # [*password*] -# Password for glare user. Required. -# # [*email*] -# Email for glance user. Optional. Defaults to 'glare@localhost'. -# # [*auth_name*] -# Username for glare service. Optional. Defaults to 'glare'. -# # [*configure_endpoint*] -# Should glare endpoint be configured? Optional. Defaults to 'true'. -# # [*configure_user*] -# Should the service user be configured? Optional. Defaults to 'true'. -# # [*configure_user_role*] -# Should the admin role be configured for the service user? -# Optional. Defaults to 'true'. -# # [*service_name*] -# Name of the service. Optional. -# Defaults to 'Glance Artifacts'. -# # [*service_type*] -# Type of service. Optional. Defaults to 'artifact'. -# # [*service_description*] -# Description for keystone service. Optional. Defaults to 'Glance Artifact Service'. -# # [*region*] -# Region for endpoint. Optional. Defaults to 'RegionOne'. -# # [*tenant*] -# Tenant for glare user. Optional. Defaults to 'services'. -# # [*public_url*] -# (optional) The endpoint's public url. (Defaults to 'http://127.0.0.1:9494') -# This url should *not* contain any trailing '/'. -# # [*admin_url*] -# (optional) The endpoint's admin url. (Defaults to 'http://127.0.0.1:9494') -# This url should *not* contain any trailing '/'. -# # [*internal_url*] -# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:9494') -# This url should *not* contain any trailing '/'. -# -# === Examples -# -# class { 'glance::keystone::glare_auth': -# public_url => 'https://10.0.0.10:9494', -# internal_url => 'https://10.0.0.11:9494', -# admin_url => 'https://10.0.0.11:9494', -# } # class glance::keystone::glare_auth( - $password, - $email = 'glare@localhost', - $auth_name = 'glare', - $configure_endpoint = true, - $configure_user = true, - $configure_user_role = true, - $service_name = 'Glance Artifacts', - $service_type = 'artifact', - $region = 'RegionOne', - $tenant = 'services', - $service_description = 'Glance Artifact Service', - $public_url = 'http://127.0.0.1:9494', - $admin_url = 'http://127.0.0.1:9494', - $internal_url = 'http://127.0.0.1:9494', + $password = undef, + $email = undef, + $auth_name = undef, + $configure_endpoint = undef, + $configure_user = undef, + $configure_user_role = undef, + $service_name = undef, + $service_type = undef, + $region = undef, + $tenant = undef, + $service_description = undef, + $public_url = undef, + $admin_url = undef, + $internal_url = undef, ) { - include ::glance::deps + warning("Class ::glance::keystone::glare_auth is deprecated since Glare was \ +removed from Glance. Now Glare is separated project and all configuration was \ +moved to puppet-glare module as well.") - if $configure_endpoint { - Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Anchor['glance::service::begin'] - } - - keystone::resource::service_identity { 'glare': - configure_user => $configure_user, - configure_user_role => $configure_user_role, - configure_endpoint => $configure_endpoint, - service_type => $service_type, - service_description => $service_description, - service_name => $service_name, - auth_name => $auth_name, - region => $region, - password => $password, - email => $email, - tenant => $tenant, - public_url => $public_url, - admin_url => $admin_url, - internal_url => $internal_url, - } - - if $configure_user_role { - Keystone_user_role["${auth_name}@${tenant}"] ~> Anchor['glance::service::begin'] - } } diff --git a/manifests/params.pp b/manifests/params.pp index efa29425..aa7f340a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -11,10 +11,8 @@ class glance::params { case $::osfamily { 'RedHat': { $api_package_name = 'openstack-glance' - $glare_package_name = 'openstack-glance' $registry_package_name = 'openstack-glance' $api_service_name = 'openstack-glance-api' - $glare_service_name = 'openstack-glance-glare' $registry_service_name = 'openstack-glance-registry' if ($::operatingsystem != 'fedora' and versioncmp($::operatingsystemrelease, '7') < 0) { $pyceph_package_name = 'python-ceph' @@ -24,10 +22,8 @@ class glance::params { } 'Debian': { $api_package_name = 'glance-api' - $glare_package_name = 'glance-glare' $registry_package_name = 'glance-registry' $api_service_name = 'glance-api' - $glare_service_name = 'glance-glare' $registry_service_name = 'glance-registry' $pyceph_package_name = 'python-ceph' } diff --git a/releasenotes/notes/drop_glare_from_glance-8a1d09f8a0613229.yaml b/releasenotes/notes/drop_glare_from_glance-8a1d09f8a0613229.yaml new file mode 100644 index 00000000..40a1610f --- /dev/null +++ b/releasenotes/notes/drop_glare_from_glance-8a1d09f8a0613229.yaml @@ -0,0 +1,4 @@ +--- +deprecations: + - Drop Glare service from puppet-glance, since Glare service was removed + from Glance itself and now it is separate project. diff --git a/spec/acceptance/glance_config_spec.rb b/spec/acceptance/glance_config_spec.rb index 6074cfe5..b2e77edb 100644 --- a/spec/acceptance/glance_config_spec.rb +++ b/spec/acceptance/glance_config_spec.rb @@ -11,7 +11,6 @@ describe 'basic glance config resource' do File <||> -> Glance_api_config <||> File <||> -> Glance_registry_config <||> File <||> -> Glance_cache_config <||> - File <||> -> Glance_glare_config <||> file { '/etc/glance' : ensure => directory, @@ -25,9 +24,6 @@ describe 'basic glance config resource' do file { '/etc/glance/glance-cache.conf' : ensure => file, } - file { '/etc/glance/glance-glare.conf' : - ensure => file, - } glance_api_config { 'DEFAULT/thisshouldexist' : value => 'foo', @@ -83,23 +79,6 @@ describe 'basic glance config resource' do ensure_absent_val => 'toto', } - glance_glare_config { 'DEFAULT/thisshouldexist' : - value => 'foo', - } - - glance_glare_config { 'DEFAULT/thisshouldnotexist' : - value => '', - } - - glance_glare_config { 'DEFAULT/thisshouldexist2' : - value => '', - ensure_absent_val => 'toto', - } - - glance_glare_config { 'DEFAULT/thisshouldnotexist2' : - value => 'toto', - ensure_absent_val => 'toto', - } EOS @@ -141,15 +120,5 @@ describe 'basic glance config resource' do end end - describe file('/etc/glance/glance-glare.conf') do - it { is_expected.to exist } - it { is_expected.to contain('thisshouldexist=foo') } - it { is_expected.to contain('thisshouldexist2=') } - - describe '#content' do - subject { super().content } - it { is_expected.not_to match /thisshouldnotexist/ } - end - end end end diff --git a/spec/classes/glance_backend_cinder_spec.rb b/spec/classes/glance_backend_cinder_spec.rb index 256d0359..1519cdc1 100644 --- a/spec/classes/glance_backend_cinder_spec.rb +++ b/spec/classes/glance_backend_cinder_spec.rb @@ -46,13 +46,6 @@ describe 'glance::backend::cinder' do is_expected.to contain_glance_cache_config('glance_store/cinder_ca_certificates_file').with_value('') is_expected.to contain_glance_cache_config('glance_store/cinder_endpoint_template').with_value('') end - it 'not configures glance-glare.conf' do - is_expected.to_not contain_glance_glare_config('glance_store/cinder_api_insecure').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/cinder_catalog_info').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/cinder_http_retries').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/cinder_ca_certificates_file').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/cinder_endpoint_template').with_value('') - end end context 'when overriding parameters' do @@ -63,7 +56,6 @@ describe 'glance::backend::cinder' do :cinder_catalog_info => 'volume:cinder:internalURL', :cinder_endpoint_template => 'http://srv-foo:8776/v1/%(project_id)s', :cinder_http_retries => '10', - :glare_enabled => true, } end it 'configures glance-api.conf' do @@ -80,13 +72,6 @@ describe 'glance::backend::cinder' do is_expected.to contain_glance_cache_config('glance_store/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s') is_expected.to contain_glance_cache_config('glance_store/cinder_http_retries').with_value('10') end - it 'configures glance-glare.conf' do - is_expected.to contain_glance_glare_config('glance_store/cinder_api_insecure').with_value(true) - is_expected.to contain_glance_glare_config('glance_store/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt') - is_expected.to contain_glance_glare_config('glance_store/cinder_catalog_info').with_value('volume:cinder:internalURL') - is_expected.to contain_glance_glare_config('glance_store/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s') - is_expected.to contain_glance_glare_config('glance_store/cinder_http_retries').with_value('10') - end end end diff --git a/spec/classes/glance_backend_file_spec.rb b/spec/classes/glance_backend_file_spec.rb index d5d46a3d..9cb4d584 100644 --- a/spec/classes/glance_backend_file_spec.rb +++ b/spec/classes/glance_backend_file_spec.rb @@ -12,14 +12,9 @@ describe 'glance::backend::file' do is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/') end - it 'configures glance-glare.conf' do - is_expected.to_not contain_glance_glare_config('glance_store/filesystem_store_datadir').with_value('/tmp/') - end - describe 'when overriding datadir' do let :params do - {:filesystem_store_datadir => '/tmp/', - :glare_enabled => true,} + {:filesystem_store_datadir => '/tmp/'} end it 'configures glance-api.conf' do @@ -30,9 +25,6 @@ describe 'glance::backend::file' do is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/tmp/') end - it 'configures glance-glare.conf' do - is_expected.to contain_glance_glare_config('glance_store/filesystem_store_datadir').with_value('/tmp/') - end end end diff --git a/spec/classes/glance_backend_rbd_spec.rb b/spec/classes/glance_backend_rbd_spec.rb index 78b71180..dba6a1f5 100644 --- a/spec/classes/glance_backend_rbd_spec.rb +++ b/spec/classes/glance_backend_rbd_spec.rb @@ -16,12 +16,6 @@ describe 'glance::backend::rbd' do it { is_expected.to contain_glance_api_config('glance_store/rados_connect_timeout').with_value('')} it { is_expected.to contain_glance_api_config('glance_store/rbd_store_user').with_value('')} - it { is_expected.to_not contain_glance_glare_config('glance_store/default_store').with_value('rbd') } - it { is_expected.to_not contain_glance_glare_config('glance_store/rbd_store_pool').with_value('') } - it { is_expected.to_not contain_glance_glare_config('glance_store/rbd_store_ceph_conf').with_value('') } - it { is_expected.to_not contain_glance_glare_config('glance_store/rbd_store_chunk_size').with_value('') } - it { is_expected.to_not contain_glance_glare_config('glance_store/rados_connect_timeout').with_value('')} - it { is_expected.to_not contain_glance_glare_config('glance_store/rbd_store_user').with_value('')} it { is_expected.to contain_package('python-ceph').with( :name => 'python-ceph', :ensure => 'present' @@ -36,15 +30,11 @@ describe 'glance::backend::rbd' do :rbd_store_chunk_size => '2', :package_ensure => 'latest', :rados_connect_timeout => '30', - :glare_enabled => true, } end it { is_expected.to contain_glance_api_config('glance_store/rbd_store_user').with_value('user') } it { is_expected.to contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('2') } it { is_expected.to contain_glance_api_config('glance_store/rados_connect_timeout').with_value('30')} - it { is_expected.to contain_glance_glare_config('glance_store/rbd_store_user').with_value('user') } - it { is_expected.to contain_glance_glare_config('glance_store/rbd_store_chunk_size').with_value('2') } - it { is_expected.to contain_glance_glare_config('glance_store/rados_connect_timeout').with_value('30')} it { is_expected.to contain_package('python-ceph').with( :name => 'python-ceph', :ensure => 'latest' diff --git a/spec/classes/glance_backend_s3_spec.rb b/spec/classes/glance_backend_s3_spec.rb index 1b8fc7ce..5212742d 100644 --- a/spec/classes/glance_backend_s3_spec.rb +++ b/spec/classes/glance_backend_s3_spec.rb @@ -26,20 +26,6 @@ describe 'glance::backend::s3' do is_expected.to contain_glance_api_config('glance_store/s3_store_object_buffer_dir').with_value('') is_expected.to contain_glance_api_config('glance_store/s3_store_thread_pools').with_value('') end - it 'not configures glance-glare.conf' do - is_expected.to_not contain_glance_glare_config('glance_store/default_store').with_value('s3') - is_expected.to_not contain_glance_glare_config('glance_store/s3_store_access_key').with_value('access') - is_expected.to_not contain_glance_glare_config('glance_store/s3_store_secret_key').with_value('secret') - is_expected.to_not contain_glance_glare_config('glance_store/s3_store_host').with_value('host') - is_expected.to_not contain_glance_glare_config('glance_store/s3_store_bucket').with_value('bucket') - is_expected.to_not contain_glance_glare_config('glance_store/s3_store_bucket_url_format').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/s3_store_create_bucket_on_put').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/s3_store_large_object_size').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/s3_store_large_object_chunk_size').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/s3_store_object_buffer_dir').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/s3_store_thread_pools').with_value('') - end - end describe 'when overriding parameters' do @@ -55,7 +41,6 @@ describe 'glance::backend::s3' do :large_object_chunk_size => 20, :object_buffer_dir => '/tmp', :thread_pools => 20, - :glare_enabled => true, } end @@ -71,19 +56,6 @@ describe 'glance::backend::s3' do is_expected.to contain_glance_api_config('glance_store/s3_store_object_buffer_dir').with_value('/tmp') is_expected.to contain_glance_api_config('glance_store/s3_store_thread_pools').with_value('20') end - - it 'configures glance-glare.conf' do - is_expected.to contain_glance_glare_config('glance_store/s3_store_access_key').with_value('access2') - is_expected.to contain_glance_glare_config('glance_store/s3_store_secret_key').with_value('secret2') - is_expected.to contain_glance_glare_config('glance_store/s3_store_host').with_value('host2') - is_expected.to contain_glance_glare_config('glance_store/s3_store_bucket').with_value('bucket2') - is_expected.to contain_glance_glare_config('glance_store/s3_store_bucket_url_format').with_value('path') - is_expected.to contain_glance_glare_config('glance_store/s3_store_create_bucket_on_put').with_value('true') - is_expected.to contain_glance_glare_config('glance_store/s3_store_large_object_size').with_value('200') - is_expected.to contain_glance_glare_config('glance_store/s3_store_large_object_chunk_size').with_value('20') - is_expected.to contain_glance_glare_config('glance_store/s3_store_object_buffer_dir').with_value('/tmp') - is_expected.to contain_glance_glare_config('glance_store/s3_store_thread_pools').with_value('20') - end end describe 'with invalid bucket_url_format' do diff --git a/spec/classes/glance_backend_swift_spec.rb b/spec/classes/glance_backend_swift_spec.rb index 83f44ce3..e1d8ac42 100644 --- a/spec/classes/glance_backend_swift_spec.rb +++ b/spec/classes/glance_backend_swift_spec.rb @@ -34,17 +34,6 @@ describe 'glance::backend::swift' do is_expected.to contain_glance_swift_config('ref1/user_domain_id').with_value('default') is_expected.to contain_glance_swift_config('ref1/project_domain_id').with_value('default') end - - it 'not configures glance-glare.conf' do - is_expected.to_not contain_glance_glare_config('glance_store/default_store').with_value('swift') - is_expected.to_not contain_glance_glare_config('glance_store/swift_store_large_object_size').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/swift_store_container').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/swift_store_create_container_on_put').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/swift_store_endpoint_type').with_value('internalURL') - is_expected.to_not contain_glance_glare_config('glance_store/swift_store_region').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/swift_store_config_file').with_value('/etc/glance/glance-swift.conf') - is_expected.to_not contain_glance_glare_config('glance_store/default_swift_reference').with_value('ref1') - end end describe 'when overriding parameters' do @@ -62,7 +51,6 @@ describe 'glance::backend::swift' do :swift_store_endpoint_type => 'publicURL', :swift_store_region => 'RegionTwo', :default_swift_reference => 'swift_creds', - :glare_enabled => true, } end @@ -80,15 +68,6 @@ describe 'glance::backend::swift' do is_expected.to contain_glance_swift_config('swift_creds/user_domain_id').with_value('user_domain') is_expected.to contain_glance_swift_config('swift_creds/project_domain_id').with_value('proj_domain') end - - it 'configures glance-glare.conf' do - is_expected.to contain_glance_glare_config('glance_store/swift_store_container').with_value('swift') - is_expected.to contain_glance_glare_config('glance_store/swift_store_create_container_on_put').with_value(true) - is_expected.to contain_glance_glare_config('glance_store/swift_store_large_object_size').with_value('100') - is_expected.to contain_glance_glare_config('glance_store/swift_store_endpoint_type').with_value('publicURL') - is_expected.to contain_glance_glare_config('glance_store/swift_store_region').with_value('RegionTwo') - is_expected.to contain_glance_glare_config('glance_store/default_swift_reference').with_value('swift_creds') - end end end diff --git a/spec/classes/glance_backend_vsphere_spec.rb b/spec/classes/glance_backend_vsphere_spec.rb index d52f6482..6ddd53e2 100644 --- a/spec/classes/glance_backend_vsphere_spec.rb +++ b/spec/classes/glance_backend_vsphere_spec.rb @@ -50,18 +50,6 @@ describe 'glance::backend::vsphere' do is_expected.to contain_glance_api_config('glance_store/vmware_datastores').with_value('Datacenter:Datastore') is_expected.to contain_glance_api_config('glance_store/vmware_ca_file').with_value('') end - it 'not configures glance-glare.conf' do - is_expected.to_not contain_glance_glare_config('glance_store/default_store').with_value('vsphere') - is_expected.to_not contain_glance_glare_config('glance_store/vmware_insecure').with_value('True') - is_expected.to_not contain_glance_glare_config('glance_store/vmware_server_host').with_value('10.0.0.1') - is_expected.to_not contain_glance_glare_config('glance_store/vmware_server_username').with_value('root') - is_expected.to_not contain_glance_glare_config('glance_store/vmware_server_password').with_value('123456').with_secret(true) - is_expected.to_not contain_glance_glare_config('glance_store/vmware_store_image_dir').with_value('/openstack_glance') - is_expected.to_not contain_glance_glare_config('glance_store/vmware_task_poll_interval').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/vmware_api_retry_count').with_value('') - is_expected.to_not contain_glance_glare_config('glance_store/vmware_datastores').with_value('Datacenter:Datastore') - is_expected.to_not contain_glance_glare_config('glance_store/vmware_ca_file').with_value('') - end end context 'when overriding parameters' do @@ -75,7 +63,6 @@ describe 'glance::backend::vsphere' do :vcenter_ca_file => '/etc/glance/vcenter-ca.pem', :vcenter_task_poll_interval => '6', :vcenter_api_retry_count => '11', - :glare_enabled => true, } end it 'configures glance-api.conf' do @@ -83,12 +70,6 @@ describe 'glance::backend::vsphere' do is_expected.to contain_glance_api_config('glance_store/vmware_task_poll_interval').with_value('6') is_expected.to contain_glance_api_config('glance_store/vmware_api_retry_count').with_value('11') end - - it 'configures glance-glare.conf' do - is_expected.to contain_glance_glare_config('glance_store/vmware_ca_file').with_value('/etc/glance/vcenter-ca.pem') - is_expected.to contain_glance_glare_config('glance_store/vmware_task_poll_interval').with_value('6') - is_expected.to contain_glance_glare_config('glance_store/vmware_api_retry_count').with_value('11') - end end end diff --git a/spec/classes/glance_config_spec.rb b/spec/classes/glance_config_spec.rb index 4245bed4..d171ec23 100644 --- a/spec/classes/glance_config_spec.rb +++ b/spec/classes/glance_config_spec.rb @@ -47,25 +47,6 @@ describe 'glance::config' do end end - shared_examples_for 'glance_glare_config' do - let :params do - { :glare_config => config_hash, - :glare_paste_ini_config => config_hash } - end - - it 'configures arbitrary glance-glare configurations' do - is_expected.to contain_glance_glare_config('DEFAULT/foo').with_value('fooValue') - is_expected.to contain_glance_glare_config('DEFAULT/bar').with_value('barValue') - is_expected.to contain_glance_glare_config('DEFAULT/baz').with_ensure('absent') - end - - it 'configures arbitrary glance-glare-paste configurations' do - is_expected.to contain_glance_glare_paste_ini('DEFAULT/foo').with_value('fooValue') - is_expected.to contain_glance_glare_paste_ini('DEFAULT/bar').with_value('barValue') - is_expected.to contain_glance_glare_paste_ini('DEFAULT/baz').with_ensure('absent') - end - end - shared_examples_for 'glance_cache_config' do let :params do { :cache_config => config_hash } @@ -88,7 +69,6 @@ describe 'glance::config' do it_configures 'glance_api_config' it_configures 'glance_registry_config' - it_configures 'glance_glare_config' it_configures 'glance_cache_config' end end diff --git a/spec/classes/glance_glare_authtoken_spec.rb b/spec/classes/glance_glare_authtoken_spec.rb deleted file mode 100644 index 8cb3195b..00000000 --- a/spec/classes/glance_glare_authtoken_spec.rb +++ /dev/null @@ -1,147 +0,0 @@ -require 'spec_helper' - -describe 'glance::glare::authtoken' do - - let :params do - { :password => 'glance_glare_password', } - end - - shared_examples 'glance_glare authtoken' do - - context 'with default parameters' do - - it 'configure keystone_authtoken' do - is_expected.to contain_glance_glare_config('keystone_authtoken/username').with_value('glance') - is_expected.to contain_glance_glare_config('keystone_authtoken/password').with_value('glance_glare_password') - is_expected.to contain_glance_glare_config('keystone_authtoken/auth_url').with_value('http://127.0.0.1:35357') - is_expected.to contain_glance_glare_config('keystone_authtoken/project_name').with_value('services') - is_expected.to contain_glance_glare_config('keystone_authtoken/user_domain_name').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/project_domain_name').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/insecure').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/auth_section').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/auth_type').with_value('password') - is_expected.to contain_glance_glare_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000') - is_expected.to contain_glance_glare_config('keystone_authtoken/auth_version').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/cache').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/cafile').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/certfile').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/check_revocations_for_cached').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/delay_auth_decision').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/enforce_token_bind').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/hash_algorithms').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/http_connect_timeout').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/http_request_max_retries').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/include_service_catalog').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/keyfile').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_pool_dead_retry').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_pool_maxsize').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_pool_socket_timeout').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_pool_unused_timeout').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_secret_key').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_security_strategy').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_use_advanced_pool').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/memcached_servers').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/region_name').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/revocation_cache_time').with_value('') - is_expected.to contain_glance_glare_config('keystone_authtoken/token_cache_time').with_value('') - end - end - - context 'when overriding parameters' do - before do - params.merge!({ - :auth_uri => 'https://10.0.0.1:9999/', - :username => 'myuser', - :password => 'mypasswd', - :auth_url => 'http://:127.0.0.1:35357', - :project_name => 'service_project', - :user_domain_name => 'domainX', - :project_domain_name => 'domainX', - :insecure => false, - :auth_section => 'new_section', - :auth_type => 'password', - :auth_version => 'v3', - :cache => 'somevalue', - :cafile => '/opt/stack/data/cafile.pem', - :certfile => 'certfile.crt', - :check_revocations_for_cached => false, - :delay_auth_decision => false, - :enforce_token_bind => 'permissive', - :hash_algorithms => 'md5', - :http_connect_timeout => '300', - :http_request_max_retries => '3', - :include_service_catalog => true, - :keyfile => 'keyfile', - :memcache_pool_conn_get_timeout => '9', - :memcache_pool_dead_retry => '302', - :memcache_pool_maxsize => '11', - :memcache_pool_socket_timeout => '2', - :memcache_pool_unused_timeout => '61', - :memcache_secret_key => 'secret_key', - :memcache_security_strategy => 'ENCRYPT', - :memcache_use_advanced_pool => true, - :memcached_servers => ['memcached01:11211','memcached02:11211'], - :manage_memcache_package => true, - :region_name => 'region2', - :revocation_cache_time => '11', - :token_cache_time => '301', - }) - end - - it 'configure keystone_authtoken' do - is_expected.to contain_glance_glare_config('keystone_authtoken/auth_uri').with_value('https://10.0.0.1:9999/') - is_expected.to contain_glance_glare_config('keystone_authtoken/username').with_value(params[:username]) - is_expected.to contain_glance_glare_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true) - is_expected.to contain_glance_glare_config('keystone_authtoken/auth_url').with_value(params[:auth_url]) - is_expected.to contain_glance_glare_config('keystone_authtoken/project_name').with_value(params[:project_name]) - is_expected.to contain_glance_glare_config('keystone_authtoken/user_domain_name').with_value(params[:user_domain_name]) - is_expected.to contain_glance_glare_config('keystone_authtoken/project_domain_name').with_value(params[:project_domain_name]) - is_expected.to contain_glance_glare_config('keystone_authtoken/insecure').with_value(params[:insecure]) - is_expected.to contain_glance_glare_config('keystone_authtoken/auth_section').with_value(params[:auth_section]) - is_expected.to contain_glance_glare_config('keystone_authtoken/auth_type').with_value(params[:auth_type]) - is_expected.to contain_glance_glare_config('keystone_authtoken/auth_version').with_value(params[:auth_version]) - is_expected.to contain_glance_glare_config('keystone_authtoken/cache').with_value(params[:cache]) - is_expected.to contain_glance_glare_config('keystone_authtoken/cafile').with_value(params[:cafile]) - is_expected.to contain_glance_glare_config('keystone_authtoken/certfile').with_value(params[:certfile]) - is_expected.to contain_glance_glare_config('keystone_authtoken/check_revocations_for_cached').with_value(params[:check_revocations_for_cached]) - is_expected.to contain_glance_glare_config('keystone_authtoken/delay_auth_decision').with_value(params[:delay_auth_decision]) - is_expected.to contain_glance_glare_config('keystone_authtoken/enforce_token_bind').with_value(params[:enforce_token_bind]) - is_expected.to contain_glance_glare_config('keystone_authtoken/hash_algorithms').with_value(params[:hash_algorithms]) - is_expected.to contain_glance_glare_config('keystone_authtoken/http_connect_timeout').with_value(params[:http_connect_timeout]) - is_expected.to contain_glance_glare_config('keystone_authtoken/http_request_max_retries').with_value(params[:http_request_max_retries]) - is_expected.to contain_glance_glare_config('keystone_authtoken/include_service_catalog').with_value(params[:include_service_catalog]) - is_expected.to contain_glance_glare_config('keystone_authtoken/keyfile').with_value(params[:keyfile]) - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value(params[:memcache_pool_conn_get_timeout]) - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_pool_dead_retry').with_value(params[:memcache_pool_dead_retry]) - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_pool_maxsize').with_value(params[:memcache_pool_maxsize]) - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_pool_socket_timeout').with_value(params[:memcache_pool_socket_timeout]) - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_pool_unused_timeout').with_value(params[:memcache_pool_unused_timeout]) - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_secret_key').with_value(params[:memcache_secret_key]) - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_security_strategy').with_value(params[:memcache_security_strategy]) - is_expected.to contain_glance_glare_config('keystone_authtoken/memcache_use_advanced_pool').with_value(params[:memcache_use_advanced_pool]) - is_expected.to contain_glance_glare_config('keystone_authtoken/memcached_servers').with_value('memcached01:11211,memcached02:11211') - is_expected.to contain_glance_glare_config('keystone_authtoken/region_name').with_value(params[:region_name]) - is_expected.to contain_glance_glare_config('keystone_authtoken/revocation_cache_time').with_value(params[:revocation_cache_time]) - is_expected.to contain_glance_glare_config('keystone_authtoken/token_cache_time').with_value(params[:token_cache_time]) - end - - it 'installs python memcache package' do - is_expected.to contain_package('python-memcache') - end - end - end - - on_supported_os({ - :supported_os => OSDefaults.get_supported_os - }).each do |os,facts| - context "on #{os}" do - let (:facts) do - facts.merge!(OSDefaults.get_facts()) - end - - it_configures 'glance_glare authtoken' - end - end - -end diff --git a/spec/classes/glance_glare_db_spec.rb b/spec/classes/glance_glare_db_spec.rb deleted file mode 100644 index 064fde8f..00000000 --- a/spec/classes/glance_glare_db_spec.rb +++ /dev/null @@ -1,94 +0,0 @@ -require 'spec_helper' - -describe 'glance::glare::db' do - - shared_examples 'glance::glare::db' do - context 'with default parameters' do - it { is_expected.to contain_glance_glare_config('database/connection').with_value('sqlite:///var/lib/glance/glance.sqlite').with_secret(true) } - it { is_expected.to contain_glance_glare_config('database/idle_timeout').with_value('') } - it { is_expected.to contain_glance_glare_config('database/min_pool_size').with_value('') } - it { is_expected.to contain_glance_glare_config('database/max_retries').with_value('') } - it { is_expected.to contain_glance_glare_config('database/retry_interval').with_value('') } - it { is_expected.to contain_glance_glare_config('database/max_pool_size').with_value('') } - it { is_expected.to contain_glance_glare_config('database/max_overflow').with_value('') } - end - - context 'with specific parameters' do - let :params do - { :database_connection => 'mysql+pymysql://glance_glare:glance@localhost/glance', - :database_idle_timeout => '3601', - :database_min_pool_size => '2', - :database_max_retries => '11', - :database_retry_interval => '11', - :database_max_pool_size => '11', - :database_max_overflow => '21', - } - end - - it { is_expected.to contain_glance_glare_config('database/connection').with_value('mysql+pymysql://glance_glare:glance@localhost/glance').with_secret(true) } - it { is_expected.to contain_glance_glare_config('database/idle_timeout').with_value('3601') } - it { is_expected.to contain_glance_glare_config('database/min_pool_size').with_value('2') } - it { is_expected.to contain_glance_glare_config('database/max_retries').with_value('11') } - it { is_expected.to contain_glance_glare_config('database/retry_interval').with_value('11') } - it { is_expected.to contain_glance_glare_config('database/max_pool_size').with_value('11') } - it { is_expected.to contain_glance_glare_config('database/max_overflow').with_value('21') } - end - - context 'with MySQL-python library as backend package' do - let :params do - { :database_connection => 'mysql://glance_glare:glance@localhost/glance' } - end - - it { is_expected.to contain_package('python-mysqldb').with(:ensure => 'present') } - end - - context 'with incorrect pymysql database_connection string' do - let :params do - { :database_connection => 'foo+pymysql://glance_glare:glance@localhost/glance', } - end - - it_raises 'a Puppet::Error', /validate_re/ - end - - end - - shared_examples_for 'glance::glare::db Debian' do - context 'using pymysql driver' do - let :params do - { :database_connection => 'mysql+pymysql://glance_glare:glance@localhost/glance', } - end - - it 'install the proper backend package' do - is_expected.to contain_package('python-pymysql').with( - :ensure => 'present', - :name => 'python-pymysql', - :tag => 'openstack' - ) - end - end - end - - shared_examples_for 'glance::glare::db RedHat' do - context 'using pymysql driver' do - let :params do - { :database_connection => 'mysql+pymysql://glance_glare:glance@localhost/glance', } - end - - end - end - - on_supported_os({ - :supported_os => OSDefaults.get_supported_os - }).each do |os,facts| - context "on #{os}" do - let (:facts) do - facts.merge!(OSDefaults.get_facts()) - end - - it_configures 'glance::glare::db' - it_configures "glance::glare::db #{facts[:osfamily]}" - end - end - -end - diff --git a/spec/classes/glance_glare_logging_spec.rb b/spec/classes/glance_glare_logging_spec.rb deleted file mode 100644 index 658e9607..00000000 --- a/spec/classes/glance_glare_logging_spec.rb +++ /dev/null @@ -1,138 +0,0 @@ -require 'spec_helper' - -describe 'glance::glare::logging' do - - let :params do - { - } - end - - let :log_params do - { - :logging_context_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s', - :logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s', - :logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d', - :logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s', - :log_config_append => '/etc/glance/logging.conf', - :publish_errors => true, - :default_log_levels => { - 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN', - 'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN', - 'requests.packages.urllib3.connectionpool' => 'WARN' }, - :fatal_deprecations => true, - :instance_format => '[instance: %(uuid)s] ', - :instance_uuid_format => '[instance: %(uuid)s] ', - :log_date_format => '%Y-%m-%d %H:%M:%S', - :use_syslog => true, - :use_stderr => false, - :log_facility => 'LOG_FOO', - :log_dir => '/var/log', - :log_file => '/var/tmp/glance_glare_random.log', - :debug => true, - } - end - - shared_examples_for 'glance-glare-logging' do - - context 'with basic logging options and default settings' do - it_configures 'basic default logging settings' - end - - context 'with basic logging options and non-default settings' do - before { params.merge!( log_params ) } - it_configures 'basic non-default logging settings' - end - - context 'with extended logging options' do - before { params.merge!( log_params ) } - it_configures 'logging params set' - end - - context 'without extended logging options' do - it_configures 'logging params unset' - end - - end - - shared_examples 'basic default logging settings' do - it 'configures glance logging settings with default values' do - is_expected.to contain_glance_glare_config('DEFAULT/use_syslog').with(:value => '') - is_expected.to contain_glance_glare_config('DEFAULT/use_stderr').with(:value => '') - is_expected.to contain_glance_glare_config('DEFAULT/log_dir').with(:value => '/var/log/glance') - is_expected.to contain_glance_glare_config('DEFAULT/log_file').with(:value => '/var/log/glance/glare.log') - is_expected.to contain_glance_glare_config('DEFAULT/debug').with(:value => '') - end - end - - shared_examples 'basic non-default logging settings' do - it 'configures glance logging settings with non-default values' do - is_expected.to contain_glance_glare_config('DEFAULT/use_syslog').with(:value => 'true') - is_expected.to contain_glance_glare_config('DEFAULT/use_stderr').with(:value => 'false') - is_expected.to contain_glance_glare_config('DEFAULT/syslog_log_facility').with(:value => 'LOG_FOO') - is_expected.to contain_glance_glare_config('DEFAULT/log_dir').with(:value => '/var/log') - is_expected.to contain_glance_glare_config('DEFAULT/log_file').with(:value => '/var/tmp/glance_glare_random.log') - is_expected.to contain_glance_glare_config('DEFAULT/debug').with(:value => 'true') - end - end - - shared_examples_for 'logging params set' do - it 'enables logging params' do - is_expected.to contain_glance_glare_config('DEFAULT/logging_context_format_string').with_value( - '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s') - - is_expected.to contain_glance_glare_config('DEFAULT/logging_default_format_string').with_value( - '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s') - - is_expected.to contain_glance_glare_config('DEFAULT/logging_debug_format_suffix').with_value( - '%(funcName)s %(pathname)s:%(lineno)d') - - is_expected.to contain_glance_glare_config('DEFAULT/logging_exception_prefix').with_value( - '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s') - - is_expected.to contain_glance_glare_config('DEFAULT/log_config_append').with_value( - '/etc/glance/logging.conf') - is_expected.to contain_glance_glare_config('DEFAULT/publish_errors').with_value( - true) - - is_expected.to contain_glance_glare_config('DEFAULT/default_log_levels').with_value( - 'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO') - - is_expected.to contain_glance_glare_config('DEFAULT/fatal_deprecations').with_value( - true) - - is_expected.to contain_glance_glare_config('DEFAULT/instance_format').with_value( - '[instance: %(uuid)s] ') - - is_expected.to contain_glance_glare_config('DEFAULT/instance_uuid_format').with_value( - '[instance: %(uuid)s] ') - - is_expected.to contain_glance_glare_config('DEFAULT/log_date_format').with_value( - '%Y-%m-%d %H:%M:%S') - end - end - - - shared_examples_for 'logging params unset' do - [ :logging_context_format_string, :logging_default_format_string, - :logging_debug_format_suffix, :logging_exception_prefix, - :log_config_append, :publish_errors, - :default_log_levels, :fatal_deprecations, - :instance_format, :instance_uuid_format, - :log_date_format, ].each { |param| - it { is_expected.to contain_glance_glare_config("DEFAULT/#{param}").with_value('') } - } - end - - on_supported_os({ - :supported_os => OSDefaults.get_supported_os - }).each do |os,facts| - context "on #{os}" do - let (:facts) do - facts.merge!(OSDefaults.get_facts()) - end - - it_configures 'glance-glare-logging' - end - end - -end diff --git a/spec/classes/glance_glare_spec.rb b/spec/classes/glance_glare_spec.rb deleted file mode 100644 index 6c105c7d..00000000 --- a/spec/classes/glance_glare_spec.rb +++ /dev/null @@ -1,272 +0,0 @@ -require 'spec_helper' - -describe 'glance::glare' do - let :pre_condition do - "class {'::glance::glare::authtoken': - password => 'ChangeMe', - }" - end - let :default_params do - { - :bind_host => '0.0.0.0', - :bind_port => '9494', - :auth_strategy => 'keystone', - :enabled => true, - :manage_service => true, - :backlog => '4096', - :workers => '7', - :stores => false, - :default_store => false, - :os_region_name => 'RegionOne', - :pipeline => 'keystone', - } - end - - shared_examples_for 'glance::glare' do - [ - { - :bind_host => '127.0.0.1', - :bind_port => '9222', - :auth_strategy => 'not_keystone', - :enabled => false, - :backlog => '4095', - :workers => '5', - :os_region_name => 'RegionOne2', - :pipeline => 'keystone2', - } - ].each do |param_set| - - describe "when not using default class parameters" do - - let :param_hash do - default_params.merge(param_set) - end - - let :params do - param_set - end - - it { is_expected.to contain_class 'glance' } - it { is_expected.to contain_class 'glance::policy' } - it { is_expected.to contain_class 'glance::glare::logging' } - it { is_expected.to contain_class 'glance::glare::db' } - - it { is_expected.to contain_service('glance-glare').with( - 'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running': 'stopped', - 'enable' => param_hash[:enabled], - 'hasstatus' => true, - 'hasrestart' => true, - 'tag' => 'glance-service', - ) } - - it { is_expected.to contain_glance_glare_config("paste_deploy/flavor").with_value(param_hash[:pipeline]) } - - it 'is_expected.to lay down default glare config' do - [ - 'bind_host', - 'bind_port', - ].each do |config| - is_expected.to contain_glance_glare_config("DEFAULT/#{config}").with_value(param_hash[config.intern]) - end - end - - it 'is_expected.to lay down default glance_store glare and cache config' do - [ - 'os_region_name', - ].each do |config| - is_expected.to contain_glance_glare_config("glance_store/#{config}").with_value(param_hash[config.intern]) - end - end - - it 'is_expected.to have no ssl options' do - is_expected.to contain_glance_glare_config('DEFAULT/ca_file').with_value('') - is_expected.to contain_glance_glare_config('DEFAULT/cert_file').with_value('') - is_expected.to contain_glance_glare_config('DEFAULT/key_file').with_value('') - end - - it 'is_expected.to configure itself for keystone if that is the auth_strategy' do - if params[:auth_strategy] == 'keystone' - is_expected.to contain('paste_deploy/flavor').with_value('keystone+cachemanagement') - end - end - end - - end - - describe 'with disabled service managing' do - let :params do - { - :manage_service => false, - :enabled => false, - } - end - - it { is_expected.to contain_service('glance-glare').with( - 'ensure' => nil, - 'enable' => false, - 'hasstatus' => true, - 'hasrestart' => true, - 'tag' => 'glance-service', - ) } - end - - describe 'with overridden pipeline' do - let :params do - { - :pipeline => 'something', - } - end - - it { is_expected.to contain_glance_glare_config('paste_deploy/flavor').with_value('something') } - end - - describe 'with blank pipeline' do - let :params do - { - :pipeline => '', - } - end - - it { is_expected.to contain_glance_glare_config('paste_deploy/flavor').with_ensure('absent') } - end - - [ - 'keystone/', - 'keystone+', - '+keystone', - 'keystone+cachemanagement+', - '+' - ].each do |pipeline| - describe "with pipeline incorrect value #{pipeline}" do - let :params do - { - :pipeline => pipeline - } - end - - it { expect { is_expected.to contain_glance_glare_config('filter:paste_deploy/flavor') }.to\ - raise_error(Puppet::Error, /validate_re\(\): .* does not match/) } - end - end - - describe 'with ssl options' do - let :params do - default_params.merge({ - :ca_file => '/tmp/ca_file', - :cert_file => '/tmp/cert_file', - :key_file => '/tmp/key_file', - }) - end - - context 'with ssl options' do - it { is_expected.to contain_glance_glare_config('DEFAULT/ca_file').with_value('/tmp/ca_file') } - it { is_expected.to contain_glance_glare_config('DEFAULT/cert_file').with_value('/tmp/cert_file') } - it { is_expected.to contain_glance_glare_config('DEFAULT/key_file').with_value('/tmp/key_file') } - end - end - describe 'with stores by default' do - let :params do - default_params - end - - it { is_expected.to_not contain_glance_glare_config('glance_store/stores').with_value('false') } - end - - describe 'with stores override' do - let :params do - default_params.merge({ - :default_store => 'glance.store.filesystem.Store', - :stores => ['glance.store.filesystem.Store','glance.store.http.Store'], - :multi_store => true, - }) - end - - it { is_expected.to contain_glance_glare_config('glance_store/default_store').with_value('glance.store.filesystem.Store') } - it { is_expected.to contain_glance_glare_config('glance_store/stores').with_value('glance.store.filesystem.Store,glance.store.http.Store') } - end - - describe 'with single store override and no default store' do - let :params do - default_params.merge({ - :stores => ['glance.store.filesystem.Store'], - :multi_store => true, - }) - end - - it { is_expected.to contain_glance_glare_config('glance_store/default_store').with_value('glance.store.filesystem.Store') } - it { is_expected.to contain_glance_glare_config('glance_store/stores').with_value('glance.store.filesystem.Store') } - end - - describe 'with multiple stores override and no default store' do - let :params do - default_params.merge({ - :stores => ['glance.store.filesystem.Store', 'glance.store.http.Store'], - :multi_store => true, - }) - end - - it { is_expected.to contain_glance_glare_config('glance_store/default_store').with_value('glance.store.filesystem.Store') } - it { is_expected.to contain_glance_glare_config('glance_store/stores').with_value('glance.store.filesystem.Store,glance.store.http.Store') } - end - - describe 'with wrong format of stores provided' do - let :params do - default_params.merge({ - :stores => 'glance.store.filesystem.Store', - }) - end - - it { is_expected.to raise_error(Puppet::Error, /is not an Array/) } - end - - describe 'with known_stores not set but with default_store' do - let :params do - default_params.merge({ - :default_store => 'glance.store.filesystem.Store', - :multi_store => true, - }) - end - - it { is_expected.to contain_glance_glare_config('glance_store/default_store').with_value('glance.store.filesystem.Store') } - it { is_expected.to contain_glance_glare_config('glance_store/stores').with_value('glance.store.filesystem.Store') } - end -end - - shared_examples_for 'glance::glare Debian' do - let(:params) { default_params } - - # We only test this on Debian platforms, since on RedHat there isn't a - # separate package for glance GLARE. - ['present', 'latest'].each do |package_ensure| - context "with package_ensure '#{package_ensure}'" do - let(:params) { default_params.merge({ :package_ensure => package_ensure }) } - it { is_expected.to contain_package('glance-glare').with( - :ensure => package_ensure, - :tag => ['openstack', 'glance-package'] - )} - end - end - end - - shared_examples_for 'glance::glare RedHat' do - let(:params) { default_params } - - it { is_expected.to contain_package('openstack-glance').with( - :tag => ['openstack', 'glance-package'], - )} - end - - on_supported_os({ - :supported_os => OSDefaults.get_supported_os - }).each do |os,facts| - context "on #{os}" do - let (:facts) do - facts.merge!(OSDefaults.get_facts()) - end - - it_configures 'glance::glare' - it_configures "glance::glare #{facts[:osfamily]}" - end - end - -end diff --git a/spec/classes/glance_keystone_glare_auth_spec.rb b/spec/classes/glance_keystone_glare_auth_spec.rb deleted file mode 100644 index 9a835519..00000000 --- a/spec/classes/glance_keystone_glare_auth_spec.rb +++ /dev/null @@ -1,172 +0,0 @@ -require 'spec_helper' - -describe 'glance::keystone::glare_auth' do - - shared_examples_for 'glance::keystone::glare_auth' do - describe 'with defaults' do - - let :params do - {:password => 'pass'} - end - - it { is_expected.to contain_keystone_user('glare').with( - :ensure => 'present', - :password => 'pass' - )} - - it { is_expected.to contain_keystone_user_role('glare@services').with( - :ensure => 'present', - :roles => ['admin'] - ) } - - it { is_expected.to contain_keystone_service('Glance Artifacts::artifact').with( - :ensure => 'present', - :description => 'Glance Artifact Service' - ) } - - it { is_expected.to contain_keystone_endpoint('RegionOne/Glance Artifacts::artifact').with( - :ensure => 'present', - :public_url => 'http://127.0.0.1:9494', - :admin_url => 'http://127.0.0.1:9494', - :internal_url => 'http://127.0.0.1:9494' - )} - - end - - describe 'when auth_type, password, and service_type are overridden' do - - let :params do - { - :auth_name => 'glarey', - :password => 'password', - :service_type => 'glarey' - } - end - - it { is_expected.to contain_keystone_user('glarey').with( - :ensure => 'present', - :password => 'password' - )} - - it { is_expected.to contain_keystone_user_role('glarey@services').with( - :ensure => 'present', - :roles => ['admin'] - ) } - - it { is_expected.to contain_keystone_service('Glance Artifacts::glarey').with( - :ensure => 'present', - :description => 'Glance Artifact Service' - ) } - - end - - describe 'when overriding endpoint URLs' do - let :params do - { :password => 'passw0rd', - :region => 'RegionTwo', - :public_url => 'https://10.10.10.10:82/v2', - :internal_url => 'https://10.10.10.11:82/v2', - :admin_url => 'https://10.10.10.12:82/v2' } - end - - it { is_expected.to contain_keystone_endpoint('RegionTwo/Glance Artifacts::artifact').with( - :ensure => 'present', - :public_url => 'https://10.10.10.10:82/v2', - :internal_url => 'https://10.10.10.11:82/v2', - :admin_url => 'https://10.10.10.12:82/v2' - ) } - end - - describe 'when endpoint is not set' do - - let :params do - { - :configure_endpoint => false, - :password => 'pass', - } - end - - it { is_expected.to_not contain_keystone_endpoint('RegionOne/Glance Artifacts::artifact') } - end - - describe 'when disabling user configuration' do - let :params do - { - :configure_user => false, - :password => 'pass', - } - end - - it { is_expected.to_not contain_keystone_user('glare') } - - it { is_expected.to contain_keystone_user_role('glare@services') } - - it { is_expected.to contain_keystone_service('Glance Artifacts::artifact').with( - :ensure => 'present', - :description => 'Glance Artifact Service' - ) } - end - - describe 'when disabling user and user role configuration' do - let :params do - { - :configure_user => false, - :configure_user_role => false, - :password => 'pass', - } - end - - it { is_expected.to_not contain_keystone_user('glare') } - - it { is_expected.to_not contain_keystone_user_role('glare@services') } - - it { is_expected.to contain_keystone_service('Glance Artifacts::artifact').with( - :ensure => 'present', - :description => 'Glance Artifact Service' - ) } - end - - describe 'when configuring glance-glare and the keystone endpoint' do - let :pre_condition do - "class { 'glance::glare::authtoken': password => 'test' }" - end - - let :params do - { - :password => 'test', - :configure_endpoint => true - } - end - - it { is_expected.to contain_keystone_endpoint('RegionOne/Glance Artifacts::artifact').with_notify(["Anchor[glance::service::begin]"]) } - end - - describe 'when overriding service name' do - - let :params do - { - :service_name => 'glance_service', - :password => 'pass' - } - end - - it { is_expected.to contain_keystone_user('glare') } - it { is_expected.to contain_keystone_user_role('glare@services') } - it { is_expected.to contain_keystone_service('glance_service::artifact') } - it { is_expected.to contain_keystone_endpoint('RegionOne/glance_service::artifact') } - - end - end - - on_supported_os({ - :supported_os => OSDefaults.get_supported_os - }).each do |os,facts| - context "on #{os}" do - let (:facts) do - facts.merge!(OSDefaults.get_facts()) - end - - it_configures 'glance::keystone::glare_auth' - end - end -end diff --git a/spec/unit/provider/glance_glare_config/ini_setting_spec.rb b/spec/unit/provider/glance_glare_config/ini_setting_spec.rb deleted file mode 100644 index 78ef6f0a..00000000 --- a/spec/unit/provider/glance_glare_config/ini_setting_spec.rb +++ /dev/null @@ -1,71 +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_glare_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_glare_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_glare_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 is specified as a value' do - resource = Puppet::Type::Glance_glare_config.new( - {:name => 'dude/foo', :value => ''} - ) - 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_glare_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 diff --git a/spec/unit/provider/glance_glare_paste_ini/ini_setting_spec.rb b/spec/unit/provider/glance_glare_paste_ini/ini_setting_spec.rb deleted file mode 100644 index f817a01e..00000000 --- a/spec/unit/provider/glance_glare_paste_ini/ini_setting_spec.rb +++ /dev/null @@ -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_glare_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_glare_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_glare_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 is specified as a value' do - resource = Puppet::Type::Glance_glare_paste_ini.new( - {:name => 'dude/foo', :value => ''} - ) - 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_glare_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 diff --git a/spec/unit/type/glance_glare_config_spec.rb b/spec/unit/type/glance_glare_config_spec.rb deleted file mode 100644 index 157e1b40..00000000 --- a/spec/unit/type/glance_glare_config_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'puppet' -require 'puppet/type/glance_glare_config' - -describe 'Puppet::Type.type(:glance_glare_config)' do - before :each do - Puppet::Type.rmtype(:glance_glare_config) - Facter.fact(:osfamily).stubs(:value).returns(platform_params[:osfamily]) - @glance_glare_config = Puppet::Type.type(:glance_glare_config).new(:name => 'DEFAULT/foo', :value => 'bar') - end - - shared_examples_for 'glance_glare_config' do - it 'should autorequire the package that install the file' do - catalog = Puppet::Resource::Catalog.new - package = Puppet::Type.type(:package).new(:name => platform_params[:package_name]) - catalog.add_resource package, @glance_glare_config - dependency = @glance_glare_config.autorequire - expect(dependency.size).to eq(1) - expect(dependency[0].target).to eq(@glance_glare_config) - expect(dependency[0].source).to eq(package) - end - end - - context 'on Debian platforms' do - let :platform_params do - { :package_name => 'glance-glare', - :osfamily => 'Debian' } - end - - it_behaves_like 'glance_glare_config' - end - - context 'on RedHat platforms' do - let :platform_params do - { :package_name => 'openstack-glance', - :osfamily => 'RedHat'} - end - - it_behaves_like 'glance_glare_config' - end - -end diff --git a/spec/unit/type/glance_glare_paste_ini_spec.rb b/spec/unit/type/glance_glare_paste_ini_spec.rb deleted file mode 100644 index c24448c5..00000000 --- a/spec/unit/type/glance_glare_paste_ini_spec.rb +++ /dev/null @@ -1,87 +0,0 @@ -require 'puppet' -require 'puppet/type/glance_glare_paste_ini' - -describe 'Puppet::Type.type(:glance_glare_paste_ini)' do - before :each do - Puppet::Type.rmtype(:glance_glare_paste_ini) - Facter.fact(:osfamily).stubs(:value).returns(platform_params[:osfamily]) - @glance_glare_paste_ini = Puppet::Type.type(:glance_glare_paste_ini).new(:name => 'DEFAULT/foo', :value => 'bar') - end - - shared_examples_for 'glance_glare_paste_ini' do - - it 'should require a name' do - expect { - Puppet::Type.type(:glance_glare_paste_ini).new({}) - }.to raise_error(Puppet::Error, 'Title or name must be provided') - end - - it 'should not expect a name with whitespace' do - expect { - Puppet::Type.type(:glance_glare_paste_ini).new(:name => 'f oo') - }.to raise_error(Puppet::Error, /Parameter name failed/) - end - - it 'should fail when there is no section' do - expect { - Puppet::Type.type(:glance_glare_paste_ini).new(:name => 'foo') - }.to raise_error(Puppet::Error, /Parameter name failed/) - end - - it 'should not require a value when ensure is absent' do - Puppet::Type.type(:glance_glare_paste_ini).new(:name => 'DEFAULT/foo', :ensure => :absent) - end - - it 'should accept a valid value' do - @glance_glare_paste_ini[:value] = 'bar' - expect(@glance_glare_paste_ini[:value]).to eq('bar') - end - - it 'should not accept a value with whitespace' do - @glance_glare_paste_ini[:value] = 'b ar' - expect(@glance_glare_paste_ini[:value]).to eq('b ar') - end - - it 'should accept valid ensure values' do - @glance_glare_paste_ini[:ensure] = :present - expect(@glance_glare_paste_ini[:ensure]).to eq(:present) - @glance_glare_paste_ini[:ensure] = :absent - expect(@glance_glare_paste_ini[:ensure]).to eq(:absent) - end - - it 'should not accept invalid ensure values' do - expect { - @glance_glare_paste_ini[:ensure] = :latest - }.to raise_error(Puppet::Error, /Invalid value/) - end - - it 'should autorequire the package that install the file' do - catalog = Puppet::Resource::Catalog.new - package = Puppet::Type.type(:package).new(:name => platform_params[:package_name]) - catalog.add_resource package, @glance_glare_paste_ini - dependency = @glance_glare_paste_ini.autorequire - expect(dependency.size).to eq(1) - expect(dependency[0].target).to eq(@glance_glare_paste_ini) - expect(dependency[0].source).to eq(package) - end - end - - context 'on Debian platforms' do - let :platform_params do - { :package_name => 'glance-glare', - :osfamily => 'Debian' } - end - - it_behaves_like 'glance_glare_paste_ini' - end - - context 'on RedHat platforms' do - let :platform_params do - { :package_name => 'openstack-glance', - :osfamily => 'RedHat'} - end - - it_behaves_like 'glance_glare_paste_ini' - end - -end