Jira (PUP-3630) Odd behavior with noop

7 views
Skip to first unread message

Lee Lowder (JIRA)

unread,
Nov 6, 2014, 3:48:24 PM11/6/14
to puppe...@googlegroups.com
Jay Wallace created an issue
 
Puppet / Bug PUP-3630
Odd behavior with noop
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2014/11/06 12:48 PM
Labels: support
Priority: Normal Normal
Reporter: Jay Wallace

This behavior is really quirky.

It seems if a defined type is restructured to include the noop parameter, you get the expected behavior described initially in the ticket (ie a noop overwrite). Without restructuring the defined type, noop => false will not take precedence over what is set in let's say site.pp. This could be due to an issue with the way noop is being "inherited" by the resources with the defined type. I am using inherited pretty loosely here, as this isn't actually the way this works. Further investigation needed, please feel free to either escalate or open a bug with my last update.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.3.7#6337-sha1:2ed701e)
Atlassian logo

Lee Lowder (JIRA)

unread,
Nov 6, 2014, 3:52:24 PM11/6/14
to puppe...@googlegroups.com
Lee Lowder updated an issue
Change By: Lee Lowder
This behavior is really quirky.

 It seems if a defined type is restructured to include the noop parameter, you get the expected behavior described initially in the ticket (ie a noop overwrite). Without restructuring the defined type, noop => false will not take precedence over what is set in let's say site.pp. This could be due to an issue with the way noop is being "inherited" by the resources with the defined type. I am using inherited pretty loosely here, as this isn't actually the way this works.
 Further investigation needed, please feel free to either escalate or open a bug with my last update.  
Add Comment Add Comment
 

Charlie Sharpsteen (JIRA)

unread,
Dec 3, 2014, 1:35:28 PM12/3/14
to puppe...@googlegroups.com
Charlie Sharpsteen commented on Bug PUP-3630
 
Re: Odd behavior with noop

A minimum re-production case for this behavior consists of a defined type and a class which declares a noop resource of that time type:

# atype.pp
define noop_test::atype(
  $content_string = 'some content',
  ) {
 
    file{"/tmp/$title":
    ensure => file,
    content => $content_string,
  }
 
}

# init.pp
class noop_test {
 
  noop_test::atype{'defined_by_class': noop => true}
 
}

The bug can be examined by declaring both a noop resource and the noop_test class inside of a node definition:

# site.pp
node default {
  include noop_test
  noop_test::atype{'defined_in_node': noop => true}
}

When the agent is run, the file resource declared by Atype[defined_in_node] has the expected value of noop => true. However, the file resource declared by Atype[defined_by_class] does not receive a noop => true parameter:

# puppet agent -t
 
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for poss-head-master.puppetdebug.vlan
Info: Applying configuration version '1417630575'
 
Notice: /Stage[main]/Noop_test/Noop_test::Atype[defined_by_class]/File[/tmp/defined_by_class]/ensure: defined content as '{md5}9893532233caff98cd083a116b013c0b'
 
Notice: /Stage[main]/Main/Node[default]/Noop_test::Atype[defined_in_node]/File[/tmp/defined_in_node]/ensure: current_value absent, should be file (noop)
Notice: Noop_test::Atype[defined_in_node]: Would have triggered 'refresh' from 1 events
Notice: Node[default]: Would have triggered 'refresh' from 1 events
Notice: Class[Main]: Would have triggered 'refresh' from 1 events
 
Notice: Applied catalog in 0.03 seconds

