| Sorry for the back and forth on this. The root cause occurs because environment is set in the agent section, however, only the puppet agent application reads settings from there. The puppet facts application uses the user section, and since environment isn't specified there, it defaults to production. You will need to: 1. Set environment in both agent and user sections OR 2. Set environment in the main section, provided the host is an agent-only, and is not a puppetserver node. Note specifying the environment on the command line should work as expected, provided there is an environment directory with that name on the puppetserver:
$ bx puppet facts upload --environment qa --http_debug 2>&1 | grep HTTP |
<- "PUT /puppet/v3/facts/localhost?environment=qa& HTTP/1.1\r\nAccept: application/json, application/x-msgpack, text/pson\r\nX-Puppet-Version: 5.5.2\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nContent-Type: application/json\r\nUser-Agent: Puppet/5.5.2 Ruby/2.6.2-p47 (x86_64-darwin18)\r\nConnection: close\r\nHost: puppet.delivery.puppetlabs.net:8140\r\nContent-Length: 3948\r\n\r\n" |
-> "HTTP/1.1 200 OK\r\n"
|
The reason my suggested fix earlier is not necessary, is because the indirector request defaults to the current environment. I'm going to close this ticket as incomplete, but I'll move the current PR forward so that the environment is passed explicitly. |