voxpupuli / puppet-network

Types and providers to manage network interfaces
https://forge.puppet.com/puppet/network
Apache License 2.0
66 stars 108 forks source link

provider on CentOS 6 #135

Closed lukebigum closed 8 years ago

lukebigum commented 8 years ago

Following on from the second issue reported in #129, I'm modifying the redhat network_config provider to work on CentOS 6. I've ran into an issue where parameters that are undef in a Puppet manifest are being written to disk as "KEY=absent". The issue is reproduced in an acceptance test I've added to https://github.com/lukebigum/puppet-network:

git clone git@github.com:lukebigum/puppet-network.git cd puppet-network ln -s centos-65-x64.yml spec/acceptance/nodesets/default.yml bundle exec rake acceptance

And an example of the failed test:

3) network building various network configurations File "/etc/sysconfig/network-scripts/ifcfg-eth0" content should not match /^IPADDR=/ Failure/Error: its(:content) { should_not match /^IPADDR=/ } expected "ONBOOT=yes\nslave=yes\nIPADDR=absent\nDEVICE=eth0\nNETMASK=absent\nHOTPLUG=yes\nmaster=bond0\nMTU=absent\ntype=Ethernet\nBOOTPROTO=static\n" not to match /^IPADDR=/ Diff: @@ -1,2 +1,11 @@ -/^IPADDR=/ +ONBOOT=yes +slave=yes +IPADDR=absent +DEVICE=eth0 +NETMASK=absent +HOTPLUG=yes +master=bond0 +MTU=absent +type=Ethernet +BOOTPROTO=static

I can fudge it by explicitly filtering out "value != :absent", however there is another issue where the puppet type is not idempotent (continually applies) so I think there is something lower down interfering with the provider reading and writing Type parameters properly.

Is anyone able to assist?

lukebigum commented 8 years ago

136 now has the code to fix this.