The root of the issue is that the compiler sets metaparameters, such as noop, by walking a containment graph [rooted at Class[main]|https://github.com/puppetlabs/puppet/blob/3.7.3/lib/puppet/parser/compiler.rb#L476-L479]. This picks up all resources declared at node scope. However due to the tendency of classes to float free, unless anchored by the contain function, the add_resource_metaparams step of the compiler will miss all resources defined within classes.

A possible fix would be to change add_resource_metaparams such that walks the list of Stage resources and walks each containment graph rooted at a stage. This should produce the correct behavior as all free floating classes are contained by Stage[main].

Charlie Sharpsteen (JIRA)

unread,
Dec 3, 2014, 1:40:27 PM12/3/14
to puppe...@googlegroups.com
Charlie Sharpsteen updated an issue
 
The compiler does not process metaparameters for resources declared outside of Class[main]
Change By: Charlie Sharpsteen
Summary: Odd behavior with noop The compiler does not process metaparameters for resources declared outside of Class[main]

Charlie Sharpsteen (JIRA)

unread,
Dec 3, 2014, 1:46:29 PM12/3/14
to puppe...@googlegroups.com
 
Re: The compiler does not process metaparameters for resources declared outside of Class[main]

Eric Sorenson, Henrik Lindberg: The fix for this one seems fairly simple, but has a far-ranging impact. Walking containment graphs rooted at stages and applying metaparameters enables what seems to be the correct behavior for defined types. However, this will also affect metaparameters declared on parameterized classes, which is something we have rejected in the past.

With the change in compiler behavior, the following metaparameters would become inheritable for all classes and defined types:

Puppet::Type.metaparams.select do |name|
  !Puppet::Parser::Resource.relationship_parameter?(name)
end
  
=> [:noop, :schedule, :audit, :loglevel, :alias, :tag, :stage]

Currently, these metaparameters are inherited by all resources and defined types declared under Class[main]

Charlie Sharpsteen (JIRA)

unread,
Dec 3, 2014, 1:46:30 PM12/3/14
to puppe...@googlegroups.com

Charlie Sharpsteen (JIRA)

unread,
Dec 3, 2014, 1:46:30 PM12/3/14
to puppe...@googlegroups.com

Charlie Sharpsteen (JIRA)

unread,
Dec 3, 2014, 1:46:30 PM12/3/14
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
Dec 3, 2014, 5:50:30 PM12/3/14
to puppe...@googlegroups.com
Henrik Lindberg commented on Bug PUP-3630
 
Re: The compiler does not process metaparameters for resources declared outside of Class[main]

So, how about filtering out the classes so they do not get the meta parameters ?

Henrik Lindberg (JIRA)

unread,
Jan 15, 2015, 4:06:12 PM1/15/15
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
 
Change By: Henrik Lindberg
Scrum Team: Language
This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a)
Atlassian logo

Charlie Sharpsteen (JIRA)

unread,
Jan 23, 2015, 3:22:56 PM1/23/15
to puppe...@googlegroups.com
Charlie Sharpsteen updated an issue
 
The compiler does not process metaparameter resources declared outside of Class[main]
Change By: Charlie Sharpsteen
Summary: The compiler does not process  metaparameters for  metaparameter  resources declared outside of Class[main]

Charlie Sharpsteen (JIRA)

unread,
Jan 23, 2015, 3:23:06 PM1/23/15
to puppe...@googlegroups.com
Charlie Sharpsteen updated an issue
The compiler does not process metaparameter inheritance for resources declared outside of Class[main]
Change By: Charlie Sharpsteen
Summary: The compiler does not process metaparameter  inheritance for  resources declared outside of Class[main]

Henrik Lindberg (JIRA)

unread,
Feb 26, 2015, 6:54:26 PM2/26/15
to puppe...@googlegroups.com

Owen Rodabaugh (JIRA)

unread,
Apr 30, 2015, 6:49:15 PM4/30/15
to puppe...@googlegroups.com
Owen Rodabaugh updated an issue
Change By: Owen Rodabaugh
CS Priority: Minor
This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d)
Atlassian logo

Charlie Sharpsteen (JIRA)

