Skip to content

Add support for max-length-bytes as a integer #557

@zhianliu

Description

@zhianliu

We already support supplying max-length as an integer, but max-length-bytes isn't. When supplying the parameter, the module translates it into a string which won't work in the rabbitmq config file. We've added this patch for now to get around this issue, would love to see this get patch in the module in the future

index 37fd3de..393c175 100644
--- a/modules/rabbitmq/lib/puppet/type/rabbitmq_policy.rb
+++ b/modules/rabbitmq/lib/puppet/type/rabbitmq_policy.rb
@@ -99,6 +99,12 @@ Puppet::Type.newtype(:rabbitmq_policy) do
         raise ArgumentError, "Invalid max-length value '#{max_length_val}'"
       end
     end
+    if definition.key? 'max-length-bytes'
+      max_length_bytes_val = definition['max-length-bytes']
+      unless max_length_bytes_val.to_i.to_s == max_length_bytes_val
+        raise ArgumentError, "Invalid max-length-bytes value '#{max_length_bytes_val}'"
+      end
+    end
     if definition.key? 'shards-per-node'
       shards_per_node_val = definition['shards-per-node']
       unless shards_per_node_val.to_i.to_s == shards_per_node_val
@@ -126,6 +132,9 @@ Puppet::Type.newtype(:rabbitmq_policy) do
     if definition.key? 'max-length'
       definition['max-length'] = definition['max-length'].to_i
     end
+    if definition.key? 'max-length-bytes'
+      definition['max-length-bytes'] = definition['max-length-bytes'].to_i
+    end
     if definition.key? 'shards-per-node'
       definition['shards-per-node'] = definition['shards-per-node'].to_i
     end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions