Help us understand the problem. What is going on with this article?

wheneverをupdateしたらopsworksのデプロイフックでコマンドが通らなくなった時の取り急ぎの対応

More than 3 years have passed since last update.

wheneverをupdateして0.9.4になったらopsworksのデプロイフックでコマンドが通らなくなった。

具体的にはbundle exec whenever -wを実行すると以下のエラーがでた。

/home/deploy/.bundler/【app名】/ruby/2.1.0/gems/whenever-0.9.4/lib/whenever/numeric_seconds.rb:12:in `gsub': invalid byte sequence in US-ASCII (ArgumentError)

ちょっと調べてみると以下の記事にLC_ALLLANGを設定すると動くよ〜という記述を発見
http://shiro-16.hatenablog.com/entry/2015/02/17/000715
※ このページ内で「invalid byte」で検索すると該当箇所がわかります。

なので、デプロイフックのソースを以下の様に修正

env = node[:deploy][【app名】][:rails_env]
current_release = release_path

execute "whenever -w" do
  cwd current_release
  command "bundle exec whenever -w"
  environment(
      'RAILS_ENV' => env
  )
end

env = node[:deploy][【app名】][:rails_env]
current_release = release_path

execute "whenever -w" do
  cwd current_release
  command "bundle exec whenever -w"
  environment(
      'RAILS_ENV' => env,
      'LANG' => 'ja_JP.UTF-8',
      'LC_ALL' => 'ja_JP.UTF-8'
  )
end

これでエラーなく通った!

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away