Max
2007-Apr-09 13:46 UTC
Watch a file during the day and just report changes, replace on a scheduleat night if chnged during the day: needs to be a type?
Hi, In our dev/int environemnts, our user base wants to be able to change managed files at will during the day but be notified via email of changes that happen. At night they want the files replaced to their known good state if there were changed. I tried to do this with a custom function that wraps two file types, one that just watches checksum, the other that does a reset of content with a schedule that limits the reset to overnight but ran into the rule that Luke has designed in for "there shall be only one defintion per file" :). Just wondering if there is a way to do this without creating a custom type (not that creating a custom type is bad, just trying to keep configs simple). Any ideas? Thanks, Max
Atom Powers
2007-Apr-09 16:22 UTC
Re: Watch a file during the day and just report changes, replace on a scheduleat night if chnged during the day: needs to be a type?
What about two different puppetmasters? One with the "known good" configuration that gets applied at night and one that just checks for updates during the day. That may be more difficult than creating a new type, but it might also be "cleaner" and easier to roll back to known-good at a moment''s notice. On 4/9/07, Max <perldork@webwizarddesign.com> wrote:> Hi, > > In our dev/int environemnts, our user base wants to be able to change > managed files at will during the day but be notified via email of > changes that happen. > > At night they want the files replaced to their known good state if > there were changed. > > I tried to do this with a custom function that wraps two file types, > one that just watches checksum, the other that does a reset of content > with a schedule that limits the reset to overnight but ran into the > rule that Luke has designed in for "there shall be only one defintion > per file" :). > > Just wondering if there is a way to do this without creating a custom > type (not that creating a custom type is bad, just trying to keep > configs simple). > > Any ideas? > > Thanks, > Max > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >-- -- Perfection is just a word I use occasionally with mustard. --Atom Powers--
Max
2007-Apr-09 17:00 UTC
Re: Watch a file during the day and just report changes, replace on a scheduleat night if chnged during the day: needs to be a type?
Nice idea, to keep with just one puppetmaster configuration per client there would then be a ''check only'' instance run during the day and then have the ''reset'' instance run just at night, turned on and off by cron on the puppet master. Cool, cool, definitely one to consider. The negative to this approach is just maintaining two separate puppet configurations in our VCS, if I do a new type then I just have one configuration. Hmm, very interesting, thanks for your response :). On 4/9/07, Atom Powers <atom.powers@gmail.com> wrote:> What about two different puppetmasters? > One with the "known good" configuration that gets applied at night and > one that just checks for updates during the day. That may be more > difficult than creating a new type, but it might also be "cleaner" and > easier to roll back to known-good at a moment''s notice.
Jeff McCune
2007-Apr-09 17:08 UTC
Re: Watch a file during the day and just report changes, replace on a scheduleat night if chnged during the day: needs to be a type?
Max wrote:> Hi, > > In our dev/int environemnts, our user base wants to be able to change > managed files at will during the day but be notified via email of > changes that happen. > > At night they want the files replaced to their known good state if > there were changed. > > I tried to do this with a custom function that wraps two file types, > one that just watches checksum, the other that does a reset of content > with a schedule that limits the reset to overnight but ran into the > rule that Luke has designed in for "there shall be only one defintion > per file" :). > > Just wondering if there is a way to do this without creating a custom > type (not that creating a custom type is bad, just trying to keep > configs simple).You can define two objects with different names that manage the same file. schedule { maint: range => "2 - 4", period => daily, repeat => 1 } define twofile($path = false) { $path_real = $path ? {false => $name, default => $path} file {"MAINT-$name": path => $path_real, replace => true, schedule => maint, before => File["$name-check"], content => "Hello World." } file {"CHECK-$name": path => $path_real, replace => false, content => "Hello World." } } twofile{"/etc/foobar.conf": } -- Jeff McCune The Ohio State University Department of Mathematics Systems Manager _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Max
2007-Apr-09 17:30 UTC
Re: Watch a file during the day and just report changes, replace on a scheduleat night if chnged during the day: needs to be a type?
Hi Jeff, On 4/9/07, Jeff McCune <mccune@math.ohio-state.edu> wrote:> > You can define two objects with different names that manage the same file. > > schedule { maint: range => "2 - 4", period => daily, repeat => 1 } > > define twofile($path = false) { > > $path_real = $path ? {false => $name, default => $path} > > file {"MAINT-$name": path => $path_real, replace => true, > schedule => maint, before => File["$name-check"], > content => "Hello World." } > > file {"CHECK-$name": path => $path_real, replace => false, > content => "Hello World." } > > } > > twofile{"/etc/foobar.conf": }When I did that I got this error: Apr 9 13:25:43 ftsdb-svweb01 puppetd[2257]: [ID 702911 daemon.error] Could not create /etc/mail/aliases-watch: /etc/mail/aliases-replace-daily already exists w ith name /etc/mail/aliases Apr 9 13:25:43 ftsdb-svweb01 puppetd[2257]: [ID 702911 daemon.error] /etc/mail/ aliases-replace-daily already exists with name /etc/mail/aliases I had this in my function: define reset_file_daily($source = "", $ensure = "", $owner = "", $group = "", $mode = "") { file { "${name}-replace-daily": path => $name, source => $source, ensure => $ensure, owner => $owner, group => $group, schedule => rebuild, checksum => md5, mode => $mode; } file { "${name}-watch": path => $name, checksum => md5 } }
Luke Kanies
2007-Apr-16 17:04 UTC
Re: Watch a file during the day and just report changes, replace on a scheduleat night if chnged during the day: needs to be a type?
On Apr 9, 2007, at 12:08 PM, Jeff McCune wrote:> > You can define two objects with different names that manage the > same file. > > schedule { maint: range => "2 - 4", period => daily, repeat => 1 } > > define twofile($path = false) { > > $path_real = $path ? {false => $name, default => $path} > > file {"MAINT-$name": path => $path_real, replace => true, > schedule => maint, before => File["$name-check"], > content => "Hello World." } > > file {"CHECK-$name": path => $path_real, replace => false, > content => "Hello World." } > > } > > twofile{"/etc/foobar.conf": }This doesn''t work because files get aliased so both names are used, and in this case the titles don''t conflict but the names do. -- Barondes'' First Law: Science abhors contradictions; scientists'' minds are replete with them. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Luke Kanies
2007-Apr-16 17:14 UTC
Re: Watch a file during the day and just report changes, replace on a scheduleat night if chnged during the day: needs to be a type?
On Apr 9, 2007, at 8:46 AM, Max wrote:> Hi, > > In our dev/int environemnts, our user base wants to be able to change > managed files at will during the day but be notified via email of > changes that happen. > > At night they want the files replaced to their known good state if > there were changed. > > I tried to do this with a custom function that wraps two file types, > one that just watches checksum, the other that does a reset of content > with a schedule that limits the reset to overnight but ran into the > rule that Luke has designed in for "there shall be only one defintion > per file" :). > > Just wondering if there is a way to do this without creating a custom > type (not that creating a custom type is bad, just trying to keep > configs simple). > > Any ideas?At this point, by far the easiest way to do this is to use a cron job, running Puppet in --noop mode most of the time but without that mode when you want changes to happen. Are there others who would like this functionality? Is this something we should try to support explicitly? -- A Chemical Limerick: A mosquito cried out in pain: "A chemist has poisoned my brain!" The cause of his sorrow was para-dichloro diphenyltrichloroethane -- Dr. D. D. Perrin --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Max
2007-Apr-16 20:42 UTC
Re: Watch a file during the day and just report changes, replace on a scheduleat night if chnged during the day: needs to be a type?
Luke, Thanks, that does sound very straight forward, I really appreciate the help. Last week was very busy, was not able to get PuppetShow installed, hoping to get to that this week to hopefully help contribute some useful time/code to that. - Max On 4/16/07, Luke Kanies <luke@madstop.com> wrote:> On Apr 9, 2007, at 8:46 AM, Max wrote: > > > Hi, > > > > In our dev/int environemnts, our user base wants to be able to change > > managed files at will during the day but be notified via email of > > changes that happen. > > > > At night they want the files replaced to their known good state if > > there were changed. > > > > I tried to do this with a custom function that wraps two file types, > > one that just watches checksum, the other that does a reset of content > > with a schedule that limits the reset to overnight but ran into the > > rule that Luke has designed in for "there shall be only one defintion > > per file" :). > > > > Just wondering if there is a way to do this without creating a custom > > type (not that creating a custom type is bad, just trying to keep > > configs simple). > > > > Any ideas? > > At this point, by far the easiest way to do this is to use a cron > job, running Puppet in --noop mode most of the time but without that > mode when you want changes to happen. > > Are there others who would like this functionality? Is this > something we should try to support explicitly? > > -- > A Chemical Limerick: > A mosquito cried out in pain: > "A chemist has poisoned my brain!" > The cause of his sorrow > was para-dichloro > diphenyltrichloroethane > -- Dr. D. D. Perrin > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >
Luke Kanies
2007-Apr-16 20:43 UTC
Re: Watch a file during the day and just report changes, replace on a scheduleat night if chnged during the day: needs to be a type?
On Apr 16, 2007, at 3:42 PM, Max wrote:> Luke, > > Thanks, that does sound very straight forward, I really appreciate > the help.Glad to hear it might work for you.> Last week was very busy, was not able to get PuppetShow installed, > hoping to get to that this week to hopefully help contribute some > useful time/code to that.Great. -- "They called me mad, and I called them mad, and damn them, they outvoted me." -- Nathaniel Lee, on being consigned to a mental institution, circa 17th c. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Reasonably Related Threads
- Asterisk-11 loop behaviour
- [PATCH] maint.mk: remove error_message_period check
- [PATCH 0/14] hivex: update gnulib and make "syntax-check" tests pass
- Re: [PATCH] maint.mk: remove error_message_period check
- [PATCH libguestfs] maint: remove a subsumed syntax-check rule