unread,
Jan 29, 2016, 6:28:05 PM1/29/16
to puppe...@googlegroups.com
Charlie Sharpsteen updated an issue
Change By: Charlie Sharpsteen
Affects Version/s: PUP 4.3.2
Affects Version/s: PUP 3.8.5
This message was sent by Atlassian JIRA (v6.4.12#64027-sha1:e3691cc)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
Sep 7, 2016, 6:13:26 PM9/7/16
to puppe...@googlegroups.com
Henrik Lindberg updated an issue
Change By: Henrik Lindberg
Team: Puppet Developer Support
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Charlie Sharpsteen (JIRA)

unread,
Oct 6, 2016, 10:55:20 AM10/6/16
to puppe...@googlegroups.com

So, how about filtering out the classes so they do not get the meta parameters ?

Coming back to this, I think classes should at least get and propagate the noop metaparameter. Otherwise, there isn't a clean way to put a new or upgraded class definitions into noop for testing purposes. Even the usual dirty tricks such as resource defaults and resource collectors won't work because there isn't a single resource type to target.

If we're still opposed to adding metaparameters to resource-style class declarations, then we should find an alternate way to enable the use case of no-opping an entire class or namespace for testing purposes.

Sean McDonald (JIRA)

unread,
May 15, 2017, 2:58:05 PM5/15/17
to puppe...@googlegroups.com

Sean McDonald (JIRA)

unread,
May 15, 2017, 2:58:05 PM5/15/17
to puppe...@googlegroups.com

Moses Mendoza (JIRA)

unread,
May 18, 2017, 1:56:18 PM5/18/17
to puppe...@googlegroups.com

David Schmitt (JIRA)

unread,
Feb 19, 2020, 3:57:04 PM2/19/20
to puppe...@googlegroups.com
David Schmitt commented on Bug PUP-3630
 
Re: The compiler does not process metaparameter inheritance for resources declared outside of Class[main]

A community member on slack and I just rediscovered this problem in PUP-10301. It's still alive and kicking in both puppet 5 and 6.

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

David Schmitt (JIRA)

unread,
Feb 19, 2020, 3:58:07 PM2/19/20
to puppe...@googlegroups.com
David Schmitt updated an issue
 
Change By: David Schmitt
Affects Version/s: PUP 5.5.12
Affects Version/s: PUP 6.12.0

Austin Boyd (Jira)

unread,
Mar 18, 2022, 8:07:02 AM3/18/22
to puppe...@googlegroups.com
Austin Boyd updated an issue
Change By: Austin Boyd
Labels: jira_escalated support
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Austin Boyd (Jira)

unread,
Mar 18, 2022, 8:07:03 AM3/18/22
to puppe...@googlegroups.com

Hubert de Heer (Jira)

unread,
Mar 23, 2022, 11:16:03 AM3/23/22
to puppe...@googlegroups.com
Hubert de Heer commented on Bug PUP-3630
 
Re: The compiler does not process metaparameter inheritance for resources declared outside of Class[main]

Any update on this?
As we experience this when using concat::fragments.
Reproduced on Puppet 6.26.0 & 7.15.0 with concat module v7.1.1

concat_test.pp

class concat_test {
  file { '/tmp/test.file':
    ensure  => file,
    content => "file derp\n",
  }
  concat { '/tmp/concat.file':
    ensure => present,
    noop   => false,
  }
  concat::fragment { 'frag01':
    target  => '/tmp/concat.file',
    content => 'test fragment 01',
    order   => '01',
    noop    => false,
  }
  concat::fragment { 'frag02':
    target  => '/tmp/concat.file',
    content => 'test fragment 02',
    order   => '02',
    noop    => false,
  }
}
include concat_test 

puppet apply --noop concat_test.pp will result in:

Notice: Compiled catalog for lmac.local in environment production in 0.10 seconds
Notice: /Stage[main]/Concat_test/File[/tmp/test.file]/ensure: current_value 'absent', should be 'file' (noop)
Notice: /Stage[main]/Concat_test/Concat[/tmp/concat.file]/File[/tmp/concat.file]/ensure: current_value 'absent', should be 'file' (noop)
Notice: /tmp/concat.file: Would have triggered 'refresh' from 1 event
Notice: Concat[/tmp/concat.file]: Would have triggered 'refresh' from 2 events
Notice: Class[Concat_test]: Would have triggered 'refresh' from 2 events
Notice: Stage[main]: Would have triggered 'refresh' from 1 event
Notice: Applied catalog in 0.02 seconds

Reply all
Reply to author
Forward
0 new messages