Jira (PUP-11689) Enable strict mode by default by setting strict_variables default to true

10 views
Skip to first unread message

Aria Li (Jira)

unread,
Jan 24, 2023, 7:49:04 PM1/24/23
to puppe...@googlegroups.com
Aria Li updated an issue
 
Puppet / Improvement PUP-11689
Enable strict mode by default by setting strict_variables default to true
Change By: Aria Li
Summary: Enable strict mode by default by setting strict_variables default to true
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Aria Li (Jira)

unread,
Jan 24, 2023, 7:51:06 PM1/24/23
to puppe...@googlegroups.com
Aria Li updated an issue
Puppet supports various strict language related settings. These were added in 2016 (puppet 4.x) and it's time to enable strict behavior by default.

[strict|https://github.com/puppetlabs/puppet/blob/381a3e2b2e6858570fcc6e755bfae9eeff1226f1/lib/puppet/defaults.rb#L191]

[strict_variables|https://github.com/puppetlabs/puppet/blob/381a3e2b2e6858570fcc6e755bfae9eeff1226f1/lib/puppet/defaults.rb#L2212]

Currently, strict_variables defaults to false and must default to true in order to enable strict mode by default.

A good thing to verify - take a module like stdlib, test against puppet8 gem, change the setting for strict variables, and make sure the spec tests still pass. Note you can use the PUPPET_GEM_VERSION to pin to a local checkout of puppet rather than building a gem.

Aria Li (Jira)

unread,
Jan 24, 2023, 7:53:02 PM1/24/23
to puppe...@googlegroups.com
Aria Li commented on Improvement PUP-11689
 
Re: Enable strict mode by default by setting strict_variables default to true

Changing the strict_variables default to true causes 14 failed tests and changing to default for strict from warning to error causes ~60 more failed tests. Fixing 70 failed tests seems like a lot for just 1 ticket. Due to this, I think it may be best to split up the work and just change the default for strict_variables for this ticket and make another ticket/s for changing the default for strict

Here is the ticket to change strict default: https://tickets.puppetlabs.com/browse/PUP-11725 I wasn't sure if it would be best to break it down more but at least there's a ticket as a placeholder for the work

Aria Li (Jira)

unread,
Feb 8, 2023, 2:40:02 PM2/8/23
to puppe...@googlegroups.com
Aria Li updated an issue
Change By: Aria Li
Release Notes Summary: The strict_variables setting was introduced in Puppet 4.x. For Puppet 8, strict mode will be on by default which means strict_variables will be on & default to true and strict will default to error. Previously, strict_variables defaulted to false. With strict_variables on, an evaluation error will be raised when referencing unknown variables but not when referencing variables explicitly set to undef. This change could potentially be a breaking change.

Aria Li (Jira)

unread,
Feb 8, 2023, 2:42:01 PM2/8/23
to puppe...@googlegroups.com
Aria Li updated an issue
Change By: Aria Li
Release Notes Summary: The strict_variables setting was introduced in Puppet 4.x. For Puppet 8, strict mode will be on by default which means strict_variables will be on & default set to true by default and strict will default to error. Previously, strict_variables defaulted to false. With strict_variables on, an evaluation error will be raised when referencing unknown variables but not when referencing variables explicitly set to undef. This change could potentially be a breaking change.

Aria Li (Jira)

unread,
Apr 18, 2023, 6:28:01 PM4/18/23
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages