From 2d84cf4e1696a3d6eb3f9b62a9d7e41df04dc11c Mon Sep 17 00:00:00 2001
From: Iury Gregory Melo Ferreira <iurygregory@gmail.com>
Date: Thu, 2 Jun 2016 01:13:09 -0300
Subject: [PATCH] Remove deprecated swift_hash_suffix

swift_hash_suffix was deprecated in Mitaka and
should be removed in Newton.

See http://docs.openstack.org/icehouse/config-reference/content/swift-general-service-configuration.html

Change-Id: I3b5c55607bcd8a2aa5288cdfefa96a152d1682cb
---
 README.md                                     |  6 +--
 manifests/init.pp                             | 37 +++++++------------
 ...ve_swift_hash_suffix-cd6b8bdf62990b7b.yaml |  4 ++
 spec/acceptance/basic_swift_spec.rb           |  4 +-
 spec/classes/swift_bench_spec.rb              |  2 +-
 spec/classes/swift_dispersion_spec.rb         |  2 +-
 spec/classes/swift_proxy_ceilometer_spec.rb   |  2 +-
 spec/classes/swift_proxy_spec.rb              |  4 +-
 spec/classes/swift_ringbuilder_spec.rb        |  4 +-
 spec/classes/swift_ringserver_spec.rb         |  4 +-
 spec/classes/swift_spec.rb                    |  2 +-
 spec/classes/swift_storage_account_spec.rb    |  2 +-
 spec/classes/swift_storage_all_spec.rb        |  2 +-
 spec/classes/swift_storage_container_spec.rb  |  2 +-
 spec/classes/swift_storage_object_spec.rb     |  2 +-
 spec/classes/swift_storage_spec.rb            |  2 +-
 spec/defines/swift_storage_generic_spec.rb    |  2 +-
 spec/defines/swift_storage_node_spec.rb       |  2 +-
 spec/defines/swift_storage_server_spec.rb     |  4 +-
 tests/all.pp                                  |  4 +-
 tests/site.pp                                 |  8 ++--
 21 files changed, 47 insertions(+), 54 deletions(-)
 create mode 100644 releasenotes/notes/remove_swift_hash_suffix-cd6b8bdf62990b7b.yaml

diff --git a/README.md b/README.md
index 21f63ccc..d19be11e 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ To utilize the swift module's functionality you will need to declare multiple re
 
 ```puppet
 class { 'swift':
-  swift_hash_suffix => 'swift_secret',
+  swift_hash_path_suffix => 'swift_secret',
 }
 
 swift::storage::loopback { ['1', '2']:
@@ -99,10 +99,10 @@ Usage
 Class that will set up the base packages and the base /etc/swift/swift.conf
 
 ```puppet
