Issue #9388 has been updated by Cody Robertson.

Dennis Jacobfeuerborn wrote:
> Further investigation reveals that the yaml file in 
> /var/lib/puppet/yaml/node/ is not updated appropriately when mongrel is used. 
> With webrick I can see the environment variable change but with mongrel it 
> doesn't.
> 
> Could this be related to bug #1159 ?

I also see this with one gotcha. Every request using Webrick will refresh the 
YAML file in /var/lib/puppet/yaml/node for the agent. If you're using Mongrel 
the YAML file is not updated (same md5sum, etc) and you run into this 
environment issue.

It appears that one big change in the 2.6.x branch to 2.7.x is the transition 
from using GET to POST/PUT for agent requests to the master. If you use an old 
agent that uses GET the YAML file is updated normally regardless if you're 
using Mongrel or Webrick.

Just to clarify - this request using Mongrel *does not* work using 2.7.x agent:

<pre>
x.x.x.x - - [15/Nov/2011:22:23:47 +0300] "POST 
/production/catalog/test-agent.hawkhost.com HTTP/1.1" 400 183 "-" "-"
x.x.x.x - - [15/Nov/2011:22:23:47 +0300] "PUT 
/production/report/test-agent.hawkhost.com HTTP/1.1" 200 14 "-" "-"
x.x.x.x - - [15/Nov/2011:22:24:17 +0300] "POST 
/test9388/catalog/test-agent.hawkhost.com HTTP/1.1" 400 183 "-" "-"
x.x.x.x - - [15/Nov/2011:22:24:17 +0300] "PUT 
/test9388/report/test-agent.hawkhost.com HTTP/1.1" 200 14 "-" "-"
</pre>

While this does work using 2.6.x agent:

