Browse Source

fixed to work in chef-10

Xabier de Zuazo 9 years ago
parent
commit
d08489f233
2 changed files with 13 additions and 13 deletions
  1. 9 9
      libraries/conf.rb
  2. 4 4
      recipes/conf_files.rb

+ 9 - 9
libraries/conf.rb

@@ -43,7 +43,7 @@ module Dovecot
   <%  unless conf.has_key?("driver") -%>
   driver = <%=   @driver %>
   <%  end -%>
-  <%  conf.to_hash.sort.each do |key, value|
+  <%  conf.sort.each do |key, value|
         unless value.nil?
   -%>
   <%=     key %> = <%= @Dovecot_Conf.value(value) %>
@@ -65,7 +65,7 @@ module Dovecot
 
       template =
 'plugin {
-  <% @conf.to_hash.sort.each do |key, value|
+  <% @conf.sort.each do |key, value|
        unless value.nil?
   -%>
   <%=    key %> = <%= @Dovecot_Conf.value(value) %>
@@ -84,7 +84,7 @@ module Dovecot
 
       template =
 'namespace <%= @ns["name"] %> {
-<%   @ns.to_hash.sort.each do |key, value|
+<%   @ns.sort.each do |key, value|
        if key != "name"
   -%>
   <%=    key %> = <%= @Dovecot_Conf.value(value) %>
@@ -104,7 +104,7 @@ module Dovecot
 
       template =
 'protocol <%= @name %> {
-  <% @conf.to_hash.sort.each do |key, value| -%>
+  <% @conf.sort.each do |key, value| -%>
   <%=  key %> = <%= @Dovecot_Conf.value(value) %>
   <% end -%>
 }'
@@ -124,19 +124,19 @@ module Dovecot
   <% if @conf["listeners"].kind_of?(Array) or @conf["listeners"].kind_of?(Hash)
       listeners = @conf["listeners"].kind_of?(Array) ? @conf["listeners"] : [ @conf["listeners"] ]
       listeners.each do |listener|
-        listener.to_hash.sort.each do |service, values|
+        listener.sort.each do |service, values|
           service_proto = service.split(":")[0]
           service_name = service.split(":")[1]
   -%>
   <%=     service_proto %>_listener <%= service_name %> {
-  <%        values.to_hash.sort.each do |key, value|-%>
+  <%        values.sort.each do |key, value|-%>
     <%=       key %> = <%= @Dovecot_Conf.value(value) %>
   <%        end -%>
   }
   <%     end -%>
   <%   end -%>
   <% end -%>
-  <% @conf.to_hash.sort.each do |key, value|
+  <% @conf.sort.each do |key, value|
        if key != "listeners"
   -%>
   <%=    key %> = <%= @Dovecot_Conf.value(value) %>
@@ -156,12 +156,12 @@ module Dovecot
 
     template =
 'map {
-<%     @map.sort.to_hash.each do |k, v|
+<%     @map.sort.each do |k, v|
          if v.kind_of?(Hash)
 -%>
   <%=      k %> {
 <%
-           v.to_hash.sort.each do |k2, v2|
+           v.sort.each do |k2, v2|
 -%>
     <%=      k2 %> = <%= @Dovecot_Conf.value(v2) %>
 <%         end -%>

+ 4 - 4
recipes/conf_files.rb

@@ -53,10 +53,10 @@ node['dovecot']['conf_files'].each do |type, conf_files|
       group node['dovecot']['conf_files_group']
       mode node['dovecot']['conf_files_mode']
       variables(
-        :auth => node['dovecot']['auth'],
-        :protocols => node['dovecot']['protocols'],
-        :services => node['dovecot']['services'],
-        :plugins => node['dovecot']['plugins'],
+        :auth => node['dovecot']['auth'].to_hash,
+        :protocols => node['dovecot']['protocols'].to_hash,
+        :services => node['dovecot']['services'].to_hash,
+        :plugins => node['dovecot']['plugins'].to_hash,
         :namespaces => node['dovecot']['namespaces'],
         :conf => node['dovecot']['conf']
       )