7 Issues (and fixes) for installing Puppetlabs Razor on CentOS 6

I’m very fortunate to have a nice lab at work where I have a UCS chassis, fabrics, a few blades and a VNX to play with. Recently I’ve been working on getting our Razor implementation hammered out so messing around with all the good automation bits.

Now, because its a lab, it doesn’t tend to fall into the same patching cycles as our production servers do. My Razor server in particular is an example of this only getting updated when I have the chance to turn a wrench.

So, dusting off the old project, I dusted off yum and did my usual update of puppet, razor and the various bits involved. Now because various things have changed in the 6 months that I’ve had this installed, I had a variety of issues getting everything up to date.

Issue #1 – undefined method `exists?’

Kicking off the puppet agent -t to make sure everything was still working right I was greeted with the following error:

Jul 30 10:34:05 razor puppet-master[5650]: Could not create resources for managing Puppet's files and directories in sections [:main, :master, :ssl, :metrics]: undefined method `exists?' for #

Google to the rescue!!!

A quick google search and I found this bug, which basically states, update your gems dumbass.

[root@razor log]# gem update puppet
Updating installed gems
Updating puppet
Fetching: rgen-0.6.5.gem (100%)
Fetching: puppet-3.2.3.gem (100%)
Fetching: json_pure-1.8.0.gem (100%)
Successfully installed rgen-0.6.5
Successfully installed puppet-3.2.3
Successfully installed json_pure-1.8.0
Gems updated: rgen, puppet, json_pure
Installing ri documentation for rgen-0.6.5...
Installing ri documentation for puppet-3.2.3...
Installing ri documentation for json_pure-1.8.0...
Installing RDoc documentation for rgen-0.6.5...
Installing RDoc documentation for puppet-3.2.3...
Could not find main page README.md
Could not find main page README.md
Could not find main page README.md
Could not find main page README.md
Installing RDoc documentation for json_pure-1.8.0...

Issue #2 – Out of date Razor

Razor has been pretty fast moving and one of the issues that I had had in my first go around was the the update would recognize the blade, start the install but hang on tools.00. The issue has been documented here.

Ok, no worries, this is a lab right. let’s blow everything away and start fresh with a new install of razor. Unforunately, there are several items that have been fixed within the git repository for razor that have yet to make it into the puppet forge. Seeing as I was attempting to be a lazy bastard and installed from the forge, I welcome you to issues 3, 4, and 5.

Issue #3 – Razor::Nodejs fails to execute ‘/usr/bin/npm install –global express’

Error: Execution of '/usr/bin/npm install --global express' returned 1: npm http GET https://registry.npmjs.org/express
npm http 200 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/express/-/express-3.2.3.tgz
npm http GET https://registry.npmjs.org/connect/2.7.9
npm http GET https://registry.npmjs.org/commander/0.6.1
npm http GET https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/mkdirp/0.3.4
npm http GET https://registry.npmjs.org/cookie/0.0.5
npm http GET https://registry.npmjs.org/buffer-crc32/0.2.1
npm http GET https://registry.npmjs.org/fresh/0.1.0
npm http GET https://registry.npmjs.org/methods/0.0.1
npm http GET https://registry.npmjs.org/send/0.1.0
npm http GET https://registry.npmjs.org/cookie-signature/1.0.1
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/qs/0.6.4
npm http 200 https://registry.npmjs.org/cookie/0.0.5
npm http 200 https://registry.npmjs.org/mkdirp/0.3.4
npm http 200 https://registry.npmjs.org/range-parser/0.0.4
npm http 200 https://registry.npmjs.org/commander/0.6.1
npm http 200 https://registry.npmjs.org/connect/2.7.9
npm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.4.tgz
npm http GET https://registry.npmjs.org/cookie/-/cookie-0.0.5.tgz
npm http GET https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz
npm http GET https://registry.npmjs.org/connect/-/connect-2.7.9.tgz
npm http GET https://registry.npmjs.org/commander/-/commander-0.6.1.tgz
npm http 200 https://registry.npmjs.org/fresh/0.1.0
npm http GET https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz
npm http 200 https://registry.npmjs.org/methods/0.0.1
npm http GET https://registry.npmjs.org/methods/-/methods-0.0.1.tgz
npm http 200 https://registry.npmjs.org/buffer-crc32/0.2.1
npm http GET https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz
npm http 200 https://registry.npmjs.org/cookie-signature/1.0.1
npm http 200 https://registry.npmjs.org/send/0.1.0
npm http GET https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.1.tgz
npm http GET https://registry.npmjs.org/send/-/send-0.1.0.tgz
npm http 200 https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/debug/-/debug-0.7.2.tgz
npm http 200 https://registry.npmjs.org/qs/0.6.4
npm http GET https://registry.npmjs.org/qs/-/qs-0.6.4.tgz
npm ERR! error rolling back express@3.2.3 Error: ENOTEMPTY, rmdir '/usr/lib/node_modules/express/node_modules/cookie'

npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: connect@2.7.9
npm ERR! Required: {"node":">= 0.8.0"}
npm ERR! Actual:   {"npm":"1.1.19","node":"0.6.18"}
npm ERR!
npm ERR! System Linux 2.6.32-279.el6.x86_64
npm ERR! command "nodejs" "/usr/bin/npm" "install" "--global" "express"
npm ERR! cwd /root/foo
npm ERR! node -v v0.6.18
npm ERR! npm -v 1.1.19
npm ERR! code ENOTSUP
npm ERR! message Unsupported
npm ERR! errno {}

npm ERR! Error: ENOENT, open '/usr/lib/node_modules/express/node_modules/fresh/package.json'
npm ERR! You may report this log at:
npm ERR!    
npm ERR! or email it to:
npm ERR!    
npm ERR!
npm ERR! System Linux 2.6.32-279.el6.x86_64
npm ERR! command "nodejs" "/usr/bin/npm" "install" "--global" "express"
npm ERR! cwd /root/foo
npm ERR! node -v v0.6.18
npm ERR! npm -v 1.1.19
npm ERR! path /usr/lib/node_modules/express/node_modules/fresh/package.json
npm ERR! code ENOENT
npm ERR! message ENOENT, open '/usr/lib/node_modules/express/node_modules/fresh/package.json'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /root/foo/npm-debug.log
npm not ok

Oh goody, nodejs install issues. Nodejs is pretty important for what we’re doing here. I, like many, have found that running the EPEL repositories on my CentOS boxes are a good thing to have in place. It apparently causes some butt hurt in this instance but luckily the change is pretty minor.

When I installed razor, it by default installed several other dependencies. The one we want in this instance is the nodejs module and editing the /etc/puppet/modules/nodejs/manifests/params.pp file fixes the glitch.

Change this:

    'RedHat', 'CentOS', 'OEL', 'OracleLinux': {
      $majdistrelease = $::lsbmajdistrelease ? {
        ''      => regsubst($::operatingsystemrelease,'^(\d+)\.(\d+)','\1'),
        default => $::lsbmajdistrelease,
      }
      $node_pkg = 'node-compat-symlinks'
      $npm_pkg  = 'npm'
      $baseurl  = 'http://patches.fedorapeople.org/oldnode/stable/el$releasever/$basearch/'
      $gpgcheck = $majdistrelease ? {
        '5'     => 0,
        default => 1,
      }
    }

To this:

    'RedHat', 'CentOS', 'OEL', 'OracleLinux': {
      $majdistrelease = $::lsbmajdistrelease ? {
        ''      => regsubst($::operatingsystemrelease,'^(\d+)\.(\d+)','\1'),
        default => $::lsbmajdistrelease,
      }
      $node_pkg = 'nodejs'
      $npm_pkg  = 'npm'
      $baseurl  = 'http://patches.fedorapeople.org/oldnode/stable/el$releasever/$basearch/'
      $gpgcheck = $majdistrelease ? {
        '5'     => 0,
        default => 1,
      }
    }

This change is outlined here.

Issue #4 – Unable to download latest razor microkernel.iso

Error: Could not start Service[razor]: Execution of '/opt/razor/bin/razor_daemon.rb start' returned 1:
Error: /Stage[main]/Razor/Service[razor]/ensure: change from stopped to running failed: Could not start Service[razor]: Execution of '/opt/razor/bin/razor_daemon.rb start' returned 1:
Notice: /Stage[main]/Razor/Rz_image[razor-microkernel-latest.iso]: Dependency Service[razor] has failures: true
Warning: /Stage[main]/Razor/Rz_image[razor-microkernel-latest.iso]: Skipping because of failed dependencies

