On Thu, Nov 20, 2014 at 6:55 AM, jcbollinger <john.bollin...@stjude.org> wrote:
> > > On Wednesday, November 19, 2014 8:04:59 AM UTC-6, Mnemo Johnny wrote: >> >> Hi, colleagues! >> >> Can I repeatedly use a one file resource in Windows in follow case? >> > > > You can never declare the same resource more than once in one catalog. > Under some circumstances, however, the same DSL code can be used to declare > multiple *different* resources, or you can use conditional constructs to > allow you to evaluate a piece of DSL code multiple times to ultimately > declare only one resource. > > >> >> 1. Check file resource with md5 from source disk. >> 2. If it changed -> stop application -> replace .exe on destination >> -> start application. >> 3. If not -> noop. >> >> 'Define' with 'realize' don't help me - duplicate resource. For Windows 7 >> I had successfully used validate_cmd, but in Windows XP stdlib with >> validate_cmd is not supported. >> > > >> >> Resource in Windows 7: >> >> file { $app1exe: >> source => "${app1source}\\${appname}.exe", >> ensure => present, >> require => Exec['map_source'], >> checksum => md5, >> source_permissions => ignore, >> validate_cmd => "${cmd} /c start taskkill /f /im ${appname}.exe", >> notify => Acl[$app1path], >> } >> >> > > PuppetLabs's 'stdlib' module has a validate_cmd() function, but that's > nothing to do with the above. The 'validate_cmd' there is a parameter of > the File resource type, first introduced in Puppet 3.5. Anyway, *neither* > validate_cmd enables you to circumvent Puppet's constraint against > multiple-declaration of resources. To use that File declaration for a > Windows XP -- or any other -- machine, that machine must be running a > recent enough version of Puppet (at least v 3.5). > > > >> How to redeclare file resource to use it in Windows XP? >> >> > > Again, if you mean multiple declaration of the same resource in one > catalog, then you can't. Not in WinXP, Win7, Win8, Linux, OS X, or any > other OS supported by Puppet. > > If you mean declaring the same resource in each of several different > catalogs for the same machine, then you don't need to do anything special > at the Puppet level. That's not multiple or re-declaration in the sense > those terms are used in Puppet context, and it just works as far as Puppet > is concerned -- Puppet will happily produce a catalog. You may be > constrained by other factors, however, such as Windows refusing to modify > or replace the EXE of a running process. Such factors could cause catalog > *application* to fail, but a solution must involve what you declare, not > so much how you declare it. > > I find your use of the validate_cmd parameter to be a bit of a hack, but > also a bit ingenious. I don't know any other way to inject actions between > a File resource determining the target local file is out sync, and that > File updating the local file. I would previously have said there wasn't > any way at all to do that. If that's the behavior you're after, then your > best best is to ensure that your clients are all running at least Puppet > 3.5. > > Do note that *no* version of Puppet is officially supported on Windows > XP. That's perhaps a bit of a technicality, however, since Puppet 2.7.6 > and above is supported on Windows Server 2003 R2, and unsupported packages > are available for Windows Server 2003 (original), > We actually support 2003 non-R2, though our docs may not be correct. With that said, Microsoft is dropping support for all versions of 2003 on July 14th, 2015[1], and we will be also. > which is more or less just the server version of XP. > > > John > > -- > 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/9eb4e61a-3b84-4777-a432-b0e10f7c8c04%40googlegroups.com > <https://groups.google.com/d/msgid/puppet-users/9eb4e61a-3b84-4777-a432-b0e10f7c8c04%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > Josh [1] http://support2.microsoft.com/lifecycle/search/default.aspx?alpha=Windows+Server+2003 -- Josh Cooper Developer, Puppet Labs *Join us at **PuppetConf 2015, October 5-9 in Portland, OR - * http://2015.puppetconf.com. *Register early to save 40%!* -- 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/CA%2Bu97ukaO1_1JwOz9hUJ7xGkn9taRX9G8YO-3F1c4KRm%2BTWQmQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.