Jira (PUP-10305) Set :current_environment to result of Cached#get(!)

19 views
Skip to first unread message

Molly Waggett (JIRA)

unread,
Feb 20, 2020, 2:33:05 PM2/20/20
to puppe...@googlegroups.com
Molly Waggett created an issue
 
Puppet / New Feature PUP-10305
Set :current_environment to result of Cached#get(!)
Issue Type: New Feature New Feature
Assignee: Unassigned
Created: 2020/02/20 11:32 AM
Priority: Normal Normal
Reporter: Molly Waggett

In order to continue using cached environments at a specific, the :current_environment must be set with the result of Cached#get, which should include the environment version.

Currently, Cached#get returns the environment name as a string. Now we either need to include the version in the the string as well, e.g. "production@ab123cd", or return an Environment object that knows the version.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Molly Waggett (JIRA)

unread,
Feb 20, 2020, 2:35:04 PM2/20/20
to puppe...@googlegroups.com
Molly Waggett updated an issue
Change By: Molly Waggett
In order to continue using cached environments at a specific version , the {{:current_environment}} must be set with the result of {{Cached#get\(!\)}}, which should include the environment version.

Currently, {{Cached#get}} takes the environment name as a string or symbol. Now we need to either take an Environment object that knows the version or include the version in the string as well, e.g. "production@ab123cd".

Molly Waggett (JIRA)

unread,
Feb 20, 2020, 2:35:05 PM2/20/20
to puppe...@googlegroups.com
Molly Waggett updated an issue
In order to continue using cached environments at a specific, the {{:current_environment}} must be set with the result of {{Cached#get \ (! \ )}}, which should include the environment version.

Currently, {{Cached#get}}
returns takes the environment name as a string or symbol . Now we either need to either take an Environment object that knows the version or include the version in the the string as well, e.g. "production@ab123cd" , or return an Environment object that knows the version .

Molly Waggett (JIRA)

unread,
Feb 20, 2020, 2:36:03 PM2/20/20
to puppe...@googlegroups.com
Molly Waggett updated an issue
In order to continue using cached environments at a specific version, the {{:current_environment}} must be set with the result of {{Cached#get\(!\)}}, which should include the environment version is an Environment object .

Currently, {{Cached#get}} takes the environment name as a string or symbol. Now we need to either take an Environment object that knows the version or include the version in the string as well, e.g. "production@ab123cd".

Molly Waggett (JIRA)

unread,
Feb 20, 2020, 2:37:07 PM2/20/20
to puppe...@googlegroups.com
Molly Waggett updated an issue
In order to continue using cached environments at a specific version, the {{:current_environment}} must be set with the result of {{Cached#get\(!\)}}, which is an Environment object.

Currently, {{Cached#get}} takes the environment name as a string or symbol. Now we need to
either take an Environment object that knows the version - or include the version in the string as well, e.g. "production@ab123cd" - .

Molly Waggett (JIRA)

unread,
Feb 20, 2020, 2:38:07 PM2/20/20
to puppe...@googlegroups.com
Molly Waggett updated an issue
In order to continue using cached environments at a specific version, the {{:current_environment}} must be set with the result of {{Cached#get\(!\)}}, which is an Environment object.

Currently, {{Cached#get}} takes the environment name as a string or symbol. Now we need to take an Environment object that knows the version- or include the version in the string as well, e.g. "production@ab123cd"-.

Molly Waggett (JIRA)

unread,
Feb 20, 2020, 2:44:08 PM2/20/20
to puppe...@googlegroups.com
Molly Waggett updated an issue
In order to continue using cached environments at a specific version, the {{:current_environment}} must be set with the result of {{Cached#get\(!\)}}, which is an Environment object.

Currently, {{Cached#get}} takes the environment name as a string or symbol. Now we need to take _either_ an Environment object that knows the version - or include the version in the a string as well /symbol. If we're given an Environment object , e just get its name and do whatever we were doing with the string/symbol . g. "production@ab123cd"-.

Molly Waggett (JIRA)

unread,
Feb 20, 2020, 5:47:05 PM2/20/20
to puppe...@googlegroups.com
Molly Waggett updated an issue
In order to continue using cached environments at a specific version, the {{:current_environment}} must be set with the result of {{Cached#get\(!\)}}, which is an Environment object.


Currently, {{Cached#get}} takes the environment name
This has to be set as early as possible for a string or symbol. Now we need to take _either_ an Environment object or a string/symbol. If we're given an Environment object, just get its name and do whatever we were doing with the string/symbol request .

Maggie Dreyer (JIRA)

unread,
Feb 20, 2020, 6:32:08 PM2/20/20
to puppe...@googlegroups.com

Maggie Dreyer (JIRA)

unread,
Feb 20, 2020, 6:43:04 PM2/20/20
to puppe...@googlegroups.com
Maggie Dreyer commented on New Feature PUP-10305
 
Re: Set :current_environment to result of Cached#get(!)

When we do this in the configurer currently, we check the environment's name against what's in the context: https://github.com/puppetlabs/puppet/blob/master/lib/puppet/configurer.rb#L320, and if they match, we use the saved env. That seems potentially wrong in a versioned world; we probably need to check both name and version.

Maggie Dreyer (JIRA)

unread,
Feb 21, 2020, 12:57:04 PM2/21/20
to puppe...@googlegroups.com

When processing a request, we fetch the environment from the cache here https://github.com/puppetlabs/puppet/blob/master/lib/puppet/network/http/api/indirected_routes.rb#L96 and configure it with any settings, then override :current_environment with that value here https://github.com/puppetlabs/puppet/blob/master/lib/puppet/network/http/api/indirected_routes.rb#L49-L55. That seems fairly early, and might be sufficient, so long as the cache returns an env of the right version.

Maggie Dreyer (JIRA)

unread,
Feb 21, 2020, 1:14:06 PM2/21/20
to puppe...@googlegroups.com
Maggie Dreyer updated an issue
 
Change By: Maggie Dreyer
Comment: When we do this in the configurer currently, we check the environment's name against what's in the context: https://github.com/puppetlabs/puppet/blob/master/lib/puppet/configurer.rb#L320, and if they match, we use the saved env. That seems potentially wrong in a versioned world; we probably need to check both name and version, or else make sure that {{:current_environment}} is guaranteed to be set by the time we get here, in the scenarios where we are using versioned envs.
Reply all
Reply to author
Forward
0 new messages