summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2021-06-05 12:15:37 -0700
committerJohn McCrae <john.mccrae@progress.com>2021-06-14 19:01:10 -0700
commit837da73b4c3a2c554db4c7ff846095232b8b2ef4 (patch)
treeadf98e2b501ee53360af440cf3c38b7dbdc77892
parent5facbcbfa9d67f3647cfecfcfdedcb6b477e9437 (diff)
downloadchef-837da73b4c3a2c554db4c7ff846095232b8b2ef4.tar.gz
Handle arrays in the zypper repo template
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/provider/support/zypper_repo.erb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/chef/provider/support/zypper_repo.erb b/lib/chef/provider/support/zypper_repo.erb
index 6d508fa77f..23e871e406 100644
--- a/lib/chef/provider/support/zypper_repo.erb
+++ b/lib/chef/provider/support/zypper_repo.erb
@@ -1,15 +1,17 @@
-# This file was generated by Chef
+# This file was generated by Chef Infra
# Do NOT modify this file by hand.
[<%= @config.repo_name %>]
<% %w{ type enabled autorefresh gpgcheck gpgkey baseurl mirrorlist path priority keeppackages mode refresh_cache }.each do |prop| -%>
-<% next if @config.send(prop.to_sym).nil? -%>
+<% next if @config.send(prop.to_sym).nil? || (@config.send(prop.to_sym).is_a?(Array) && @config.send(prop.to_sym).empty?) -%>
<%= prop %>=<%=
case @config.send(prop.to_sym)
when TrueClass
'1'
when FalseClass
'0'
+ when Array
+ @config.send(prop.to_sym).join("\n ")
else
@config.send(prop.to_sym)
end %>