[chef] Retrieve values from resources


Chronological Thread 
  • From: "John Warren" < >
  • To: < >
  • Subject: [chef] Retrieve values from resources
  • Date: Thu, 4 Sep 2014 16:58:46 -0400
  • Importance: Normal

I’m working on a cookbook with a template that has some conditional logic driven by the version of mysql.  A recipe installs mysql and then renders a file from the template.  There used to be a “default_version_for” function that would provide the default version of mysql to install on a given OS, but this function has been removed, presumably because if the version is not specified, the default version for the OS is automatically installed.  However, now that the function is gone, I’m wondering how to obtain the version of mysql that was installed when no version is specified.  I tried getting the resource via:
 
server_resource = resources(mysql_service: node['mysql']['service_name'])
 
and then accessing the version using:
 
server_resource.version
 
However, that returns nil.  How can instance-variable values be retrieved from resources?
 
Thanks,
 
John



Archive powered by MHonArc 2.6.16.

§