From 6e5a02e3b8d282381584883280a0a4e75f6e9cbe Mon Sep 17 00:00:00 2001
From: Adam Henry Lewenberg <adamhl@stanford.edu>
Date: Mon, 29 Oct 2018 10:42:09 -0700
Subject: [PATCH] adjust indent spacing

---
 lib/puppet/functions/krb5conf/realms.rb              | 7 +++++--
 lib/puppet/functions/krb5conf/simple_hash_section.rb | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/puppet/functions/krb5conf/realms.rb b/lib/puppet/functions/krb5conf/realms.rb
index 5a6223e..a09d7ae 100644
--- a/lib/puppet/functions/krb5conf/realms.rb
+++ b/lib/puppet/functions/krb5conf/realms.rb
@@ -1,5 +1,8 @@
 Puppet::Functions.create_function(:'krb5conf::realms') do
   def realms(realms_hash)
+    indent = 4
+    spacer = ' ' * indent
+
     final_string = ""
     list_of_realms = realms_hash.keys()
     list_of_realms.each do |r|
@@ -8,9 +11,9 @@ Puppet::Functions.create_function(:'krb5conf::realms') do
       lengths    = attributes.map { |x| x[0].length() }
       max_length = lengths.max
       attributes.each do |attribute|
-        rv.push(sprintf("    %-#{max_length}s = %s", attribute[0], attribute[1]))
+        rv.push(sprintf("#{spacer}%-#{max_length}s = %s", attribute[0], attribute[1]))
       end
-      final_string += "  #{r} = {\n" + rv.join("\n") + "\n  }\n"
+      final_string += "#{spacer}#{r} = {\n" + rv.join("\n") + "\n  }\n"
     end
     return "[realms]\n#{final_string}"
   end
diff --git a/lib/puppet/functions/krb5conf/simple_hash_section.rb b/lib/puppet/functions/krb5conf/simple_hash_section.rb
index 839277d..9cf0f3b 100644
--- a/lib/puppet/functions/krb5conf/simple_hash_section.rb
+++ b/lib/puppet/functions/krb5conf/simple_hash_section.rb
@@ -1,15 +1,18 @@
 Puppet::Functions.create_function(:'krb5conf::simple_hash_section') do
   def simple_hash_section(hash, title)
+    indent = 4
+    spacer = ' ' * indent
+
     lengths = hash.keys().map { |x| x.length() }
     max_length = lengths.max
     rv = []
     hash.each do |key, value|
       if (key == 'COMMENT') then
         # Add a '#' mark at the start of each line.
-        formatted_lines = value.split("\n").map { |l| '  # ' + l }
+        formatted_lines = value.split("\n").map { |l| spacer + '# ' + l }
         rv.push(formatted_lines)
       else
-        rv.push(sprintf("  %-#{max_length}s = %s", key, value))
+        rv.push(sprintf("#{spacer}%-#{max_length}s = %s", key, value))
       end
     end
     return "[#{title}]\n" + rv.join("\n") + "\n"
-- 
GitLab