Thijs Oppermann
2007-Jan-15 23:17 UTC
Re: How to conditionally run defines? (and a question about updating... )
OK, too bad. I could work around it of course by adding ''unless'' and ''creates'' clauses on all the individual parts of the define where appropriate, but I think I''ll just ignore the warnings and overhead for now. It would be cool, though, if something like the ''unless'', ''onlyif'', etc, logic was available for all resources (or at least, those where they make some sense) as well as defines. By the way... I''m not seeing the answer to this just now on the site: to update puppet to the next version just install the new version over the old one? That''s how I''m doing it now, but I don''t know if that will result in stale files being left behind? Thijs On 15/01/07, Luke Kanies <luke@madstop.com> wrote:> > On Jan 16, 2007, at 1:38 AM, Thijs Oppermann wrote: > > > Hi all, > > > > Is there a (simple) way to add conditionals to a call to a define? > > What I want is to run a define only if a file (that gets created > > somewhere along the run of the define) does not exist. In this way I > > can skip a whole lot of setup work in the define if I know it has > > already run once before. I would think adding a unless clause would be > > a elegant solution (and the other conditionals like onlyif that exist > > elsewhere too). > > > > So that I can call my defines with something like this: > > > > installesite { "testaa": > > require => [ perlinstall[ "everything" ], exec[ > > "fix-everything-sqldefs" ] ], > > unless => "test -e /var/www/testaa/index.pl", > > } > > > > I don''t know if this would be easy to add to the puppet language, or > > if it can easily be emulated with code in the define itself? I''m > > drawing a bit of a blank on the last option at the moment... ;) > > At this point, there''s no real way to do this right now. > > You could kind of hack this right now, by having your definition have > an exec at the beginning that will fail if the file exists, thus > skipping the entire definition (because resources will be skipped if > they have failed dependencies). This will result in a lot of > erroneous warnings, though. > > It seems that Puppet needs some kind of way to skip configuration > branches, other than by throwing failures. I''ll think about it, but > for now, you can''t do this, unfortunately. > > -- > I take my children everywhere, but they always find their way back > home. > --Robert Orben > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >_______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Luke Kanies
2007-Jan-15 23:25 UTC
Re: How to conditionally run defines? (and a question about updating... )
On Jan 16, 2007, at 10:17 AM, Thijs Oppermann wrote:> OK, too bad. I could work around it of course by adding ''unless'' > and ''creates'' clauses on all the individual parts of the define > where appropriate, but I think I''ll just ignore the warnings and > overhead for now.Okay. I''m always looking for specific recommendations on how to better do this. I agree it should be better, but I don''t know exactly how it should work.> It would be cool, though, if something like the ''unless'', ''onlyif'', > etc, logic was available for all resources (or at least, those > where they make some sense) as well as defines.Yeah, I''ve often thought the same thing. I''m a bit afraid of some of the repercussions, though, because it could tend to make configurations a lot more prone to instability and a lot less computable. E.g., the same configuration could behave completely differently on machines that are almost but not quite the same, which is a bit frightening. It''s fine to use them with execs because you have to have something like these parameters to make execs idempotent, but the rest of the resources are naturally idempotent, so these extra parameters would only be used for efficiency, which probably isn''t worth it, or for making widely diverging configurations, which is probably a very bad idea.> By the way... I''m not seeing the answer to this just now on the > site: to update puppet to the next version just install the new > version over the old one? That''s how I''m doing it now, but I don''t > know if that will result in stale files being left behind?I''d say that''s a packaging question, not a Puppet question per se. If you''re using Puppet''s installation script, then you *should* be okay just installing over it, but it''s far better to use native packages if they''re available. -- It is well to remember that the entire universe, with one trifling exception, is composed of others. --John Andrew Holmes --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Apparently Analagous Threads
- How to conditionally run defines?
- Re: classes and definitions --> RFC <--
- error "Stack level too deep" on ''exec[ "perl Makefile.PL" ] ?
- Using Puppet to swap eth0 and eth1
- Example module for central git repository via http (sort of like a subversion repo) [a bit RFC]