summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/interface
diff options
context:
space:
mode:
authorchristian <christian@980ebf18-57e1-0310-9a29-db15c13687c0>2007-08-09 09:18:56 +0000
committerchristian <christian@980ebf18-57e1-0310-9a29-db15c13687c0>2007-08-09 09:18:56 +0000
commitada960be3aed0610e8f9311b6b4c4c3f26254611 (patch)
treef664bd1686d2f5d11768b434b2a52ebc3166e4d3 /lib/puppet/provider/interface
parent8f059510ae0c2b690b3b800778ca765860645357 (diff)
downloadpuppet-ada960be3aed0610e8f9311b6b4c4c3f26254611.tar.gz
puppet-ada960be3aed0610e8f9311b6b4c4c3f26254611.tar.xz
puppet-ada960be3aed0610e8f9311b6b4c4c3f26254611.zip
Constants in provider/interface/redhat.rb are getting redifined as they are dynamically assigned, changing them to instance variables
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2762 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider/interface')
-rw-r--r--lib/puppet/provider/interface/redhat.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/puppet/provider/interface/redhat.rb b/lib/puppet/provider/interface/redhat.rb
index 1f269f0ca..2f8611811 100644
--- a/lib/puppet/provider/interface/redhat.rb
+++ b/lib/puppet/provider/interface/redhat.rb
@@ -2,14 +2,14 @@ require 'puppet/provider/parsedfile'
require 'erb'
Puppet::Type.type(:interface).provide(:redhat) do
- INTERFACE_DIR = "/etc/sysconfig/network-scripts"
- confine :exists => INTERFACE_DIR
+ @interface_dir = "/etc/sysconfig/network-scripts"
+ confine :exists => @interface_dir
defaultfor :operatingsystem => [:fedora, :centos, :redhat]
# Create the setter/gettor methods to match the model.
mk_resource_methods
- ALIAS_TEMPLATE = ERB.new <<-ALIAS
+ @alias_template = ERB.new <<-ALIAS
DEVICE=<%= self.device %>
ONBOOT=<%= self.on_boot %>
BOOTPROTO=<%= self.bootproto %>
@@ -19,7 +19,7 @@ BROADCAST=
ALIAS
- LOOPBACK_TEMPLATE = ERB.new <<-LOOPBACKDUMMY
+ @loopback_template = ERB.new <<-LOOPBACKDUMMY
DEVICE=<%= self.device %>
ONBOOT=<%= self.on_boot %>
BOOTPROTO=static
@@ -29,10 +29,10 @@ BROADCAST=
LOOPBACKDUMMY
# maximum number of dummy interfaces
- MAX_DUMMIES = 10
+ @max_dummies = 10
# maximum number of aliases per interface
- MAX_ALIASES_PER_IFACE = 10
+ @max_aliases_per_iface = 10
@@dummies = []
@@ -42,7 +42,7 @@ LOOPBACKDUMMY
# use prior to needing to call self.next_dummy later on.
def self.instances
# parse all of the config files at once
- Dir.glob("%s/ifcfg-*" % INTERFACE_DIR).collect do |file|
+ Dir.glob("%s/ifcfg-*" % @interface_dir).collect do |file|
record = parse(file)
@@ -61,7 +61,7 @@ LOOPBACKDUMMY
# return the next avaliable dummy interface number, in the case where
# ifnum is not manually specified
def self.next_dummy
- MAX_DUMMIES.times do |i|
+ @max_dummies.times do |i|
unless @@dummies.include?(i.to_s)
@@dummies << i.to_s
return i.to_s
@@ -72,7 +72,7 @@ LOOPBACKDUMMY
# return the next available alias on a given interface, in the case
# where ifnum if not manually specified
def self.next_alias(interface)
- MAX_ALIASES_PER_IFACE.times do |i|
+ @max_aliases_per_iface.times do |i|
unless @@aliases[interface].include?(i.to_s)
@@aliases[interface] << i.to_s
return i.to_s
@@ -186,18 +186,18 @@ LOOPBACKDUMMY
# the interface type
case @resource.should(:interface_type)
when :loopback
- return LOOPBACK_TEMPLATE.result(binding)
+ return @loopback_template.result(binding)
when :alias
- return ALIAS_TEMPLATE.result(binding)
+ return @alias_template.result(binding)
end
end
# Where should the file be written out?
- # This defaults to INTERFACE_DIR/ifcfg-<namevar>, but can have a
+ # This defaults to @interface_dir/ifcfg-<namevar>, but can have a
# more symbolic name by setting interface_desc in the type.
def file_path
@resource[:interface_desc] ||= @resource[:name]
- return File.join(INTERFACE_DIR, "ifcfg-" + @resource[:interface_desc])
+ return File.join(@interface_dir, "ifcfg-" + @resource[:interface_desc])
end