Studio3104::BLOG.new

uninitialized constant Studio3104 (NameError)

lsb_release がインストールされている CentOS で knife solo prepare がコケる


タイトルの通りです。
CentOS6.3と6.4で確認しました。

knife solo prepare すると、対向のサーバに chef-client の実行環境をスパっと作ってくれる。
んですが、こんな感じでエラーが表示されてしまいました。

$ knife solo prepare studio3104@server 
WARNING: No knife configuration file found
Bootstrapping Chef...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
101  6471  101  6471    0     0   6428      0  0:00:01  0:00:01 --:--:-- 33879
Unable to determine platform version!
Please file a bug report at http://tickets.opscode.com
Project: Chef
Component: Packages
Label: Omnibus
Version: 
 
Please detail your operating system type, version and any other relevant details


kinife-solo のソースを覗いてみたところ、https://www.opscode.com/chef/install.sh をダウンロードして実行しているようです。
ので knife-solo の問題、というわけではなさそう。

install.sh を見てみると、77行目で引っかかって、$platform に空文字がセットされてしまってエラーを吐いてるようです。

(中略)
# Retrieve Platform and Platform Version
if [ -f "/etc/lsb-release" ];
then
  platform=$(grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr '[A-Z]' '[a-z]')
  platform_version=$(grep DISTRIB_RELEASE /etc/lsb-release | cut -d "=" -f 2)
(中略)

/etc/lsb-release が存在する CentOS*1 では grep に何も引っかからずです。

とりあえず

バグレポートをあげようと思いましたがそれっぽいのがすでにあがっていたのでそのうち直ると期待。
http://tickets.opscode.com/browse/CHEF-4023

該当する環境で knife solo prepare したい場合は、直接ダウンロードしてこのパッチをあてればちゃんと動きます。
まぁあくまでとりあえずです。

--- install.sh.org      2013-04-08 18:38:13.628954650 +0900
+++ install.sh  2013-04-08 15:37:48.332776214 +0900
@@ -74,11 +74,11 @@
 machine=$(echo -e `uname -m`)
 
 # Retrieve Platform and Platform Version
-if [ -f "/etc/lsb-release" ];
-then
-  platform=$(grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr '[A-Z]' '[a-z]')
-  platform_version=$(grep DISTRIB_RELEASE /etc/lsb-release | cut -d "=" -f 2)
-elif [ -f "/etc/debian_version" ];
+#if [ -f "/etc/lsb-release" ];
+#then
+#  platform=$(grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr '[A-Z]' '[a-z]')
+#  platform_version=$(grep DISTRIB_RELEASE /etc/lsb-release | cut -d "=" -f 2)
+if [ -f "/etc/debian_version" ];
 then
   platform="debian"
   platform_version=$(echo -e `cat /etc/debian_version`)

*1:6.3、6.4のみ確認