Hi Sebastian,

Thanks for the reply.

*What happens if you do "vagrant destroy -f && vagrant up && 
vagrant provision"?*

If I run that, the master file is built as expected - I assume because the 
by the time the second puppet provision is called, the file structure is in 
place.

Could you elaborate on what the timing issue is? Is it a puppet or vagrant 
issue? I added the following to my puppet setup to make puppet wait 2 
seconds before building the master configuration file but it still fails:

  exec { 'wait_for_files' :
    before => File["/etc/sysconfig/iptables/iptables-rules"],
    command => "sleep 2",
    path => "/usr/bin:/bin",
  }
  
  file { "/etc/sysconfig/iptables/iptables-rules" :
    content => template("iptables/load.erb"),
  }

Thanks,

Luke
 



On Monday, 26 January 2015 14:07:17 UTC, Sebastian Otaegui wrote:
>
> This sounds like an ordering problem.
>
> What happens if you do "vagrant destroy -f && vagrant up && 
> vagrant provision"?
>
> If that works it may mean that you need to run puppet apply multiple times 
> and that can point to an order issue.
>
> Regards 
>
> On Monday, January 26, 2015, Luke O'Sullivan <[email protected] 
> <javascript:>> wrote:
>
>>   
>> <http://stackoverflow.com/questions/28150477/file-traverse-and-read-failure-in-vagrant-puppet-setup#>
>>  
>>   
>> I have a Vagrant / Puppet set up in which I am attempting to generate a 
>> bunch of configuration files and then concatenate them into a master file.
>>
>> The individual files are generated and written to a conf directory and 
>> the last action is to create the master file which uses an erb template to 
>> read the files in the conf directory.
>>
>> <% files = Dir["/etc/sysconfig/iptables/conf/*.conf"] -%>
>> <% files.each do |name| -%>
>> <% file = File.open(name) -%>
>> <% contents = file.read -%>
>> <%= contents %>
>> <% end -%>
>>
>> When I run "vagrant up", everything appears to run correctly but the 
>> master configuration file is empty. I have checked the timestamps on the 
>> conf directory and the master configuration file and they are correct (the 
>> master config file is created after all the individual config files).
>>
>> If I ssh into vagrant and run "puppet apply" manually, the master config 
>> file is created as expected. I have tried using a bash script instead of 
>> the erb method but encountered the same problems.
>>
>> Does anyone have any ideas what might cause this?
>>  
>> -- 
>> 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 [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/ee7bea64-eb74-42be-b724-2e95d08ae4c6%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/puppet-users/ee7bea64-eb74-42be-b724-2e95d08ae4c6%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Those who do not understand Unix are condemned to reinvent it, poorly.
> Any sufficiently recent Microsoft OS contains an ad hoc, 
> informally-specified, bug-ridden, slow implementation of half of Unix.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c483df41-feb1-4e79-b8f8-830da148f763%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to