Jira (PUP-10955) Environment caches string and symbol environment names differently

72 views
Skip to first unread message

Josh Cooper (Jira)

unread,
Mar 8, 2021, 3:42:03 PM3/8/21
to puppe...@googlegroups.com
Josh Cooper created an issue
 
Puppet / Bug PUP-10955
Environment caches string and symbol environment names differently
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2021/03/08 12:41 PM
Priority: Normal Normal
Reporter: Josh Cooper

The Puppet::Environments::Cached#get method says it accepts Strings or Symbols, but it doesn't normalize the name when getting/setting the environment in the cache. So you can end up caching environments for "production" and :production.

Agent side we lookup the environment based on the Puppet[:environment] setting. Server side we lookup the environment from a query parameter. But there are other entry points like Bolt and non-indirected REST APIs, so it would be good to fix this.

require 'puppet'
Puppet.initialize_settings
Puppet::Util::Log.newdestination(:console)
Puppet::ApplicationSupport.push_application_context(Puppet::Util::RunMode[:user])
envs = Puppet.lookup(:environments)
envs.get!('production')
envs.get!(:production)
pp envs.instance_variable_get(:@cache).keys

$ bx ruby cache.rb
["production", :production]

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Ciprian Badescu (Jira)

unread,
Jun 15, 2021, 11:02:02 AM6/15/21
to puppe...@googlegroups.com
Ciprian Badescu updated an issue
Change By: Ciprian Badescu
Team: Night's Watch
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Ciprian Badescu (Jira)

unread,
Jun 15, 2021, 11:02:02 AM6/15/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jun 16, 2021, 5:40:01 AM6/16/21
to puppe...@googlegroups.com

Luchian Nemes (Jira)

unread,
Jun 22, 2021, 12:30:01 PM6/22/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 29, 2021, 4:10:02 PM6/29/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 7.9.0
Fix Version/s: PUP 6.24.0

Josh Cooper (Jira)

unread,
Jun 29, 2021, 4:10:03 PM6/29/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jun 30, 2021, 5:07:02 AM6/30/21
to puppe...@googlegroups.com
Ciprian Badescu updated an issue
 
Change By: Ciprian Badescu
Sprint: NW-2021-06-30 , NW-2021-07-14

Josh Cooper (Jira)

unread,
Jul 2, 2021, 12:25:02 PM7/2/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10955
 
Re: Environment caches string and symbol environment names differently

This was reverted in 6.x in 685cbcc74d and in main in 69e708c80f

Ciprian Badescu (Jira)

unread,
Jul 5, 2021, 3:21:03 AM7/5/21
to puppe...@googlegroups.com
Ciprian Badescu updated an issue
Change By: Ciprian Badescu
Fix Version/s: PUP 7.9.0
Fix Version/s: PUP 6.24.0

Victor Bobosila (Jira)

unread,
Jul 5, 2021, 8:32:02 AM7/5/21
to puppe...@googlegroups.com

Victor Bobosila (Jira)

unread,
Jul 6, 2021, 4:35:02 AM7/6/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jul 14, 2021, 4:49:04 AM7/14/21
to puppe...@googlegroups.com
Ciprian Badescu updated an issue
Change By: Ciprian Badescu
Sprint: NW-2021-06-30, NW-2021-07-14 , NW-2021-07-28

Ciprian Badescu (Jira)

unread,
Jul 27, 2021, 1:07:03 PM7/27/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jul 27, 2021, 2:53:04 PM7/27/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10955
 
Re: Environment caches string and symbol environment names differently

This was unreverted in 6.x in c0071fc4e0 but had to be reverted again in fa308bca3d due to issues with PUP-11158.

Ciprian Badescu (Jira)

unread,
Jul 28, 2021, 5:23:03 AM7/28/21
to puppe...@googlegroups.com
Ciprian Badescu updated an issue
Change By: Ciprian Badescu
Sprint: NW-2021-06-30, NW-2021-07-14, NW-2021-07-28 , NW-2021-08-11

Josh Cooper (Jira)

unread,
Jul 30, 2021, 2:22:03 PM7/30/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jul 30, 2021, 2:23:02 PM7/30/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
Fix Version/s: PUP 7.10.0
Fix Version/s: PUP 6.25.0

Josh Cooper (Jira)

unread,
Aug 2, 2021, 11:45:03 AM8/2/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Aug 2, 2021, 11:46:03 AM8/2/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes Summary: Previously puppet Fixes a bug that could cache result in puppet caching duplicate copies of an environment depending on how they were loaded .

Josh Cooper (Jira)

unread,
Aug 2, 2021, 11:46:04 AM8/2/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes: Bug Fix
Release Notes Summary: Previously puppet could cache duplicate copies of an environment depending on how they were loaded.

Claire Cadman (Jira)

unread,
Aug 11, 2021, 9:11:01 AM8/11/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages