opscode-cookbooks/openssh — pull request #47 by jtimberman (2014-10-29 06:38:32+00:00)
Title: pass the port as a variable to the iptables template

This improves on the change in PR #31. /cc @juliandunn @someara @cwebberOps

The `iptables_rule` definition can take a `variables` parameter. This
allows us to improve the logic for sending the correct port to
iptables.

Since the node's openssh attributes can be manipulated by end users,
we can't necessarily assume that `node['openssh']['server']['port']`
will return true, or that it won't have an exception on nil. Instead,
determine that we do in fact have the openssh "server" attribute AND
that it has a "port" attribute, using the predicate `#attribute?`
method. We can fallback to port 22 (and do) in this conditional.