Blame SOURCES/fix-puppetlab-paths.patch

8c7ea4
diff -uNr hiera-3.6.0.ORIG/lib/hiera/util.rb hiera-3.6.0/lib/hiera/util.rb
8c7ea4
--- hiera-3.6.0.ORIG/lib/hiera/util.rb	2019-11-13 09:43:32.600045630 +0100
8c7ea4
+++ hiera-3.6.0/lib/hiera/util.rb	2019-11-13 09:43:46.007065887 +0100
8c7ea4
@@ -20,7 +20,7 @@
8c7ea4
       if microsoft_windows?
8c7ea4
          File.join(common_appdata, 'PuppetLabs', 'puppet', 'etc')
8c7ea4
       else
8c7ea4
-        '/etc/puppetlabs/puppet'
8c7ea4
+        '/etc/puppet'
8c7ea4
       end
8c7ea4
     end
8c7ea4
 
8c7ea4
@@ -28,7 +28,7 @@
8c7ea4
       if microsoft_windows?
8c7ea4
         File.join(common_appdata, 'PuppetLabs', 'code')
8c7ea4
       else
8c7ea4
-        '/etc/puppetlabs/code'
8c7ea4
+        '/etc/puppet/code'
8c7ea4
       end
8c7ea4
     end
8c7ea4
 
8c7ea4
diff -uNr hiera-3.6.0.ORIG/lib/hiera/util.rb.orig hiera-3.6.0/lib/hiera/util.rb.orig
8c7ea4
--- hiera-3.6.0.ORIG/lib/hiera/util.rb.orig	1970-01-01 01:00:00.000000000 +0100
8c7ea4
+++ hiera-3.6.0/lib/hiera/util.rb.orig	2019-10-14 09:59:36.000000000 +0200
8c7ea4
@@ -0,0 +1,65 @@
8c7ea4
+class Hiera
8c7ea4
+
8c7ea4
+  # Matches a key that is quoted using a matching pair of either single or double quotes.
8c7ea4
+  QUOTED_KEY = /^(?:"([^"]+)"|'([^']+)')$/
8c7ea4
+  QUOTES = /[",]/
8c7ea4
+
8c7ea4
+  module Util
8c7ea4
+    module_function
8c7ea4
+
8c7ea4
+    def posix?
8c7ea4
+      require 'etc'
8c7ea4
+      Etc.getpwuid(0) != nil
8c7ea4
+    end
8c7ea4
+
8c7ea4
+    def microsoft_windows?
8c7ea4
+      !!file_alt_separator
8c7ea4
+    end
8c7ea4
+
8c7ea4
+    def config_dir
8c7ea4
+      if microsoft_windows?
8c7ea4
+         File.join(common_appdata, 'PuppetLabs', 'puppet', 'etc')
8c7ea4
+      else
8c7ea4
+        '/etc/puppetlabs/puppet'
8c7ea4
+      end
8c7ea4
+    end
8c7ea4
+
8c7ea4
+    def code_dir
8c7ea4
+      if microsoft_windows?
8c7ea4
+        File.join(common_appdata, 'PuppetLabs', 'code')
8c7ea4
+      else
8c7ea4
+        '/etc/puppetlabs/code'
8c7ea4
+      end
8c7ea4
+    end
8c7ea4
+
8c7ea4
+    def var_dir
8c7ea4
+      File.join(code_dir, 'environments' , '%{environment}' , 'hieradata')
8c7ea4
+    end
8c7ea4
+
8c7ea4
+    def file_alt_separator
8c7ea4
+      File::ALT_SEPARATOR
8c7ea4
+    end
8c7ea4
+
8c7ea4
+    def common_appdata
8c7ea4
+      @common_appdata ||= Hiera::Util::Win32.get_common_appdata()
8c7ea4
+    end
8c7ea4
+
8c7ea4
+    def split_key(key)
8c7ea4
+      segments = key.split(/(?:"([^"]+)"|'([^']+)'|([^'".]+))/)
8c7ea4
+      if segments.empty?
8c7ea4
+        # Only happens if the original key was an empty string
8c7ea4
+        ''
8c7ea4
+      elsif segments.shift == ''
8c7ea4
+        count = segments.size
8c7ea4
+        raise yield('Syntax error') unless count > 0
8c7ea4
+
8c7ea4
+        segments.keep_if { |seg| seg != '.' }
8c7ea4
+        raise yield('Syntax error') unless segments.size * 2 == count + 1
8c7ea4
+        segments
8c7ea4
+      else
8c7ea4
+        raise yield('Syntax error')
8c7ea4
+      end
8c7ea4
+    end
8c7ea4
+  end
8c7ea4
+end
8c7ea4
+
8c7ea4
diff -uNr hiera-3.6.0.ORIG/spec/unit/util_spec.rb hiera-3.6.0/spec/unit/util_spec.rb
8c7ea4
--- hiera-3.6.0.ORIG/spec/unit/util_spec.rb	2019-11-13 09:43:32.601045631 +0100
8c7ea4
+++ hiera-3.6.0/spec/unit/util_spec.rb	2019-11-13 09:44:42.269091590 +0100
8c7ea4
@@ -23,7 +23,7 @@
8c7ea4
   describe 'Hiera::Util.config_dir' do
8c7ea4
     it 'should return the correct path for posix systems' do
8c7ea4
       Hiera::Util.expects(:file_alt_separator).returns(nil)
8c7ea4
-      expect(Hiera::Util.config_dir).to eq('/etc/puppetlabs/puppet')
8c7ea4
+      expect(Hiera::Util.config_dir).to eq('/etc/puppet')
8c7ea4
     end
8c7ea4
 
8c7ea4
     it 'should return the correct path for microsoft windows systems' do
8c7ea4
@@ -36,7 +36,7 @@
8c7ea4
   describe 'Hiera::Util.code_dir' do
8c7ea4
     it 'should return the correct path for posix systems' do
8c7ea4
       Hiera::Util.expects(:file_alt_separator).returns(nil)
8c7ea4
-      expect(Hiera::Util.code_dir).to eq('/etc/puppetlabs/code')
8c7ea4
+      expect(Hiera::Util.code_dir).to eq('/etc/puppet/code')
8c7ea4
     end
8c7ea4
 
8c7ea4
     it 'should return the correct path for microsoft windows systems' do
8c7ea4
@@ -49,7 +49,7 @@
8c7ea4
   describe 'Hiera::Util.var_dir' do
8c7ea4
     it 'should return the correct path for posix systems' do
8c7ea4
       Hiera::Util.expects(:file_alt_separator).returns(nil)
8c7ea4
-      expect(Hiera::Util.var_dir).to eq('/etc/puppetlabs/code/environments/%{environment}/hieradata')
8c7ea4
+      expect(Hiera::Util.var_dir).to eq('/etc/puppet/code/environments/%{environment}/hieradata')
8c7ea4
     end
8c7ea4
 
8c7ea4
     it 'should return the correct path for microsoft windows systems' do