On 11/03/14 23:09, nfwlpw wrote:
So I have a puppet module, that gets a script from files/, runs that script, and after it's done, I'd like to remove it.

Unfortunately puppet doesn't seem to like to have 2 different File resource aliased to the same, so I can't do

file { "myfile":
    ensure => present,
    source => "puppet:///...",
}

file { "remove myfile":
    path => "myfile",
   ensure => absent,
}

Puppet gave the error: err: Failed to apply catalog: Cannot alias File[remove myfile]...myfile already declared...

The only work around I've found is using an exec resource. Anyone know how to do this without exec?

Thank you


Thats the nature of puppet.

It describes the 'state' of your node. So the file cannot be present and absent at the same time.


you could use an exec that wget/curl/... your tempfile, execute it, and remove it, and using a creates => <some file created by the script> to run it only when needed.

depends on what you exactly wants to achieve.











--
Johan De Wit

Open Source Consultant

Red Hat Certified Engineer         (805008667232363)
Puppet Certified Professional 2013 (PCP0000006)
_________________________________________________________
Open-Future Phone +32 (0)2/255 70 70
Zavelstraat 72              Fax       +32 (0)2/255 70 71
3071 KORTENBERG             Mobile    +32 (0)474/42 40 73
BELGIUM                     http://www.open-future.be
_________________________________________________________
Next Events:
Zabbix Certified Training | 
http://www.open-future.be/zabbix-certified-training-10-till-12th-march
Zabbix for Large Environments Training | 
http://www.open-future.be/zabbix-large-environments-training-13-till-14th-march
Puppet Intruction Course | 
http://www.open-future.be/puppet-introduction-course-14th-april
Puppet Advanced Training | 
http://www.open-future.be/puppet-advanced-training-15-till-17th-april
Subscribe to our newsletter | http://eepurl.com/BUG8H

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/531F8FF6.6050000%40open-future.be.
For more options, visit https://groups.google.com/d/optout.

Reply via email to