The fix is apparently we’re missing a gem that needs to be installed.

# gem install net-scp
Fetching: net-scp-1.1.2.gem (100%)
Successfully installed net-scp-1.1.2
1 gem installed
Installing ri documentation for net-scp-1.1.2...
Installing RDoc documentation for net-scp-1.1.2...

After that, smooth sailing.

Notice: Downloading rz_image from https://downloads.puppetlabs.com/razor/iso/prod/razor-microkernel-latest.iso to /opt/razor/razor-microkernel-latest.iso ...
Notice: /Stage[main]/Razor/Rz_image[razor-microkernel-latest.iso]/ensure: created

Issue #5 – xinetd Warning messages

Warnings warnings warnings!!!

I think this is probably another one that needs some TLC from forge.

Warning: Variable access via 'name' is deprecated. Use '@name' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:4
   (at /etc/puppet/modules/xinetd/templates/service.erb:4:in `result')
Warning: Variable access via 'port' is deprecated. Use '@port' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:6
   (at /etc/puppet/modules/xinetd/templates/service.erb:6:in `result')
Warning: Variable access via 'disable' is deprecated. Use '@disable' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:7
   (at /etc/puppet/modules/xinetd/templates/service.erb:7:in `result')
Warning: Variable access via 'socket_type' is deprecated. Use '@socket_type' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:8
   (at /etc/puppet/modules/xinetd/templates/service.erb:8:in `result')
Warning: Variable access via 'protocol' is deprecated. Use '@protocol' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:9
   (at /etc/puppet/modules/xinetd/templates/service.erb:9:in `result')
Warning: Variable access via 'mywait' is deprecated. Use '@mywait' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:10
   (at /etc/puppet/modules/xinetd/templates/service.erb:10:in `result')
Warning: Variable access via 'user' is deprecated. Use '@user' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:11
   (at /etc/puppet/modules/xinetd/templates/service.erb:11:in `result')
Warning: Variable access via 'group' is deprecated. Use '@group' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:12
   (at /etc/puppet/modules/xinetd/templates/service.erb:12:in `result')
Warning: Variable access via 'server' is deprecated. Use '@server' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:13
   (at /etc/puppet/modules/xinetd/templates/service.erb:13:in `result')
Warning: Variable access via 'bind' is deprecated. Use '@bind' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:14
   (at /etc/puppet/modules/xinetd/templates/service.erb:14:in `result')
Warning: Variable access via 'server_args' is deprecated. Use '@server_args' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:15
   (at /etc/puppet/modules/xinetd/templates/service.erb:15:in `result')
Warning: Variable access via 'per_source' is deprecated. Use '@per_source' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:16
   (at /etc/puppet/modules/xinetd/templates/service.erb:16:in `result')
Warning: Variable access via 'log_on_failure' is deprecated. Use '@log_on_failure' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:17
   (at /etc/puppet/modules/xinetd/templates/service.erb:17:in `result')
Warning: Variable access via 'cps' is deprecated. Use '@cps' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:18
   (at /etc/puppet/modules/xinetd/templates/service.erb:18:in `result')
Warning: Variable access via 'flags' is deprecated. Use '@flags' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:19
   (at /etc/puppet/modules/xinetd/templates/service.erb:19:in `result')
Warning: Variable access via 'service_type' is deprecated. Use '@service_type' instead. template[/etc/puppet/modules/xinetd/templates/service.erb]:20
   (at /etc/puppet/modules/xinetd/templates/service.erb:20:in `result')

The fix is to change this:

# This file is being maintained by Puppet.
# DO NOT EDIT

service <%= name %>
{
        port            = <%= port %>
        disable         = <%= disable %>
        socket_type     = <%= socket_type %>
        protocol        = <%= protocol %>
        wait            = <%= mywait %>
        user            = <%= user %>
        group           = <%= group %>
        server          = <%= server %>
        bind            = <%= bind %>
<% if server_args != :undef %>        server_args     = <%= server_args %><% end %>
<% if per_source != :undef %>        per_source      = <%= per_source %><% end %>
<% if log_on_failure != :undef %>       log_on_failure      += <%= log_on_failure %><% end %>
<% if cps != :undef %>        cps             = <%= cps %><% end %>
<% if flags != :undef %>        flags           = <%= flags %><% end %>
<% if service_type != :undef %>        type     = <%= service_type %><% end %>
}

to this

# This file is being maintained by Puppet.
# DO NOT EDIT

service <%= @name %>
{
        port            = <%= @port %>
        disable         = <%= @disable %>
        socket_type     = <%= @socket_type %>
        protocol        = <%= @protocol %>
        wait            = <%= @mywait %>
        user            = <%= @user %>
        group           = <%= @group %>
        server          = <%= @server %>
        bind            = <%= @bind %>
<% if @server_args != :undef %>        server_args     = <%= @server_args %><% end %>
<% if @per_source != :undef %>        per_source      = <%= @per_source %><% end %>
<% if @log_on_failure != :undef %>       log_on_failure      += <%= @log_on_failure %><% end %>
<% if @cps != :undef %>        cps             = <%= @cps %><% end %>
<% if @flags != :undef %>        flags           = <%= @flags %><% end %>
<% if @service_type != :undef %>        type     = <%= @service_type %><% end %>
}

Issue #6 – Warning messages in the Mongo.conf

Very similiar to the xinetd issues. This time in Mongo.

Warning: Variable access via 'logpath' is deprecated. Use '@logpath' instead. template[/etc/puppet/modules/mongodb/templates/mongod.conf.erb]:4
   (at /etc/puppet/modules/mongodb/templates/mongod.conf.erb:4:in `result')
Warning: Variable access via 'logappend' is deprecated. Use '@logappend' instead. template[/etc/puppet/modules/mongodb/templates/mongod.conf.erb]:5
   (at /etc/puppet/modules/mongodb/templates/mongod.conf.erb:5:in `result')
Warning: Variable access via 'mongofork' is deprecated. Use '@mongofork' instead. template[/etc/puppet/modules/mongodb/templates/mongod.conf.erb]:8
   (at /etc/puppet/modules/mongodb/templates/mongod.conf.erb:8:in `result')
Warning: Variable access via 'port' is deprecated. Use '@port' instead. template[/etc/puppet/modules/mongodb/templates/mongod.conf.erb]:9
   (at /etc/puppet/modules/mongodb/templates/mongod.conf.erb:9:in `result')
Warning: Variable access via 'dbpath' is deprecated. Use '@dbpath' instead. template[/etc/puppet/modules/mongodb/templates/mongod.conf.erb]:10
   (at /etc/puppet/modules/mongodb/templates/mongod.conf.erb:10:in `result')

Again, easy fix. Change this:

# mongo.conf - generated from Puppet

#where to log
logpath=<%= logpath %>
logappend=<%= logappend %>

# fork and run in background
fork = <%= mongofork %>
port = <%= port %>
dbpath= <%= dbpath %>

<% if @nojournal %>
# Disables write-ahead journaling
nojournal = <%= nojournal %>
<% end %>
<% if @cpu %>
# Enables periodic logging of CPU utilization and I/O wait
cpu = <%= cpu %>

<% end %>
<% if @noauth %>
# Turn on/off security.  Off is currently the default
noauth = <%= noauth %>
<% end %>
<% if @auth %>
auth = <%= auth %>
<% end %>
<% if @verbose %>
# Verbose logging output.
verbose = <%= verbose %>
<% end %>
<% if @objcheck %>
# Inspect all client data for validity on receipt (useful for
# developing drivers)
objcheck = <%= objcheck %>
<% end %>
<% if @quota %>
# Enable db quota management
quota = <%= quota %>
<% end %>
<% if @oplog %>
# Set oplogging level where n is
#   0=off (default)
#   1=W
#   2=R
#   3=both
#   7=W+some reads
oplog = <%= oplog %>
<% end %>
<% if @nohints %>
# Ignore query hints
nohints = <%= nohints %>
<% end %>
<% if @nohttpinterface %>
# Disable the HTTP interface (Defaults to localhost:27018).
nohttpinterface = <%= nohttpinterface %>
<% end %>
<% if @noscripting %>
# Turns off server-side scripting.  This will result in greatly limited
# functionality
noscripting = <%= noscripting %>
<% end %>
<% if @notablescan %>
# Turns off table scans.  Any query that would do a table scan fails.
notablescan = <%= notablescan %>
<% end %>
<% if @noprealloc %>
# Disable data file preallocation.
noprealloc = <%= noprealloc %>
<% end %>
<% if @nssize %>
# Specify .ns file size for new databases.
 nssize = <%= nssize %>
<% end %>
<% if @mms_token %>
# Accout token for Mongo monitoring server.
mms-token = <%= mms_token %>
<% end %>
<% if @mms_name %>
# Server name for Mongo monitoring server.
mms-name = <%= mms_name %>
<% end %>
<% if @mms_interval %>
# Ping interval for Mongo monitoring server.
mms-interval = <%= mms_interval %>
<% end %>
<% if @slave %>
slave = <%= slave %>
<% end %>
<% if @mongosource %>
source = <%= mongosource %>
<% end %>
<% if @only %>
# Slave only: specify a single database to replicate
only = <%= only %>
<% end %>
<% if @master %>
master = <%= master %>
<% end %>

to this:

# mongo.conf - generated from Puppet

#where to log
logpath=<%= @logpath %>
logappend=<%= @logappend %>

# fork and run in background
fork = <%= @mongofork %>
port = <%= @port %>
dbpath= <%= @dbpath %>

<% if @nojournal %>
# Disables write-ahead journaling
nojournal = <%= @nojournal %>
<% end %>
<% if @cpu %>
# Enables periodic logging of CPU utilization and I/O wait
cpu = <%= @cpu %>

<% end %>
<% if @noauth %>
# Turn on/off security.  Off is currently the default
noauth = <%= @noauth %>
<% end %>
<% if @auth %>
auth = <%= @auth %>
<% end %>
<% if @verbose %>
# Verbose logging output.
verbose = <%= @verbose %>
<% end %>
<% if @objcheck %>
# Inspect all client data for validity on receipt (useful for
# developing drivers)
objcheck = <%= @objcheck %>
<% end %>
<% if @quota %>
# Enable db quota management
quota = <%= @quota %>
<% end %>
<% if @oplog %>
# Set oplogging level where n is
#   0=off (default)
#   1=W
#   2=R
#   3=both
#   7=W+some reads
oplog = <%= @oplog %>
<% end %>
<% if @nohints %>
# Ignore query hints
nohints = <%= @nohints %>
<% end %>
<% if @nohttpinterface %>
# Disable the HTTP interface (Defaults to localhost:27018).
nohttpinterface = <%= @nohttpinterface %>
<% end %>
<% if @noscripting %>
# Turns off server-side scripting.  This will result in greatly limited
# functionality
noscripting = <%= @noscripting %>
<% end %>
<% if @notablescan %>
# Turns off table scans.  Any query that would do a table scan fails.
notablescan = <%= @notablescan %>
<% end %>
<% if @noprealloc %>
# Disable data file preallocation.
noprealloc = <%= @noprealloc %>
<% end %>
<% if @nssize %>
# Specify .ns file size for new databases.
 nssize = <%= @nssize %>
<% end %>
<% if @mms_token %>
# Accout token for Mongo monitoring server.
mms-token = <%= @mms_token %>
<% end %>
<% if @mms_name %>
# Server name for Mongo monitoring server.
mms-name = <%= @mms_name %>
<% end %>
<% if @mms_interval %>
# Ping interval for Mongo monitoring server.
mms-interval = <%= @mms_interval %>
<% end %>
<% if @slave %>
slave = <%= @slave %>
<% end %>
<% if @mongosource %>
source = <%= @mongosource %>
<% end %>
<% if @only %>
# Slave only: specify a single database to replicate
only = <%= @only %>
<% end %>
<% if @master %>
master = <%= @master %>
<% end %>

Issue #7 – Missing nodejs when starting razor

# /opt/razor/bin/razor_daemon.rb start
which: no nodejs in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/lib)

Really? REALLY!!!

Ok, its installed. But its specifically looking for nodejs inestead of node. This fix seemed to do the trick.

# which node
/usr/bin/node

# cd /usr/bin

# ln -s node nodejs

# which nodejs
/usr/bin/nodejs

Conclusion

Razor is a fast moving project and with it comes all the various bugs for the various flavors of linux. The original code base was written for Ubuntu I believe but other flavors have quickly been picked up. Now they have issues because of the growth issues. But, I’m willing to bet a beer on the fact that all the issues appear to be fixed in the git repository, they just haven’t made it into the forge yet.

The issues are fairly easy to fix if you google and dig a little. Hopefully this post will make it easier for people in the future to find the issues.

Happy Automation Folks!