Issue #9388 has been updated by Dennis Jacobfeuerborn.

It seems this has something to do with stale cached information.

I experimented a bit and switched between webrick and mongrel and I noticed 
that when mongrel is running then puppet will always use the environment that 
was last used when webrick was running.

Example:

Start puppetmaster using webrick and run a client with the testing environment. 
Now restart puppetmaster using mongrel. From now on the client will always 
receive the catalog from the testing environment even if you choose another one 
from the command line.

Now restart puppetmaster with webrick again and run the client with the 
development environment. You will correctly get the development catalog. Now 
restart puppetmaster again with mongrel. From now on you will always get the 
catalog from the development environment no matter what you specify on the 
command line.

So it seems mongrel doesn't actually use the environment provided as an 
argument but always rely on some cached value that only seem to get updated 
when webrick is used.

I hope this helps pinning this down as this bug prevents us from updating 
puppet to the current 2.7.x versions.
----------------------------------------
Bug #9388: Agent not respecting environment
https://projects.puppetlabs.com/issues/9388

Author: Cody Robertson
Status: Needs More Information
Priority: Urgent
Assignee: Nigel Kersten
Category: 
Target version: 
Affected Puppet version: 2.7.1
Keywords: environment
Branch: 


I recently upgraded my agents from 2.6.9 to 2.7.1 and it seems to have broke my 
environments (not using them). I've posted on the mailing list and have 
confirmed to some degree that it was working previously 
https://groups.google.com/forum/#!topic/puppet-users/spAGSaUJhfc

Here is the relavent files which seem to work on 2.6.9 (and previous) agents:

puppet.conf
<pre>
[main]
    confdir = /etc/puppet
    manifest = $confdir/manifests/site.pp
    vardir = /var/lib/puppet
    logdir = /var/log/puppet
    rundir = /var/run/puppet
    ssldir = $vardir/ssl
    modulepath = $confdir/modules

[development]
    modulepath = $confdir/environments/development/modules
    manifest = $confdir/environments/development/manifests/site.pp

[master]
    templatedir = /var/lib/puppet/templates
    storeconfigs = true
    dbadapter = mysql
    dbuser = puppet_configs
    dbpassword = pass
    dbserver = localhost
    dbsocket = /var/lib/mysql/mysql.sock
    dbname = puppet
    reports = log, foreman
    pluginsync = true
    #external_nodes = 
/usr/share/foreman/extras/puppet/foreman/files/external_node.rb
    #node_terminus = exec
    #reporturl = http://10.8.1.222:3000/reports/upload
    facts_terminus = yaml
</pre>

environments/development/manifests/site.pp
<pre>
# site.pp

import "modules"
import "nodes"
import "../definitions/*.pp"

filebucket { main: server => puppet }

# Defaults
File { backup => main }
Exec { path => "/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin" }
stage { "pre": before => Stage[main] }

Package {
    provider => $operatingsystem ? {
        centos => yum,
        RedHat => yum,
    }
}
</pre>

When I run the agent with __puppet agent --test --environment development__ it 
still is hitting my main __site.pp__ and not the development one and as a 
result is trying to send information from the main master environment.

One strange behavior I noticed is as it sends modules from the master 
environment it's denying REST calls from the node that usually work (if I don't 
specify an environment):

<pre>
# Only exists in the primary master environment site.pp file
err: /Stage[pre]/Yum-repos/File[epel-gpg]: Failed to generate additional 
resources using 'eval_generate: Error 400 on SERVER: Not authorized to call 
search on /file_metadata/yum-repos/keys/RPM-GPG-KEY-EPEL with 
{:checksum_type=>"md5", :recurse=>true, :links=>"manage"}
</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