Issue #17897 has been updated by Nick Chappell.
See support URL for further info on type/provider. ---------------------------------------- Bug #17897: Facts not available to manifests in Puppet device mode https://projects.puppetlabs.com/issues/17897#change-77986 Author: Sean Millichamp Status: Unreviewed Priority: Normal Assignee: Category: device Target version: Affected Puppet version: 2.7.12 Keywords: device fact Branch: I am working on a custom device type/provider for the Spacewalk API and just noticed an odd fact-related behavior. My device provider code is properly returning facts and I can see them show up in the system inventory in the PE Console BUT they don't seem to be made available to the manifests for the device to be used when compiling the catalog. The facts function from my spacewalk/lib/puppet/util/network_device/spacewalk/device.rb file: <pre> def facts facts = {} Puppet.debug("Puppet::Device::Spacewalk: Retrieving facts") facts[:api_version] = @rpc.call('api.getVersion') facts[:system_version] = @rpc.call('api.systemVersion') facts[:productname] = 'Spacewalk' facts end </pre> These values are being properly retrieved and added to the fact inventory. Copy and paste from the PE console: <pre> Inventory Current inventory for device_host_name as of 2012-12-02 15:15 EST Fact Value api_version 10.11 clientcert device_host_name clientversion 2.7.12 (Puppet Enterprise 2.5.1) environment dev_seanmillichamp_spacewalk_test productname Spacewalk system_version 5.4.1 </pre> I used notifys to show the variable values. Notify isn't a proper device type and so is ultimately ignored during the catalog application, but in debug mode the title of the notify shows up, which is good enough to see what Puppet is using as the variable values. For resources declared in the device's manifest that looks like: <pre> notify { "My productname is ${::productname}": } notify { "My API version is ${::api_version}": } notify { "My clientcert is ${::clientcert}": } notify { "My clientversion is ${::clientversion}": } notify { "My environment is ${::environment}": } notify { "My system_version is ${::system_version}": } </pre> I get this output during the catalog run with "puppet device": <pre> debug: /Stage[main]/Spacewalk_policy/Notify[My clientcert is device_host_name]: Skipping host resources because running on a device debug: /Stage[main]/Spacewalk_policy/Notify[My environment is dev_seanmillichamp_spacewalk_test]: Skipping host resources because running on a device debug: /Stage[main]/Spacewalk_policy/Notify[My productname is ]: Skipping host resources because running on a device debug: /Stage[main]/Spacewalk_policy/Notify[My API version is ]: Skipping host resources because running on a device debug: /Stage[main]/Spacewalk_policy/Notify[My system_version is ]: Skipping host resources because running on a device debug: /Stage[main]/Spacewalk_policy/Notify[My clientversion is 2.7.12 (Puppet Enterprise 2.5.1)]: Skipping host resources because running on a device </pre> Basically, any facts generated internally as a normal part of a Puppet run are included, but the provided facts which are being generated and sent are not being made available. I tried using the both the $::api_version and $api_version forms, but both return without value. I bumped into this while trying to figure out why some conditional logic around the fact values in the manifests appeared to not be working. And to answer the question that I'm sure someone will ask: No, this device type/provider code isn't published anywhere YET, though I am working on getting that cleared. However, I believe that the presence of the correct fact information appearing in the system inventory should be evidence enough that at least that portion of the code is working properly. I believe this behavior probably indicates that there is a difference somewhere in Puppet on how facts are handled between agent and device runs that impact their availability in to the parser, but I'm not sure about the particulars of how that happens in Puppet. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
