Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add definition validation and munge for ha-sync-batch-size #489

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/puppet/type/rabbitmq_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ def validate_definition(definition)
raise ArgumentError, "Invalid shards-per-node value '#{shards_per_node_val}'"
end
end
if definition.key? 'ha-sync-batch-size'
ha_sync_batch_size_val = definition['ha-sync-batch-size']
unless ha_sync_batch_size_val.to_i.to_s == ha_sync_batch_size_val
raise ArgumentErro, "Invalid ha-sync-batch-size value '#{ha_sync_batch_size_val}'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raise ArgumentError

end
end
end

def munge_definition(definition)
Expand All @@ -123,6 +129,9 @@ def munge_definition(definition)
if definition.key? 'shards-per-node'
definition['shards-per-node'] = definition['shards-per-node'].to_i
end
if definition.key? 'ha-sync-batch-size'
definition['ha-sync-batch-size'] = definition['ha-sync-batch-size'].to_i
end
definition
end
end