Jira (PUP-9336) Ensure provider suitability is always lazily evaluated

2 views
Skip to first unread message

Jacob Helwig (JIRA)

unread,
Nov 30, 2018, 1:19:03 PM11/30/18
to puppe...@googlegroups.com
Jacob Helwig created an issue
 
Puppet / Bug PUP-9336
Ensure provider suitability is always lazily evaluated
Issue Type: Bug Bug
Affects Versions: PUP 5.5.z
Assignee: Unassigned
Created: 2018/11/30 10:18 AM
Priority: Normal Normal
Reporter: Jacob Helwig

Puppet::Provider::Service::Upstart had a confine added that is run when the provider is loaded.

  confine :true => begin
    initctl('version', '--quiet')
    true
  rescue
    false
  end

This causes issues with running tests under things like JRuby, and also means that it is not possible for the provider to become suitable during the course of a transaction.  Instead of using a begin/rescue/end block which will be evaluated during the provider definition, this should be something that will be evaluated only when checking if the provider is suitable.
 

This probably means creating a new type of Puppet::Confine that is capable of taking a block to be lazily evaluated as the only existing one that does any sort of "call this code later" goes through the feature machinery.

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

Josh Cooper (JIRA)

unread,
Dec 3, 2018, 1:18:02 PM12/3/18
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Dec 3, 2018, 1:19:02 PM12/3/18
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Coremunity Platform OS

Josh Cooper (JIRA)

unread,
Dec 3, 2018, 1:19:03 PM12/3/18
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Dec 3, 2018, 1:20:02 PM12/3/18
to puppe...@googlegroups.com

Enis Inan (JIRA)

unread,
Dec 6, 2018, 6:52:03 PM12/6/18
to puppe...@googlegroups.com
Enis Inan commented on Bug PUP-9336
 
Re: Ensure provider suitability is always lazily evaluated

Couldn't we modify the boolean confines

{true}

and

{false}

to optionally take in a block and case the value on that? This would look something like:

confine :true, <value>

OR

confine :true, <block>

Jacob Helwig (JIRA)

unread,
Dec 10, 2018, 2:42:02 PM12/10/18
to puppe...@googlegroups.com
Jacob Helwig commented on Bug PUP-9336

Enis Inan, certainly. The main point was that there wasn't really a current facility that supported what needed to be done.

Enis Inan (JIRA)

unread,
Dec 10, 2018, 2:45:03 PM12/10/18
to puppe...@googlegroups.com
Enis Inan commented on Bug PUP-9336

Jacob Helwig Yeah that makes sense. Cool, I'll add that into the description.

Enis Inan (JIRA)

unread,
Dec 10, 2018, 2:45:04 PM12/10/18
to puppe...@googlegroups.com
Enis Inan updated an issue
 
Change By: Enis Inan
[Puppet::Provider::Service::Upstart|https://github.com/puppetlabs/puppet/blob/c6ee7ddcb80f2ec4be03edcafade20d1853a4aee/lib/puppet/provider/service/upstart.rb#L30-L35] had a confine added that is run when the provider is loaded.

{code:ruby}

  confine :true => begin
    initctl('version', '--quiet')
    true
  rescue
    false
  end
{code}


This causes issues with running tests under things like JRuby, and also means that it is not possible for the provider to become suitable during the course of a transaction.  Instead of using a begin/rescue/end block which will be evaluated during the provider definition, this should be something that will be evaluated only when checking if the provider is suitable.
 

This probably means creating a new type of [Puppet::Confine|https://github.com/puppetlabs/puppet/tree/c6ee7ddcb80f2ec4be03edcafade20d1853a4aee/lib/puppet/confine] that is capable of taking a block to be lazily evaluated as the only existing one that does any sort of "call this code later" goes through the feature machinery. We could also modify the existing {{true}} and {{false}} confines to (optionally) accept a block.

Enis Inan (JIRA)

unread,
Dec 10, 2018, 2:46:03 PM12/10/18
to puppe...@googlegroups.com
Enis Inan updated an issue
[Puppet::Provider::Service::Upstart|https://github.com/puppetlabs/puppet/blob/c6ee7ddcb80f2ec4be03edcafade20d1853a4aee/lib/puppet/provider/service/upstart.rb#L30-L35] had a confine added that is run when the provider is loaded.

{code:ruby}
  confine :true => begin
    initctl('version', '--quiet')
    true
  rescue
    false
  end
{code}

This causes issues with running tests under things like JRuby, and also means that it is not possible for the provider to become suitable during the course of a transaction.  Instead of using a begin/rescue/end block which will be evaluated during the provider definition, this should be something that will be evaluated only when checking if the provider is suitable.
 

This probably means creating a new type of [Puppet::Confine|https://github.com/puppetlabs/puppet/tree/c6ee7ddcb80f2ec4be03edcafade20d1853a4aee/lib/puppet/confine] that is capable of taking a block to be lazily evaluated as the only existing one that does any sort of "call this code later" goes through the feature machinery. We could also modify the existing {{true}} and {{false}} confines to ( optionally ) accept a block.

Enis Inan (JIRA)

unread,
Dec 13, 2018, 5:48:03 AM12/13/18
to puppe...@googlegroups.com

Enis Inan (JIRA)

unread,
Dec 13, 2018, 5:48:04 AM12/13/18
to puppe...@googlegroups.com
Enis Inan updated an issue
Change By: Enis Inan
Sprint: Platform OS Kanban

Josh Cooper (JIRA)

unread,
Jan 14, 2019, 4:08:03 PM1/14/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Jan 14, 2019, 4:08:04 PM1/14/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
Fix Version/s: PUP 5.5.z
Fix Version/s: PUP 5.5.11

Josh Cooper (JIRA)

unread,
Jan 14, 2019, 4:09:04 PM1/14/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Jan 14, 2019, 4:09:04 PM1/14/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 6.2.0
Fix Version/s: PUP 6.0.6

Enis Inan (JIRA)

unread,
Jan 14, 2019, 4:32:02 PM1/14/19
to puppe...@googlegroups.com
Enis Inan updated an issue
Change By: Enis Inan
Release Notes Summary: The upstart daemon-check confine in the upstart provider has been fixed so that it is now evaluated when provider suitability's being checked.
Release Notes: Bug Fix

Casey Williams (JIRA)

unread,
Jan 21, 2019, 12:18:02 AM1/21/19
to puppe...@googlegroups.com

Casey Williams (JIRA)

unread,
Jan 23, 2019, 12:18:03 PM1/23/19
to puppe...@googlegroups.com
Casey Williams commented on Bug PUP-9336
 
Re: Ensure provider suitability is always lazily evaluated

This work was reverted after merging up to the 6.0.x branch to allow the 6.2.0 release to proceed. I'll open a PR to un-revert it after the release is finished.

Josh Cooper (JIRA)

unread,
Jan 25, 2019, 11:42:03 AM1/25/19
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-9336

These changes were reverted in 6.0.x in f785859681 and re-reverted in 6.0.x in a6f7ff57c9.

Josh Cooper (JIRA)

unread,
Jan 25, 2019, 11:43:03 AM1/25/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
Fix Version/s: PUP 6.2.1

Jean Bond (JIRA)

unread,
Feb 19, 2019, 2:14:03 PM2/19/19
to puppe...@googlegroups.com
Jean Bond updated an issue
Change By: Jean Bond
Labels: resolved-issue-added

Josh Cooper (Jira)

unread,
Oct 23, 2020, 8:02:03 PM10/23/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Affects Version/s: PUP 5.5.z
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages