[PUP-1786] Error with noop run when file has require and source that doesn't exist Created: 2014/02/27  Updated: 2017/05/18  Resolved: 2017/05/16

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: Steven Willis Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: error, file, needs_decision, noop, require, source
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

puppet enterprise 3.0


Issue Links:
Blocks
Relates
relates to PUP-3907 Noop changes to file ownership genera... Accepted
Template:

 Description   

The following manifest fails when run with --noop, but succeeds when run normally:

t.pp

file { '/tmp/foo-bar':
  content => "Hello\n",
}
 
file { '/tmp/bar-foo':
  source => "file:///tmp/foo-bar",
  require => File['/tmp/foo-bar'],
}

$ rm -rf /tmp/foo-bar /tmp/bar-foo; puppet apply t.pp 
Notice: Compiled catalog for swillis-macbook-pro.local in environment production in 0.12 seconds
Notice: /Stage[main]/Main/File[/tmp/foo-bar]/ensure: defined content as '{md5}09f7e02f1290be211da707a266f153b3'
Notice: /Stage[main]/Main/File[/tmp/bar-foo]/ensure: defined content as '{md5}09f7e02f1290be211da707a266f153b3'
Notice: Finished catalog run in 0.06 seconds
$ rm -rf /tmp/foo-bar /tmp/bar-foo; puppet apply --noop t.pp 
Notice: Compiled catalog for swillis-macbook-pro.local in environment production in 0.12 seconds
Notice: /Stage[main]/Main/File[/tmp/foo-bar]/ensure: current_value absent, should be file (noop)
Error: /Stage[main]/Main/File[/tmp/bar-foo]: Could not evaluate: Could not retrieve information from environment production source(s) file:///tmp/foo-bar
Notice: Class[Main]: Would have triggered 'refresh' from 1 events
Notice: Stage[main]: Would have triggered 'refresh' from 1 events
Notice: Finished catalog run in 0.05 seconds

A resource (in this case: file) should not fail when run under noop just because one of its predicates (in this case: its source existing) isn't true. Especially when the resource has a require which very well may end up satisfying the predicate.



 Comments   
Comment by Steven Willis [ 2014/02/27 ]

Sorry, I don't know why this was created under modules. I'll close it out.

Comment by Ryan Coleman [ 2014/02/27 ]

Steven Willis, I'll just move it for you.

Comment by Ryan Coleman [ 2014/02/27 ]

Heh, you beat me to it. Cheers.

Comment by Steven Willis [ 2014/02/27 ]

I also just discovered the ability to move. I think I beat you to it.

Comment by Josh Cooper [ 2017/05/16 ]

Thank you for filing this issue. While we agree this is likely an improvement, addressing this issue would require a substantial architecture change that we do not anticipate being able to undertake due to other issues taking precedence. For example, puppet in general doesn't know that the source parameter (which is required) will be created by another resource in the catalog. In this example, it's another file resource, but it could come from a package, exec, etc resource. As such, this ticket will be closed as “Won’t Fix”. We may revisit this at a later time, and if so, will re-open this ticket.

Generated at Sat Jan 25 00:33:47 PST 2020 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.