I wrote the following manifest :

===============================
define mysubtype($filepath = $title, $source) {
    file {"$filepath":
        content => template("$source")
    }
}

define mytype($param2) {
    mysubtype{"/tmp/parsed1":
        source => "/tmp/parsed.erb"
   }
    file{"/tmp/parsed2":
        content => template("/tmp/parsed.erb"),
   }
}

class myclass($param1) {
    mytype{'mytype':
       param2 => "param2"
    }
}
 
class {"myclass":
    param1 => "param1"
}
===============================


parsed.erb is :
===============================
<% require "yaml" %>
<%= YAML::dump(scope.to_hash) %>
===============================

So the template for file parsed2 is called directly, but file for template 
parse1 goes through a custom type.

After a puppet apply, a diff betwen /tmp/parsed1 and /tmp/parsed2 gives : (< is 
file parsed1, > is file parsed2)
===============================
45c45
<   title: /tmp/parsed1
---
>   title: mytype
66d65
<   source: /tmp/parsed.erb
85a85
>   param2: param2
91c91
<   name: /tmp/parsed1
---
>   name: mytype
105d104
<   filepath: /tmp/parsed1
===============================

Is that normal that params1 is part of the context in both case, but not param2 
?

I think the value of 'title' and name disturbing too. It should be either 
mysubtype and mytype or /tmp/parsed1 and /tmp/parsed2. But no a strange mix of 
both.

For completness :
$ facter puppetversion rubyversion lsbdistdescription
lsbdistdescription => Scientific Linux release 6.5 (Carbon)
puppetversion => 3.6.1
rubyversion => 1.8.7

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2F6FAB20-0113-4DCD-91A7-4F2D4A94714D%40spamcop.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to