Bug #5761

a local collect ignores default values

Added by David Schmitt over 1 year ago. Updated about 1 year ago.

Status:Accepted Start date:01/04/2011
Priority:Normal Due date:
Assignee:Ben Hughes % Done:

0%

Category:exported resources
Target version:-
Affected Puppet version:2.6.3 Branch:
Keywords:export collect tags defaults
Votes: 0

Description

File { tag => 'sc_test' }
@@file {
    "/tmp/test1": ensure => present;
    "/tmp/test2": ensure => present, tag => 'sc_test';
}
File <<| tag == 'sc_test' |>>


# ls -la /tmp/test*
-rw-r--r-- 1 root root 0 Jan  3 14:28 /tmp/test2

From my understanding, the defaults statement in the first line should ensure that both files are tagged ‘sc_test’. As can be seen from the results, only the explicitly tagged resource is collected. This can also be observed with other parameters.

The resource gets written into the stored configs database and other nodes can collect both files.

History

Updated by Ben Hughes about 1 year ago

  • Status changed from Unreviewed to Accepted
  • Assignee set to Ben Hughes

Interesting. Thank you for the good example code.

What’s weirder still is the following:

[ben@paresthesia:~]% cat scope.pp    
File { tag => 'dave' }
File { tag => 'sc_test' }

@file {
    "/tmp/test1": ensure => present;
    "/tmp/test2": ensure => present, tag => 'sc_test';
}

File <| tag == 'sc_test' |>

(I made it virtual, rather than exported, just to remove one element of working.) and you get:

[ben@paresthesia:~]% puppet apply -v scope.pp
info: Connecting to sqlite3 database: /Users/ben/.puppet/var/state/clientconfigs.sqlite3
Default already defined for File { tag }; cannot redefine at /Users/ben/scope.pp:2 on node paresthesia.box

Adding in more debug as I go, it’s weird, it’s being set.

debug: File[/tmp/test1]: Adding default for tag
debug: File[/tmp/test1]: Param is at tag => sc_test

Also available in: Atom PDF