Is it possible to have a file copied from the fileserver but only when it doesn''t exist? I want to prevent changes on the client from being wiped out if it is different. We have a couple of config files that the DBAs are resistant to managing through puppet. They currently manually deploy changes and I don''t want those changes wiped out if the server isn''t updated. I want the files to be copied initially so the machine is setup even if it has a old version. - Ian
On May 7, 2007, at 1:32 PM, Ian Burrell wrote:> Is it possible to have a file copied from the fileserver but only when > it doesn''t exist? I want to prevent changes on the client from being > wiped out if it is different. We have a couple of config files that > the DBAs are resistant to managing through puppet. They currently > manually deploy changes and I don''t want those changes wiped out if > the server isn''t updated. I want the files to be copied initially so > the machine is setup even if it has a old version.There''s currently no way to do that, although it could be added relatively easily. You''d just need to create a new parameter to use to enable this ability, then have ''source'' do nothing if this parameter is set. -- Yesterday upon the stair I met a man who wasn''t there. He wasn''t there again today -- I think he''s from the CIA. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Luke Kanies wrote:> On May 7, 2007, at 1:32 PM, Ian Burrell wrote: > > >> Is it possible to have a file copied from the fileserver but only when >> it doesn''t exist? I want to prevent changes on the client from being >> wiped out if it is different. We have a couple of config files that >> the DBAs are resistant to managing through puppet. They currently >> manually deploy changes and I don''t want those changes wiped out if >> the server isn''t updated. I want the files to be copied initially so >> the machine is setup even if it has a old version. >> > > There''s currently no way to do that, although it could be added > relatively easily. You''d just need to create a new parameter to use > to enable this ability, then have ''source'' do nothing if this > parameter is set. > >I''ve been looking at ways to do this as well since we often distribute base configuration files that are changed independently afterward. Seems like the best way so far is to copy the source file to the local host with some agreed upon extension like ''.default'', then have something else copy the ''.default'' version to the regular name unless it is already in place. Without direct support the file resource, seems like a function based on exec is the only other way to do this, something like: define installdefault($extension = "default") { exec { "cp -p $name.$extension $name": onlyif => "test -f $name.$extension && ! test f $name" } } I haven''t tested this yet except for syntax, but will try it shortly... If something like that became part of ''file'', though, that would be nice :). Mark -- Mark D. Nagel, CCIE #3177 <mnagel@willingminds.com> Principal Consultant, Willing Minds LLC (http://www.willingminds.com) cell: 949-279-5817, desk: 714-630-4772, fax: 949-623-9854
On May 7, 2007, at 2:25 PM, Mark D. Nagel wrote:>> > I''ve been looking at ways to do this as well since we often distribute > base configuration files that are changed independently afterward. > Seems like the best way so far is to copy the source file to the local > host with some agreed upon extension like ''.default'', then have > something else copy the ''.default'' version to the regular name > unless it > is already in place. Without direct support the file resource, seems > like a function based on exec is the only other way to do this, > something like: > > define installdefault($extension = "default") { > exec { "cp -p $name.$extension $name": > onlyif => "test -f $name.$extension && ! test f > $name" } > } > > I haven''t tested this yet except for syntax, but will try it > shortly... > If something like that became part of ''file'', though, that would be > nice :).This really isn''t very much work. Is anyone interested in trying to work on it, so I don''t have to? This is a relatively commonly requested feature (although I don''t think there''s a feature request filed for it), but none of my customers are apparently interested in it. I''m not trying to be mercenary, but this is a simple enough task that the community should be able to take care of it, and right now I''m trying to focus on the areas where the community is less able or likely to contribute. -- Always be wary of any helpful item that weighs less than its operating manual. -- Terry Pratchett --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com