sul-dlss-deprecated / assembly

DEPRECATED: This repo has been merged into common-accessioning
Other
0 stars 1 forks source link

cron from whenever uses ROBOT_ENVIRONMENT=prod instead of production #93

Open ndushay opened 6 years ago

ndushay commented 6 years ago

robots:verify command wasn't working:

[lyberadmin@sul-robots1-prod current]$ ROBOT_ENVIRONMENT=prod bundle exec rake robots:verify
bundler: failed to load command: controller (/home/lyberadmin/common-accessioning/shared/bundle/ruby/2.3.0/bin/controller)
RuntimeError: FileNotFound: config/environments/robots_prod.yml
  /home/lyberadmin/common-accessioning/shared/bundle/ruby/2.3.0/gems/robot-controller-2.1.1/lib/robot-controller/robots.rb:15:in `load'
  /home/lyberadmin/common-accessioning/shared/bundle/ruby/2.3.0/gems/robot-controller-2.1.1/bin/controller:70:in `run'
  /home/lyberadmin/common-accessioning/shared/bundle/ruby/2.3.0/gems/robot-controller-2.1.1/bin/controller:123:in `<top (required)>'
  /home/lyberadmin/common-accessioning/shared/bundle/ruby/2.3.0/bin/controller:22:in `load'
  /home/lyberadmin/common-accessioning/shared/bundle/ruby/2.3.0/bin/controller:22:in `<top (required)>'

because it is looking for config/environments/robots_prod.yml but we had config/environments/robots_production.yml.

Not sure why verify command is going into crontab this way.

Can't figure out why, but deploying these via capistrano creates cron job using "prod" instead of "production" as the ROBOT_ENVIRONMENT. Compare:

# Begin Whenever generated tasks for: assembly_prod
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash -l -c 'cd /home/lyberadmin/assembly/releases/20180619234442 && ROBOT_ENVIRONMENT=prod bundle exec rake robots:verify --silent > log/verify.log 2> log/cron.log'

# End Whenever generated tasks for: assembly_prod

with

# Begin Whenever generated tasks for: item-release_prod
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash -l -c 'cd /home/lyberadmin/item-release/releases/20180618195947 && ROBOT_ENVIRONMENT=production bundle exec rake robots:verify --silent > log/verify.log 2> log/cron.log'

# End Whenever generated tasks for: item-release_prod
ndushay commented 6 years ago

Note that for now, made symlink config/environments/robots_prod.yml which points to config/environments/robots_production.yml and this makes verify command happy, so nagios can be happy, and all the ops and devs can be happy.