-class { 'swift': swift_hash_suffix => 'shared_secret', }
+class { 'swift': swift_hash_path_suffix => 'shared_secret', }
 ```
 
-####`swift_hash_suffix`
+####`swift_hash_path_suffix`
 The shared salt used when hashing ring mappings.
 
 ### Class swift::proxy
diff --git a/manifests/init.pp b/manifests/init.pp
index 662f8a19..99da904c 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -13,7 +13,7 @@
 #   string.
 #
 # [*swift_hash_path_prefix*]
-#   (Required)String. A prefix used by hash_path to offer a bit more security
+#   (Required) String. A prefix used by hash_path to offer a bit more security
 #   when generating hashes for paths. It simply prepends this value to all paths;
 #   if someone knows this prefix, it's easier for them to guess the hash a path
 #   will end up with. New installations are advised to set this parameter to a
@@ -23,22 +23,18 @@
 #   as a salt when hashing to determine mappings in the ring.
 #   This file should be the same on every node in the cluster.
 #
-# [*package_ensure*] The ensure state for the swift package.
-#   (Optional) Defaults to present.
+# [*package_ensure*]
+#   (Optional) The ensure state for the swift package.
+#   Defaults to present.
 #
-# [*client_package_ensure*] The ensure state for the swift client package.
-#   (Optional) Defaults to present.
+# [*client_package_ensure*]
+#   (Optional) The ensure state for the swift client package.
+#   Defaults to present.
 #
-# [*max_header_size*] Max HTTP header size for incoming requests for all swift
+# [*max_header_size*]
+#   (Optional) Max HTTP header size for incoming requests for all swift
 #   services. Recommended size is 32768 for PKI keystone tokens.
-#   (Optional) Defaults to 8192
-
-## DEPRECATED PARAMETERS
-#
-# [*swift_hash_suffix*]
-#   DEPRECATED. string of text to be used
-#   as a salt when hashing to determine mappings in the ring.
-#   This file should be the same on every node in the cluster.
+#   Defaults to 8192
 #
 # == Dependencies
 #
@@ -58,20 +54,13 @@ class swift(
   $package_ensure         = 'present',
   $client_package_ensure  = 'present',
   $max_header_size        = '8192',
-  # DEPRECATED PARAMETERS
-  $swift_hash_suffix      = undef,
 ) {
 
   include ::swift::deps
   include ::swift::params
 
-  if ($swift_hash_suffix == undef and $swift_hash_path_suffix == undef) {
-    fail('You must specify swift_hash_path_suffix')
-  } elsif ($swift_hash_suffix != undef and $swift_hash_path_suffix == undef) {
-    warning('swift_hash_suffix has been deprecated and should be replaced with swift_hash_path_suffix, this will be removed as part of the N-cycle')
-    $swift_hash_path_suffix_real = $swift_hash_suffix
-  } else {
-    $swift_hash_path_suffix_real = $swift_hash_path_suffix
+  if ($swift_hash_path_prefix == undef and $swift_hash_path_suffix == undef) {
+    fail('You must specify at least swift_hash_path_prefix or swift_hash_path_suffix')
   }
 
   if !defined(Package['swift']) {
@@ -114,7 +103,7 @@ class swift(
   File['/etc/swift/swift.conf'] -> Swift_config<||>
 
   swift_config {
-    'swift-hash/swift_hash_path_suffix': value => $swift_hash_path_suffix_real;
+    'swift-hash/swift_hash_path_suffix': value => $swift_hash_path_suffix;
     'swift-hash/swift_hash_path_prefix': value => $swift_hash_path_prefix;
     'swift-constraints/max_header_size': value => $max_header_size;
   }
diff --git a/releasenotes/notes/remove_swift_hash_suffix-cd6b8bdf62990b7b.yaml b/releasenotes/notes/remove_swift_hash_suffix-cd6b8bdf62990b7b.yaml
new file mode 100644
index 00000000..84bfa866
--- /dev/null
+++ b/releasenotes/notes/remove_swift_hash_suffix-cd6b8bdf62990b7b.yaml
@@ -0,0 +1,4 @@
+---
+other:
+  - remove swift_hash_suffix deprecated in Mitaka and change
+    tests to use swift_hash_path_suffix.
diff --git a/spec/acceptance/basic_swift_spec.rb b/spec/acceptance/basic_swift_spec.rb
index c1f20fda..75046624 100644
--- a/spec/acceptance/basic_swift_spec.rb
+++ b/spec/acceptance/basic_swift_spec.rb
@@ -21,7 +21,7 @@ describe 'basic swift' do
       # Swift resources
       class { '::swift':
         # not sure how I want to deal with this shared secret
-        swift_hash_suffix => 'secrete',
+        swift_hash_path_suffix => 'secrete',
         package_ensure    => latest,
       }
       class { '::swift::keystone::auth':
@@ -102,7 +102,7 @@ describe 'basic swift' do
       # Swift resources
       class { '::swift':
         # not sure how I want to deal with this shared secret
-        swift_hash_suffix => 'secrete',
+        swift_hash_path_suffix => 'secrete',
         package_ensure    => latest,
       }
       class { '::swift::keystone::auth':
diff --git a/spec/classes/swift_bench_spec.rb b/spec/classes/swift_bench_spec.rb
index c278cbd6..9fd52922 100644
--- a/spec/classes/swift_bench_spec.rb
+++ b/spec/classes/swift_bench_spec.rb
@@ -22,7 +22,7 @@ describe 'swift::bench' do
   end
 
   let :pre_condition do
-    "class { 'swift': swift_hash_suffix => 'string' }"
+    "class { 'swift': swift_hash_path_suffix => 'string' }"
   end
 
   let :facts do
diff --git a/spec/classes/swift_dispersion_spec.rb b/spec/classes/swift_dispersion_spec.rb
index bd1c864e..587156bf 100644
--- a/spec/classes/swift_dispersion_spec.rb
+++ b/spec/classes/swift_dispersion_spec.rb
@@ -17,7 +17,7 @@ describe 'swift::dispersion' do
   end
 
   let :pre_condition do
-    "class { 'swift': swift_hash_suffix => 'string' }"
+    "class { 'swift': swift_hash_path_suffix => 'string' }"
   end
 
   let :facts do
diff --git a/spec/classes/swift_proxy_ceilometer_spec.rb b/spec/classes/swift_proxy_ceilometer_spec.rb
index f225c47b..c9d0622f 100644
--- a/spec/classes/swift_proxy_ceilometer_spec.rb
+++ b/spec/classes/swift_proxy_ceilometer_spec.rb
@@ -11,7 +11,7 @@ describe 'swift::proxy::ceilometer' do
   let :pre_condition do
     'concat { "/etc/swift/proxy-server.conf": }
      class { "swift":
-        swift_hash_suffix => "dummy"
+        swift_hash_path_suffix => "dummy"
      }'
   end
 
diff --git a/spec/classes/swift_proxy_spec.rb b/spec/classes/swift_proxy_spec.rb
index 3aa914d1..f50b7112 100644
--- a/spec/classes/swift_proxy_spec.rb
+++ b/spec/classes/swift_proxy_spec.rb
@@ -20,7 +20,7 @@ describe 'swift::proxy' do
 
     let :pre_condition do
       "class { memcached: max_memory => 1}
-       class { swift: swift_hash_suffix => string }"
+       class { swift: swift_hash_path_suffix => string }"
     end
 
     describe 'without the proxy local network ip address being specified' do
@@ -105,7 +105,7 @@ account_autocreate = true
         let :pre_condition do
           "
             class { memcached: max_memory => 1}
-            class { swift: swift_hash_suffix => string }
+            class { swift: swift_hash_path_suffix => string }
             swift_proxy_config { 'foo/bar': value => 'foo' }
           "
         end
diff --git a/spec/classes/swift_ringbuilder_spec.rb b/spec/classes/swift_ringbuilder_spec.rb
index 28a9d8f0..b11f24f4 100644
--- a/spec/classes/swift_ringbuilder_spec.rb
+++ b/spec/classes/swift_ringbuilder_spec.rb
@@ -17,7 +17,7 @@ describe 'swift::ringbuilder' do
 
     let :pre_condition do
       "class { memcached: max_memory => 1}
-       class { swift: swift_hash_suffix => string }"
+       class { swift: swift_hash_path_suffix => string }"
     end
 
     it 'should rebalance the ring for all ring types' do
@@ -57,7 +57,7 @@ describe 'swift::ringbuilder' do
     describe 'when specifying ring devices' do
       let :pre_condition do
          'class { memcached: max_memory => 1}
-          class { swift: swift_hash_suffix => string }
+          class { swift: swift_hash_path_suffix => string }
           ring_object_device { "127.0.0.1:6000/1":
           zone        => 1,
           weight      => 1,
diff --git a/spec/classes/swift_ringserver_spec.rb b/spec/classes/swift_ringserver_spec.rb
index a896ef0d..aada5ddf 100644
--- a/spec/classes/swift_ringserver_spec.rb
+++ b/spec/classes/swift_ringserver_spec.rb
@@ -8,7 +8,7 @@ describe 'swift::ringserver' do
 
     let :pre_condition do
       "class { 'swift::storage': storage_local_net_ip  => '127.0.0.1' }
-       class {'swift' : swift_hash_suffix => 'eee' }
+       class {'swift' : swift_hash_path_suffix => 'eee' }
        include swift::ringbuilder"
     end
 
@@ -46,7 +46,7 @@ describe 'swift::ringserver' do
   context 'when storage.pp was not already included' do
 
     let :pre_condition do
-      "class {'swift' : swift_hash_suffix => 'eee' }
+      "class {'swift' : swift_hash_path_suffix => 'eee' }
        include swift::ringbuilder"
     end
 
diff --git a/spec/classes/swift_spec.rb b/spec/classes/swift_spec.rb
index ca04efe5..4c007b86 100644
--- a/spec/classes/swift_spec.rb
+++ b/spec/classes/swift_spec.rb
@@ -4,7 +4,7 @@ describe 'swift' do
 
   let :params do
     {
-      :swift_hash_suffix => 'string',
+      :swift_hash_path_suffix => 'string',
       :max_header_size   => '16384',
     }
   end
diff --git a/spec/classes/swift_storage_account_spec.rb b/spec/classes/swift_storage_account_spec.rb
index 6fad52b6..4a7e55f3 100644
--- a/spec/classes/swift_storage_account_spec.rb
+++ b/spec/classes/swift_storage_account_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
 
 describe 'swift::storage::account' do
   let :pre_condition do
-     "class { 'swift': swift_hash_suffix => 'foo' }
+     "class { 'swift': swift_hash_path_suffix => 'foo' }
      class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
   end
 
diff --git a/spec/classes/swift_storage_all_spec.rb b/spec/classes/swift_storage_all_spec.rb
index a42506cd..d0892d24 100644
--- a/spec/classes/swift_storage_all_spec.rb
+++ b/spec/classes/swift_storage_all_spec.rb
@@ -10,7 +10,7 @@ describe 'swift::storage::all' do
   end
 
   let :pre_condition do
-    "class { 'swift': swift_hash_suffix => 'changeme' }"
+    "class { 'swift': swift_hash_path_suffix => 'changeme' }"
   end
 
   let :default_params do
diff --git a/spec/classes/swift_storage_container_spec.rb b/spec/classes/swift_storage_container_spec.rb
index 9948b813..23b15e47 100644
--- a/spec/classes/swift_storage_container_spec.rb
+++ b/spec/classes/swift_storage_container_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
 
 describe 'swift::storage::container' do
   let :pre_condition do
-    "class { 'swift': swift_hash_suffix => 'foo' }
+    "class { 'swift': swift_hash_path_suffix => 'foo' }
      class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
   end
 
diff --git a/spec/classes/swift_storage_object_spec.rb b/spec/classes/swift_storage_object_spec.rb
index 6361b158..1a0e0c00 100644
--- a/spec/classes/swift_storage_object_spec.rb
+++ b/spec/classes/swift_storage_object_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
 describe 'swift::storage::object' do
 
   let :pre_condition do
-    "class { 'swift': swift_hash_suffix => 'foo' }
+    "class { 'swift': swift_hash_path_suffix => 'foo' }
      class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
   end
 
diff --git a/spec/classes/swift_storage_spec.rb b/spec/classes/swift_storage_spec.rb
index fe6012cf..e80f44cd 100644
--- a/spec/classes/swift_storage_spec.rb
+++ b/spec/classes/swift_storage_spec.rb
@@ -10,7 +10,7 @@ describe 'swift::storage' do
 
   describe 'when required classes are specified' do
     let :pre_condition do
-      "class { 'swift': swift_hash_suffix => 'changeme' }"
+      "class { 'swift': swift_hash_path_suffix => 'changeme' }"
     end
 
     describe 'when the local net ip is specified' do
diff --git a/spec/defines/swift_storage_generic_spec.rb b/spec/defines/swift_storage_generic_spec.rb
index bc31884a..291a13f7 100644
--- a/spec/defines/swift_storage_generic_spec.rb
+++ b/spec/defines/swift_storage_generic_spec.rb
@@ -14,7 +14,7 @@ describe 'swift::storage::generic' do
   end
 
   let :pre_condition do
-    "class { 'swift': swift_hash_suffix => 'foo' }
+    "class { 'swift': swift_hash_path_suffix => 'foo' }
      class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
   end
 
diff --git a/spec/defines/swift_storage_node_spec.rb b/spec/defines/swift_storage_node_spec.rb
index e0fcac47..f75268f6 100644
--- a/spec/defines/swift_storage_node_spec.rb
+++ b/spec/defines/swift_storage_node_spec.rb
@@ -20,7 +20,7 @@ describe 'swift::storage::node' do
   end
 
   let :pre_condition do
-    "class { 'swift': swift_hash_suffix => 'foo' }
+    "class { 'swift': swift_hash_path_suffix => 'foo' }
      class { 'swift::storage': storage_local_net_ip => '127.0.0.1' }"
   end
 
diff --git a/spec/defines/swift_storage_server_spec.rb b/spec/defines/swift_storage_server_spec.rb
index e979b469..00d0f445 100644
--- a/spec/defines/swift_storage_server_spec.rb
+++ b/spec/defines/swift_storage_server_spec.rb
@@ -11,7 +11,7 @@ describe 'swift::storage::server' do
   end
 
   let :pre_condition do
-    "class { 'swift': swift_hash_suffix => 'foo' }
+    "class { 'swift': swift_hash_path_suffix => 'foo' }
      class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }"
   end
   let :default_params do
@@ -123,7 +123,7 @@ describe 'swift::storage::server' do
         describe "when using swift_#{t}_config resource" do
           let :pre_condition do
             "
-            class { 'swift': swift_hash_suffix => 'foo' }
+            class { 'swift': swift_hash_path_suffix => 'foo' }
             class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }
             swift_#{t}_config { 'foo/bar': value => 'foo' }
             "
diff --git a/tests/all.pp b/tests/all.pp
index a881dc0e..49411604 100644
--- a/tests/all.pp
+++ b/tests/all.pp
@@ -17,8 +17,8 @@ class { '::memcached':
 
 class { '::swift':
   # not sure how I want to deal with this shared secret
-  swift_hash_suffix => $swift_shared_secret,
-  package_ensure    => latest,
+  swift_hash_path_suffix => $swift_shared_secret,
+  package_ensure         => latest,
 }
 
 # === Configure Storage
diff --git a/tests/site.pp b/tests/site.pp
index e3825cd0..8942d832 100644
--- a/tests/site.pp
+++ b/tests/site.pp
@@ -124,8 +124,8 @@ node /swift-storage/ {
 
   class { '::swift':
     # not sure how I want to deal with this shared secret
-    swift_hash_suffix => $swift_shared_secret,
-    package_ensure    => latest,
+    swift_hash_path_suffix => $swift_shared_secret,
+    package_ensure         => latest,
   }
 
   # create xfs partitions on a loopback device and mount them
@@ -188,8 +188,8 @@ node /swift-proxy/ {
 
   class { '::swift':
     # not sure how I want to deal with this shared secret
-    swift_hash_suffix => $swift_shared_secret,
-    package_ensure    => latest,
+    swift_hash_path_suffix => $swift_shared_secret,
+    package_ensure         => latest,
   }
 
   # curl is only required so that I can run tests