Skip to content
Snippets Groups Projects
Commit 6e5a02e3 authored by Adam Lewenberg's avatar Adam Lewenberg
Browse files

adjust indent spacing

parent 8a1f545b
No related branches found
No related tags found
No related merge requests found
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
......
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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment