Issue #7974 has been updated by Daniel Pittman.

> Feature #7974: Stages should reload facts between runs
>
> During a stage run, I might have some data in the form of a fact that will
> not be populated until future runs of puppet. Consider the below example. In
> this case, the logic in class bar will not be evaluated during the initial
> run of puppet until /etc/ROLE has been defined and populated on the machine.

You are actually asking for a similar feature, "stages should be
entirely separate catalog runs in Puppet". :)

The catalog is static; stages are just a shorthand for ordering that
you could otherwise express entirely by hand, by putting the right
dependencies in place between the contained items in the relevant
classes.  (Which, indeed, is more or less what people did before
stages came about. :)

Reloading facts between runs would actually be this:

1. Puppet agent uploads facts, get the first stage catalog
2. Puppet agent applies the first stage catalog
3. Puppet agent uploads facts, gets the second stage catalog
4. ...repeat until you are done.

Part of this is because we interpolate the facts on the master, during
compilation, before the catalog ever gets to the agent.

I don't believe we want to support this multi-catalog model, and I
don't believe there is a mechanism for otherwise getting this right
without fundamental architectural shifts – that, IMO, will render this
request obsolete by doing the same thing a different way. :)
----------------------------------------
Feature #7974: Stages should reload facts between runs
https://projects.puppetlabs.com/issues/7974

Author: Jamison Fryman
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


During a stage run, I might have some data in the form of a fact that will not 
be populated until future runs of puppet. Consider the below example. In this 
case, the logic in `class bar` will not be evaluated during the initial run of 
puppet until `/etc/ROLE` has been defined and populated on the machine.

Custom Fact:
<pre><code class='ruby'> 
Facter.add("role") do
  setcode do
    %x{/etc/ROLE -i}.chomp
   end
end
</code></pre>

Puppet Code:
<pre><code class='puppet'>
class stage {
  stage { ['pre', 'post']: }
  Stage['pre'] -> Stage['main'] -> Stage['post']
}
class foo {
  file { '/etc/ROLE':
    ensure  => file,
    content => 'FS',
  }
}
class bar {
  if $role == 'FS' { (do something ) }
}
</code></pre>

Node Definition
<pre><code>
node 'test' {
  class { 'foo':
    stage => 'pre',
  }

  include bar
}
</code></pre>


-- 
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