Skip to content

Commit

Permalink
Merge pull request #166 from markeganfuller/fix_ordering
Browse files Browse the repository at this point in the history
Fix ordering when checking insync
  • Loading branch information
crayfishx authored Jun 13, 2018
2 parents 81ca50f + f8a90d6 commit 0561230
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions lib/puppet/type/firewalld_ipset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@

@doc =%q{
Configure IPsets in Firewalld
Example:
firewalld_port {'Open port 8080 in the public Zone':
ensure => 'present',
zone => 'public',
port => 8080,
protocol => 'tcp',
}
}

ensurable

newparam(:name, :namevar => true) do
desc "Name of the IPset"
validate do |val|
raise Puppet::Error, "IPset name must be a word with no spaces" unless val =~ /^\w+$/
end
end

newparam(:type) do
desc "Type of the ipset (default: hash:ip)"
defaultto "hash:ip"
Expand All @@ -38,9 +38,9 @@
newproperty(:entries, :array_matching => :all) do
desc "Array of ipset entries"
def insync?(is)
should.sort == is
should.sort == is.sort
end
end

end

28 changes: 14 additions & 14 deletions lib/puppet/type/firewalld_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def generate

def insync?(is)
case should
when String then should.lines.sort == is
when Array then should.sort == is
when String then should.lines.sort == is.sort
when Array then should.sort == is.sort
else raise Puppet::Error, "parameter interfaces must be a string or array of strings!"
end
end
Expand All @@ -82,8 +82,8 @@ def insync?(is)

def insync?(is)
case should
when String then should.lines.sort == is
when Array then should.sort == is
when String then should.lines.sort == is.sort
when Array then should.sort == is.sort
else raise Puppet::Error, "parameter sources must be a string or array of strings!"
end
end
Expand All @@ -102,11 +102,11 @@ def should_to_s(value = [])
or an array of strings specifying multiple icmp types. Any blocks not specified here will be removed
"
def insync?(is)
case should
when String then should.lines.sort == is
when Array then should.sort == is
else raise Puppet::Error, "parameter icmp_blocks must be a string or array of strings!"
end
case should
when String then should.lines.sort == is.sort
when Array then should.sort == is.sort
else raise Puppet::Error, "parameter icmp_blocks must be a string or array of strings!"
end
end
end

Expand All @@ -123,7 +123,7 @@ def retrieve
return :false if @resource[:purge_rich_rules] == :false
provider.resource.rich_rules_purgable ? :purgable : :true
end

end

newproperty(:purge_services) do
Expand All @@ -150,7 +150,7 @@ def retrieve
true
end

def retrieve
def retrieve
return :false if @resource[:purge_ports] == :false
provider.resource.ports_purgable ? :purgable : :true
end
Expand Down Expand Up @@ -184,15 +184,15 @@ def purge_rich_rules
)

# If the rule exists in --permanent then we should purge it
#
#
purge_resource(res_type)

# Even if it doesn't exist, it may be a running rule, so we
# flag purge_rich_rules as changed so Puppet will reload
# the firewall and drop orphaned running rules
#
@rich_rules_purgable = true


end
end
Expand Down

0 comments on commit 0561230

Please sign in to comment.