# Executed if method is missing. In this case we are going to catch
# unqualified property methods for dynamic property setting and getting.
def method_missing(meth, *args, &block)
- if @property_hash.keys.include?(meth) then
- return @property_hash[meth.to_sym]
- elsif @property_hash.keys.include?(meth.to_s.chomp("=").to_sym) then
+ dynamic_methods = @@resource_map.keys
+ dynamic_methods << :chain
+ dynamic_methods << :table
+
+ if dynamic_methods.include?(meth.to_sym) then
+ if @property_hash[meth.to_sym] then
+ return @property_hash[meth.to_sym]
+ else
+ return nil
+ end
+ elsif dynamic_methods.include?(meth.to_s.chomp("=").to_sym) then
+ debug("Args: #{args}")
@property_hash[:needs_change] = true
return true
end
+ debug("Dynamic methods: #{dynamic_methods.join(' ')}")
+ debug("Method missing: #{meth}. Calling super.")
+
super
end
end
hash[:provider] = self.name.to_s
hash[:table] = table
hash[:ensure] = :present
+
+ # Munge some vars here ...
+ # proto should equal 'all' if undefined
+ hash[:proto] = "all" if !hash.include?(:proto)
+
hash
end
-# Puppet Firewall Module
-#
-# Copyright (C) 2011 Bob.sh Limited
-# Copyright (C) 2008 Camptocamp Association
-# Copyright (C) 2007 Dmitri Priimak
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
+# Puppet Firewall type
require 'puppet/util/firewall'
require 'puppet/property/ordered_list'