<pre>
x.x.x.x - - [15/Nov/2011:22:31:35 +0300] "GET 
/production/catalog/test-agent.lala.com?facts=eNqtVlt3qkoSfp9fweRpZnmC3AXWOmuNohJUiHfRl6wGmptAI1f1108DSbbZ%250AJ2c%252F7BkTtbuaVFVXfd9XeX5%252BJv6Zldatj6wQ2oW8LNMUFrJsIAfK8hTYRf4P%250AgoDXNMhAEaBEJhiKpp%252BbX55gWJmiZZYnOUFiGY7oUdhA4ecTEEOZKGBePAMP%250AJgXpg%252Frso7wgbRTj8wpEJcxlAi8JIs2QDfMcZTYqk0ImnsSn1n6GWQIjmVgE%250ASXltLVWQFSXAJpTCpLpXsLUG%252BdvnwVORlfDpq1tGJrSkgNG%252F1v8mTIiS5ltZ%250A7ogfrwnPsRRB%252FIdgSEFQX%252B7t3%252Fsgc2qQwRhXAnsOBFH46pf9Pb8496aUiZff%250A8gLGGYwgyHG1nnhy0GVeJsGlhIEjE5DjWJGz3NbctCkPCugEmUz0yzzrR4HV%250Ab5vXmN%252FaFU2KnY%252B0CGL4lkMbJQ6u9BNHc%252B%252Fu7SjALalglnf9JAWSprur%252BTiA%250ADaK%252FdIT5qaTc7109gUUM8vNbBfGKwqF5nnx4t8%252FEuOAZTuOOS0LT5IAm1FF7%250AAEoPF%252BozbYqUSKrrfwocJ8N5yYQwIBlGJGmJJmmWeYz5fbC8BqmbQdhUgaI%252B%250AInXA%252B2xMWyDxmWGxY4akSRjxJMWIeQEsqgnUlQZHT3PiGXa9ci9O8isCPNSS%250A%252F99qGaHualTz0540jb%252BjBGeub%252BatpWN4fouJt%252BYQZx6nMrEtIWGgimiIzMhs%250AQ%252BSGwbgODcW%252FcCDIwQMDHBSDAF%252Fv7%252B8k%252FN6dGshnCBUPXfgKU%252FFrmMHvhXnn%250Aho%252FKrGEG3YE7h1EjNNjggih%252FF5EOjR1EMBqFwQdG3n044Na4oN5d5H6WgzO8%250AycQQv0ascQcKfbOZSbvVavy5mgwHsXasxqx0WJlO3vMD1dpJ962vX0VT2Y2H%250AEXuxrZ6j5%252FoMsPqLz67dMjQBz61y3hEjdTSqGWWydcqtsNWm3E0TjB7nC1t%252B%250A36vXlFXlwD%252B8hNYyOqJqqnouFRUGK9XeNBTnyOodZleNZkBvkXPo5kzQcT63%250AQT7LTGorDife4hYbE513pbl4wxmN4mIYO566FeqkSNktdRTHy%252F7sOghf1ctg%250AUwxLu16Gq83KU6UdvVZNMamoDS2y7JXzL9ZxoLmVmnEzAaYSp6%252B0ORNMhEWS%250ADc3L7MgVB589n%252BiJLs2SQYpOwXjD0cLIPO3GG4lTrEVaDLe7I7VaX8%252BxVC1n%250AFqI0sy8c0osRVouNMZZ6xSxfnJnj6s8%252F2x7gwRBkKIlhI1wYKU5pN3PrQfls%250AmBW%252F5ibKXRAHEW7jGjovoMNj88TPc%252B0BChgfMiURLai%252BopT6PZQ2nP1EP5Z1%250Akv%252FgfY2yHxpKM4OW%252Bx1hAxwoc4HdDNenCP3RPfX%252B9fYOU5DZPh4YdlFmOO2A%250A%252FRhs7ej%252Fbi58jflGfSu0jZZ2sv2opTgXnNHDPYT3TDt6xyD8PHvCEZ%252B%252BmRNv%250AfzMpUlD4H4MQ4anVzy2sSg%252F7z%252B2Pg3bRbduPRm2a1ZdrNpL6UdafRsyvS%252FDZ%250Acvr%252F8q%252BBTCgYY6%252Bbb1P4ufNYe5y%252Fas%252FZZnW8U0bDhT24ZFs%252FvufHQg0jV%252FfC%250AW7na%252B4t1PZstrKx%252Fr3vG4jVdV3VpOP405Ch%252FFCizZGqtDwP%252Bulz3I4sdq%252Fz8%250AVdW9%252B8iIh%252FEJqXasmPrYB6sycKXQturB%252BHQU%252BdAQlPrIi0w4pJyTnXKj85gZ%250AL8xLPfK8lV%252BqOir3aEt5y%252Fs6eVmeIEppwzN72oI3kib%252F6Wq8Hu%252BUKhEqwb5z%250AoQfSRVCGrrqxQNroqDbcRes0dMbqQR%252F4uaO%252FxNDumZvTPtS0arJ0X2v6xK2P%250As8XYL%252B66ntniZZ%252F0NCyuu6OlBLvhVjm5q3MpnSzqPj2NDXUzi5Z1WZ4R0ETz%250AetSrw3QwPZ9nzNiwSgcpt2y%252BN1A%252BYeKkJzHLvu1KW1OhnAMa3Lf6Tl%252BLm%252Byy%250ASxI%252B6l0icWIMnJsqheXE7fKF5dWsTsb%252BVQSXQ8id9rzE%252BlXJlR5tv9A7kx9a%250AG27JTlfaC42y4ZwbHfhAsjepuxmZ%252B%252FCA%252BL05TwxaSYeK0jPz%252FllaXqijtVtW%250A9ZW6KrOinrCedVil%252ButlNFpA7b5YemM95MveLk6CIpLY01pz4yutGykaBicU%250AatupFyr%252BxObddAuGiytzcFaV966lPzD3SAn6vy6jpMk%253D%250A&facts_format=b64_zlib_yaml
 HTTP/1.1" 200 2244 "-" "-"
</pre>

Dennis Jacobfeuerborn wrote:
> A similar thing might happen when switching between webrick and mongrel on 
> the server side. In that case it would be interesting to know where the code 
> resides > that updates the yaml file and why it is not called when using 
> mongrel.

I suspect that the issue is in the logic / handling like you said - the old GET 
version works as expected while the new POST/PUT one does not. This would 
explain why if I downgrade my agent to 2.6.x it works as expected.
----------------------------------------
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