Issue #6711 has been updated by Nick Fagerlund.

I noticed a different issue when I was investigating this: if you specify a 
separate "refresh" command and send a refresh event to the exec, it will run 
BOTH commands, as opposed to just running the main one when you don't send an 
event. Code: 

    # printnfail.pl
    #!/usr/bin/env perl
    my $i = 0;
    while (-e "/tmp/didrun$i") {
        $i++
    }
    open my $fh, '>', "/tmp/didrun$i";
    print $fh "Was run";
    exit 1;
    
    # printnfail.pl
    #!/usr/bin/env perl
    my $i = 0;
    while (-e "/tmp/refrun$i") {
        $i++
    }
    open my $fh, '>', "/tmp/refrun$i";
    print $fh "Was refreshed";
    exit 1;
    
    # exec-with-tries.pp
    exec {'print and fail':
      command => '/Users/nick/bin/printnfail.pl',
      tries => 6,
      logoutput => true,
      # refreshonly => true,
      refresh => '/Users/nick/bin/printnfail2.pl',
    }
    
    file {'/tmp/pegfile':
      notify => Exec['print and fail'],
      content => "Hey there.",
      ensure => file,
    }

If you delete the pegfile, you'll get your six new didruns and one new refrun. 

Is this the designed behavior? It seems wrong. 
----------------------------------------
Bug #6711: exec type refresh cmd should do tries and log
https://projects.puppetlabs.com/issues/6711

Author: Matt Robinson
Status: Accepted
Priority: Low
Assignee: Nick Fagerlund
Category: documentation
Target version: 
Affected Puppet version: development
Keywords: 
Branch: 


    # Run the command, or optionally run a separately-specified command.
    def refresh
      if self.check_all_attributes(true)
        if cmd = self[:refresh]
          provider.run(cmd)
        else
          self.property(:returns).sync
        end
      end
    end

If a refresh parameter is given to an exec type with tries set

    exec { '/some/cmd' :
      refresh => '/some/othercmd',
      tries => 10,
    }

tries will only apply to the /some/cmd, and not to the /some/othercmd when the 
exec resource is triggered by a refresh.  This is probably unintuitive and 
should be fixed or at least documented.  Also, by having different code paths 
for running the command regularly and through a refresh some logging gets lost 
when refreshing.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to