Hello... I am looking to replace my current config file management solution with puppet. I looked at both cfengine and puppet and neither seem to have a "diff" option. as in: configfile { "/etc/httpd/conf/httpd.conf": source => "/httpd/httpd.conf" } will install a httpd.conf file. What I would like is to be able to see a unified diff of the changes before installation. ala puppet --dry-run --show-diff-u sample situation: /etc/some.conf file is put into the puppet system. /etc/some.conf is tweeked for group:webservers by sysadminW. later (maybe months), /etc/some.conf is tweeked to fix a problem on group:mailservers by sysadminM. sysadminW then runs puppet and gets broken web servers. A dry-run showing file diffs would show what changes will be installed. Any ideas? -- Christopher McCrory "The guy that keeps the servers running" chrismcc@pricegrabber.com http://www.pricegrabber.com Let''s face it, there''s no Hollow Earth, no robots, and no ''mute rays.'' And even if there were, waxed paper is no defense. I tried it. Only tinfoil works.
Hello... I am looking to replace my current config file management solution with puppet. I looked at both cfengine and puppet and neither seem to have a "diff" option. as in: configfile { "/etc/httpd/conf/httpd.conf": source => "/httpd/httpd.conf" } will install a httpd.conf file. What I would like is to be able to see a unified diff of the changes before installation. ala puppet --dry-run --show-diff-u sample situation: /etc/some.conf file is put into the puppet system. /etc/some.conf is tweeked for group:webservers by sysadminW. later (maybe months), /etc/some.conf is tweeked to fix a problem on group:mailservers by sysadminM. sysadminW then runs puppet and gets broken web servers. A dry-run showing file diffs would show what changes will be installed. Any ideas? -- Christopher McCrory "The guy that keeps the servers running" chrismcc@pricegrabber.com http://www.pricegrabber.com Let''s face it, there''s no Hollow Earth, no robots, and no ''mute rays.'' And even if there were, waxed paper is no defense. I tried it. Only tinfoil works.
On Dec 18, 2006, at 1:33 PM, Christopher McCrory wrote:> Hello... > > I am looking to replace my current config file management > solution with > puppet. I looked at both cfengine and puppet and neither seem to > have a > "diff" option. as in: > > configfile { "/etc/httpd/conf/httpd.conf": > source => "/httpd/httpd.conf" > } > > will install a httpd.conf file. What I would like is to be able to > see a > unified diff of the changes before installation. > > ala puppet --dry-run --show-diff-u > > sample situation: > /etc/some.conf file is put into the puppet system. /etc/some.conf is > tweeked for group:webservers by sysadminW. later (maybe months), > /etc/some.conf is tweeked to fix a problem on group:mailservers by > sysadminM. sysadminW then runs puppet and gets broken web servers. A > dry-run showing file diffs would show what changes will be installed.This is part of something I''ve been meaning to do for a while: Create a more explicit interactive mode for the puppet client. This would allow different types to add hooks so you could do things like get file diffs. This isn''t a trivial amount of work, but it''s probably not more than a week or so, including coming up with a decent design (which is probably going to be the worst part). I definitely want to do this at some point, but it''s not in my specific plans yet. -- Sometimes I think we''re alone. Sometimes I think we''re not. In either case, the thought is staggering. --R. Buckminster Fuller --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Hello... ( sorry for the double post earlier ) On Mon, December 18, 2006 11:40 am, Luke Kanies wrote:> On Dec 18, 2006, at 1:33 PM, Christopher McCrory wrote: > >> Hello... >> >> I am looking to replace my current config file management >> solution with >> puppet. I looked at both cfengine and puppet and neither seem to >> have a >> "diff" option. as in: >> >> configfile { "/etc/httpd/conf/httpd.conf": >> source => "/httpd/httpd.conf" >> } >> >> will install a httpd.conf file. What I would like is to be able to >> see a >> unified diff of the changes before installation. >> >> ala puppet --dry-run --show-diff-u >> >> sample situation: >> /etc/some.conf file is put into the puppet system. /etc/some.conf is >> tweeked for group:webservers by sysadminW. later (maybe months), >> /etc/some.conf is tweeked to fix a problem on group:mailservers by >> sysadminM. sysadminW then runs puppet and gets broken web servers. A >> dry-run showing file diffs would show what changes will be installed. > > This is part of something I''ve been meaning to do for a while: > Create a more explicit interactive mode for the puppet client. This > would allow different types to add hooks so you could do things like > get file diffs. >What my existing tool does is basically replace ''cp'' with ''diff -u'' <setup> CP="/bin/cp" if $DEBUG then CP="diff -u" ... CP /SOURCE/PATH/some.conf /PATH/some.conf <repeat x 300> so my process is not interactive, but the implementation was easy. Would doing something similar within puppet be as easy? My ruby skills are non-existant. Can you point me to the parts of the puppet code where I can start hacking something similar?> This isn''t a trivial amount of work, but it''s probably not more than > a week or so, including coming up with a decent design (which is > probably going to be the worst part). I definitely want to do this > at some point, but it''s not in my specific plans yet. >Thanks for the response. If I cannot hack something together myself, are you open to sponsorship? <snip> -- Christopher McCrory "The guy that keeps the servers running" chrismcc@pricegrabber.com http://www.pricegrabber.com Let''s face it, there''s no Hollow Earth, no robots, and no ''mute rays.'' And even if there were, waxed paper is no defense. I tried it. Only tinfoil works.
On Dec 18, 2006, at 2:03 PM, Christopher McCrory wrote:> What my existing tool does is basically replace ''cp'' with ''diff -u'' > > <setup> > CP="/bin/cp" > if $DEBUG then CP="diff -u" > ... > CP /SOURCE/PATH/some.conf /PATH/some.conf > <repeat x 300> > > so my process is not interactive, but the implementation was easy.So are you just talking about printing a diff during the replacement, not viewing the diff interactively or anything? Hmm. That shouldn''t be too hard. I don''t think Ruby comes with a diff library by default, but I could try to load one and use it if it''s available. I figured (for some reason) you were talking about approving the diffs when they happen, but I see what you mean now.> Would doing something similar within puppet be as easy?Not quite, but it could be close.> My ruby skills are non-existant. Can you point me to the parts of the > puppet code where I can start hacking something similar?You''d need to make two changes: First you''d have to create a ''diff'' feature, so Puppet could tell whether the diff library were available. This would be a simple ruby snippet that returned true if the library loaded successfully, and false otherwise; see the other features in lib/puppet/features/ for examples. Then, in the two states that manage entire files (content and source), modify the the ''change_to_s'' method (which is responsible for producing the change long) to test for the diff feature; if it''s absent, behaviour should be like it is now, and if it''s present, it should print a diff of the files. For the content state, this should be very easy; for the ''source'' state, it''d be a little more difficult, since the new file contents aren''t actually available until after the change_to_s method is called, so you''d need to do a bit of refactoring internally so the content was available during this method for diffing.> Thanks for the response. If I cannot hack something together > myself, are > you open to sponsorship?Definitely -- I prefer custom development projects over just about any other kind of work. Do you mean community or corporate sponsorship? I''ve only done corporate development contracts, not any kind of community sponsorship (yet). -- Men will wrangle for religion; write for it; fight for it; die for it; anything but live for it. --Charles Caleb Colton --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On Mon, Dec 18, 2006 at 02:13:52PM -0600, Luke Kanies wrote:> be too hard. I don''t think Ruby comes with a diff library by > default, but I could try to load one and use it if it''s available.I''ve used Algorithm::Diff a little bit in the past. It wasn''t *fantastic*, but it''d do the job without a massive amount of pain and suffering.> I figured (for some reason) you were talking about approving the > diffs when they happen, but I see what you mean now.Making the diff just a standard part of --dry-run would probably be pretty cool. - Matt -- Judging by this particular thread, many people in this group spent their school years taking illogical, pointless orders from morons and having their will to live systematically crushed. And people say school doesn''t prepare kids for the real world. -- Rayner, in the Monastery
On Dec 18, 2006, at 3:13 PM, Matthew Palmer wrote:> > I''ve used Algorithm::Diff a little bit in the past. It wasn''t > *fantastic*, > but it''d do the job without a massive amount of pain and suffering.Ah, that comes with ruby? I didn''t realize.> Making the diff just a standard part of --dry-run would probably be > pretty > cool.Yeah, I agree. I''ve been wanting something like that, but haven''t known exactly what to do. I''ll keep thinking about it, and maybe I''ll have a chance to take a crack at it. Given a quick look at the bug list, though, it seems unlikely to happen any time soon. Ugh. If someone would open this as a feature request, that would be great. -- The optimist proclaims that we live in the best of all possible worlds, and the pessimist fears that this is true. -- James Branch Cabell 1879-1958 --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On Mon, Dec 18, 2006 at 03:24:44PM -0600, Luke Kanies wrote:> On Dec 18, 2006, at 3:13 PM, Matthew Palmer wrote: > > > > I''ve used Algorithm::Diff a little bit in the past. It wasn''t > > *fantastic*, > > but it''d do the job without a massive amount of pain and suffering. > > Ah, that comes with ruby? I didn''t realize.No, it''s a gem. But they''re not exactly hard to install, or hell, just ship it with Puppet (it''s only one file, from memory).> I''ll keep thinking about it, and maybe I''ll have a chance to take a > crack at it. Given a quick look at the bug list, though, it seems > unlikely to happen any time soon. Ugh.Bugs over shiny!, I think.> If someone would open this as a feature request, that would be great.Opened as #383. - Matt
On Dec 18, 2006, at 4:10 PM, Matthew Palmer wrote:> > No, it''s a gem. But they''re not exactly hard to install, or hell, > just ship > it with Puppet (it''s only one file, from memory).Ah. There are multiple options, then, so the first step will be which one to choose. Yay.> Bugs over shiny!, I think.Clearly. *sigh*> Opened as #383.Thanks. -- Barrow''s first law: Any Universe simple enough to be understood is too simple to produce a mind able to understand it. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com