Using the somewhat not-officially-released-but-available 0.23.2:
With the following .pp file:
interface { "codguweb01-ssc0":
onboot => true,
ifopts => "netmask + broadcast + group nafo deprecated -failover",
target => "/tmp/interface-test/hostname.ce0",
require => Interface["foobar"],
interface => "ce0"
}
interface { "foobar":
interface_type => "alias",
onboot => true,
ifopts => "netmask + broadcast +",
target => "/tmp/interface-test/hostname.ce0",
interface => "ce0"
}
I get the following error:
debug: Prefetching sunos resources for interface
debug: //Interface[codguweb01-ssc0]/require: requires Interface[foobar]
debug: //Interface[foobar]: Changing ensure
debug: //Interface[foobar]: 1 change(s)
debug: //Interface[foobar]/ensure: setting present (currently absent)
notice: //Interface[foobar]/ensure: created
debug: Flushing interface provider target
/opt/lib/ruby/site_ruby/1.8/puppet/util/filetype.rb:72:in `exists?'
/opt/lib/ruby/site_ruby/1.8/puppet/util/filetype.rb:72:in `backup'
/opt/lib/ruby/site_ruby/1.8/puppet/util/filetype.rb:104:in `write'
/opt/lib/ruby/site_ruby/1.8/puppet/util/filetype.rb:50:in `real_write'
/opt/lib/ruby/site_ruby/1.8/puppet/util/filetype.rb:50:in `write'
/opt/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:86:in `flush_target'
/opt/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:74:in `flush'
/opt/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in `each'
/opt/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in `flush'
/opt/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:324:in `flush'
/opt/lib/ruby/site_ruby/1.8/puppet/metatype/evaluation.rb:40:in `flush'
/opt/lib/ruby/site_ruby/1.8/puppet/transaction.rb:77:in `apply'
/opt/lib/ruby/site_ruby/1.8/puppet/transaction.rb:231:in `eval_resource'
/opt/lib/ruby/site_ruby/1.8/puppet/util.rb:444:in `thinmark'
/opt/lib/ruby/1.8/benchmark.rb:293:in `measure'
/opt/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/opt/lib/ruby/site_ruby/1.8/puppet/util.rb:443:in `thinmark'
/opt/lib/ruby/site_ruby/1.8/puppet/transaction.rb:230:in `eval_resource'
/opt/lib/ruby/site_ruby/1.8/puppet/transaction.rb:301:in `evaluate'
/opt/lib/ruby/site_ruby/1.8/puppet/util.rb:444:in `thinmark'
/opt/lib/ruby/1.8/benchmark.rb:293:in `measure'
/opt/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/opt/lib/ruby/site_ruby/1.8/puppet/util.rb:443:in `thinmark'
/opt/lib/ruby/site_ruby/1.8/puppet/transaction.rb:300:in `evaluate'
/opt/lib/ruby/site_ruby/1.8/puppet/transaction.rb:294:in `collect'
/opt/lib/ruby/site_ruby/1.8/puppet/transaction.rb:294:in `evaluate'
/opt/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:68:in `apply'
/opt/bin/puppet:194
err: Could not apply complete configuration: Puppet::Util::FileType::FileTypeFlat could not write : can't convert nil into String
debug: Storing state
debug: Stored state in 0.08 seconds
Changing newparam(:target) to newproperty(:target) in interface.rb fixes the problem for me.
The only ugly thing remaining is that prefetch seems to ignore the target, since I then get the following
messages on _every_ run, when using a non-standard target file (i.e. not /etc/hostname.*):
debug: Prefetching sunos resources for interface
debug: //Interface[codguweb01-ssc0]/require: requires Interface[foobar]
debug: //Interface[foobar]: Changing ensure
debug: //Interface[foobar]: 1 change(s)
debug: //Interface[foobar]/ensure: setting present (currently absent)
notice: //Interface[foobar]/ensure: created
debug: Flushing interface provider target /tmp/interface-test/hostname.ce0
debug: Finishing transaction 3692616 with 0 changes
debug: //Interface[codguweb01-ssc0]: Changing ensure
debug: //Interface[codguweb01-ssc0]: 1 change(s)
debug: //Interface[codguweb01-ssc0]/ensure: setting present (currently absent)
notice: //Interface[codguweb01-ssc0]/ensure: created
debug: Flushing interface provider target /tmp/interface-test/hostname.ce0
please not the "currently absent" bit, which is reported even if the interface is already in /tmp/interface-test/hostname.ce0.