diff options
author | Luke Kanies <luke@madstop.com> | 2008-07-03 15:13:09 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-07-03 15:13:09 -0500 |
commit | 04ecb742f46cf8e48337c854a5ff2377caf60db1 (patch) | |
tree | 31b0e613d272fd0b2572116286ae2f69221546e2 /lib | |
parent | a87885a4be181206d2f2c1d6225598c67e315717 (diff) | |
download | puppet-04ecb742f46cf8e48337c854a5ff2377caf60db1.tar.gz puppet-04ecb742f46cf8e48337c854a5ff2377caf60db1.tar.xz puppet-04ecb742f46cf8e48337c854a5ff2377caf60db1.zip |
Doing what I can to fix #1128, but just in preparation for removing 'interface'.
This type needs to be started again from scratch, and I'm not
going to do so for 0.24.5.
In particular, the model for red hat and sunos need to match --
they should both use the device name as the actual name.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/interface/redhat.rb | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/puppet/provider/interface/redhat.rb b/lib/puppet/provider/interface/redhat.rb index 4a9fcb491..71f2a6327 100644 --- a/lib/puppet/provider/interface/redhat.rb +++ b/lib/puppet/provider/interface/redhat.rb @@ -57,14 +57,14 @@ LOOPBACKDUMMY def self.instances # parse all of the config files at once Dir.glob("%s/ifcfg-*" % INTERFACE_DIR).collect do |file| - record = parse(file) + instance = parse(file) # store the existing dummy interfaces - @@dummies << record[:ifnum] if (record[:interface_type] == :dummy and ! @@dummies.include?(record[:ifnum])) + @@dummies << instance.ifnum if (instance.interface_type == :dummy and ! @@dummies.include?(instance.ifnum)) - @@aliases[record[:interface]] << record[:ifnum] if record[:interface_type] == :alias + @@aliases[instance.interface] << instance.ifnum if instance.interface_type == :alias - new(record) + instance end end @@ -95,12 +95,18 @@ LOOPBACKDUMMY # Parse the existing file. def self.parse(file) - instance = new() + unless file =~ /-([^-]+)$/ + Puppet.warning "Could not extract interface name from %s; skipping" % file + return nil + end + name = $1 + instance = new(:name => name) return instance unless FileTest.exist?(file) File.readlines(file).each do |line| if line =~ /^(\w+)=(.+)$/ - instance.send($1.downcase + "=", $2) + method = $1.downcase + "=" + instance.send(method, $2) if instance.respond_to?(method) end end @@ -197,11 +203,16 @@ LOOPBACKDUMMY end end + # LAK:NOTE This method is why this resource type has been disabled. + # The model is ridiculous -- the device name should be the interface + # name. We're 90% of the way toward making this possible, but I'm not + # taking the time to fix it. # Set the name to our ip address. def ipaddr=(value) @property_hash[:name] = value end + # whether the device is to be brought up on boot or not. converts # the true / false of the type, into yes / no values respectively # writing out the ifcfg-* files |