Gavin Williams
2014-Feb-05 17:04 UTC
[Puppet Users] File.exists? validation failure when trying to create file in same catalogue
Afternoon all I'm currently doing some final testing on my Glassfish module[1] before I look to release it. However I've just stumbled across an issue where-by Puppet fails the run based on some File.exists? validation in one of the types, which is trying to use a file that is being created earlier in the catalogue... E.g:> $ cat glassfish.pp > package { 'unzip': ensure => present } > > include glassfish > > file { '/tmp/asadmin.pass': > ensure => present, > # path => '/tmp/asadmin.pass', > content => 'AS_ADMIN_PASSWORD=adminadmin', > mode => '0644', > require => Class['glassfish'] > } > > glassfish::create_domain {'test': > asadmin_passfile => '/tmp/asadmin.pass', > require => File['/tmp/asadmin.pass'] > } >The exception I'm getting is:> $ sudo puppet apply --modulepath=~/modules/ glassfish.pp -v > Info: Loading facts in > /home/vagrant/modules/stdlib/lib/facter/pe_version.rb > Info: Loading facts in > /home/vagrant/modules/stdlib/lib/facter/puppet_vardir.rb > Info: Loading facts in > /home/vagrant/modules/stdlib/lib/facter/facter_dot_d.rb > Info: Loading facts in /home/vagrant/modules/stdlib/lib/facter/root_home.rb > Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults > Notice: Compiled catalog for glassfish-ubuntu.dt0388.test in environment > production in 0.40 seconds > Error: Parameter passwordfile failed on Domain[test]: /tmp/asadmin.pass > does not exist at > /home/vagrant/modules/glassfish/manifests/create_domain.pp:41 > Wrapped exception: > /tmp/asadmin.pass does not exist >And that exception is being thrown from here[2]. Is there any way of working around this? I've tried putting in *autorequire *behaviour like so:> # Autorequire the password file > autorequire(:file) do > self[:passwordfile] > end >However I still get the same failure on testing... Thoughts/comments welcome. Regards Gavin [1] https://github.com/fatmcgav/puppet-glassfish [2] https://github.com/fatmcgav/puppet-glassfish/blob/master/lib/puppet/type/domain.rb#L46-L54 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/06b301a2-1ff4-4c52-88e7-76db272c396b%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.