Note that there are some explanatory texts on larger screens.

plurals
  1. POChef attribute node[:languages] vanishes after first chef-client run
    primarykey
    data
    text
    <p>I have a Chef cookbook that includes the <code>passenger_apache2::mod_rails</code> recipe from the <a href="https://github.com/opscode-cookbooks/passenger_apache2" rel="nofollow">passenger_apache2 cookbook</a>. On the server's first Chef run, this created two (valid) configuration files:</p> <pre><code># /etc/apache2/mods-available/passenger.load LoadModule passenger_module /var/lib/gems/1.9.1/gems/passenger-3.0.11/ext/apache2/mod_passenger.so # /etc/apache2/mods-available/passenger.conf PassengerRoot /var/lib/gems/1.9.1/gems/passenger-3.0.11 PassengerRuby /usr/bin/ruby1.9.1 PassengerMaxPoolSize 6 </code></pre> <p>These are created by using the cookbook's templates <a href="https://github.com/opscode-cookbooks/passenger_apache2/blob/master/templates/default/passenger.load.erb" rel="nofollow">passenger.load.erb</a> and <a href="https://github.com/opscode-cookbooks/passenger_apache2/blob/master/templates/default/passenger.conf.erb" rel="nofollow">passenger.conf.erb</a>, respectively, using <code>node[:languages][:ruby][:ruby_bin]</code> and <code>node[:languages][:ruby][:gems_dir]</code>. Those attributes are be <a href="http://docs.opscode.com/ohai.html" rel="nofollow">automatically populated by Ohai</a>.</p> <p>On a second run of <code>chef-client</code>, these files get screwed up. Here's how they look now:</p> <pre><code># /etc/apache2/mods-available/passenger.load LoadModule passenger_module /gems/passenger-3.0.11/ext/apache2/mod_passenger.so # /etc/apache2/mods-available/passenger.conf PassengerRoot /gems/passenger-3.0.11 PassengerRuby PassengerMaxPoolSize 6 </code></pre> <p>So it appears that <code>node[:languages][:ruby]</code> is not getting populated during the Chef run. But if I call Ohai directly from an IRB session on the server, it appears correctly.</p> <pre class="lang-rb prettyprint-override"><code>$ sudo -Hu root /usr/bin/irb1.9.1 irb(main):001:0&gt; require 'yaml' irb(main):002:0&gt; require 'chef' irb(main):003:0&gt; node = YAML::load(`/usr/local/bin/ohai`) irb(main):004:0&gt; node['languages']['ruby']['ruby_bin'] =&gt; "/usr/bin/ruby1.9.1" irb(main):005:0&gt; mash = Chef::Mash.new(node) irb(main):006:0&gt; mash[:languages][:ruby][:ruby_bin] =&gt; "/usr/bin/ruby1.9.1" </code></pre> <p>I can fix the file, but it won't stop the problem from recurring on the next Chef run. I'm a bit stumped on how to appropriately troubleshoot this problem further.</p> <p>Has anyone else run into this problem? I haven't yet tried setting those attributes manually in my cookbook or role, but I don't believe I should; automatic attributes are not supposed to be overridden. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload