Am Donnerstag, 14. März 2013 08:56:31 UTC+1 schrieb dirk.he...@altum.de:
>
> Hello,
>
> I've created a little class which should unpack a 7z archive on Windows. 
> The class has a parameter for passing in the archive version, so that I can 
> trigger an update when a new version of the archive is available. A 
> simplyfied version looks like this (requires 7z):
>
> class my_archive ($version = undef) {
>     file { 'version':
>         path => 'C:/the_version',
>         content => $version,
>         ensure => present,
>         mode => 0666,
>     }
>
>     # Extracting archive creates C:/some/dir
>     exec { 'unpack_archive':
>         command => "cmd /c rmdir /S /Q C:\some/dir & 7z x -oC:/some 
> C:/path/to/archive-${version}.7z",
>         creates => 'C:/some/dir/a_file',
>         require => File['version'],
>         path => $::path,
>         subscribe => File['version'],
>     }
> }
>
> I trigger this from site.pp like so:
>
>   class { 'my_archive':
>     version => '1.2.3'
>   }
>
> The initial unpacking of (an older version of) the archive works fine, but 
> when I change the version, I see that this change is recognized by the 
> agent and a refresh is triggered, but the command isn't executed:
>
> Info: /Stage[main]/My_archive/File[version]: Filebucketed C:/the_version 
> to puppet with sum 185910a1e94c599dc6541266286675bc
> Notice: /Stage[main]/My_archive/File[version]/content: content changed 
> '{md5}185910a1e94c599dc6541266286675bc' to 
> '{md5}d0cdd9a6594750ea1063643fcda90d3b'
> Debug: /Stage[main]/My_archive/File[version]: The container 
> Class[My_archive] will propagate my refresh event
> Info: /Stage[main]/My_archive/File[version]: Scheduling refresh of 
> Exec[unpack_archive]
> Debug: /Schedule[weekly]: Skipping device resources because running on a 
> host
> Debug: Prefetching windows resources for package
> Notice: /Stage[main]/My_archive/Exec[unpack_archive]: Triggered 'refresh' 
> from 1 events
> Debug: /Stage[main]/My_archive/Exec[unpack_archive]: The container 
> Class[My_archive] will propagate my refresh event
> Debug: Class[My_archive]: The container Stage[main] will propagate my 
> refresh event
> Debug: /Schedule[puppet]: Skipping device resources because running on a 
> host
> Debug: Finishing transaction 144533424
> Debug: Storing state
> Debug: Stored state in 0.06 seconds
> Notice: Finished catalog run in 0.75 seconds
>
> I tried to omit "creates => ...", but this only makes the agent run the 
> resource every time. I also tried adding "refreshonly => true", but this 
> doesn't help. I even tried adding "refresh => ..." with the exact same 
> command without any change in behaviour.
>
> Any hints what could be wrong?
>
> Puppet Agent version on Windows is 3.1.0.
>

Got it: Omitting "creates" AND adding "refreshonly => true" makes the class 
work as desired.

Bye...

    Dirk

-- 
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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to