Skip to content

Instantly share code, notes, and snippets.

@pcn
Created May 13, 2013 20:28
Show Gist options
  • Select an option

  • Save pcn/5571233 to your computer and use it in GitHub Desktop.

Select an option

Save pcn/5571233 to your computer and use it in GitHub Desktop.
Cron resource breaks on chef-solo version 10.24.0
# The resource fails with the commented-out section, but succeeds with the uncommented section:
# Save the nodetool gossipinfo to syslog periodically. This is to identify
# ghost nodes if we replace one.
cron "log_gossip_info" do
minute "18"
hour "3,9,15,21"
# command <<EOF
# nodetool -h0 gossipinfo | awk '{ if($0 ~ /^\//) printf("\n%s", $0) ; else printf("%s", $0) ; } | logger -p \
local1.info -t nodetool_gossipinfo
# EOF
command <<EOF
nodetool -h0 gossipinfo | logger -p local1.info -t nodetool_gossipinfo
EOF
I'm getting this error:
* Stopping Tomcat servlet engine tomcat6
...done.
* Starting Tomcat servlet engine tomcat6
...done.
[2013-05-13T20:03:07+00:00] INFO: execute[restart_tomcat_if_broken] ran successfully
[2013-05-13T20:03:07+00:00] INFO: Processing execute[restore_cassandra] action run (cassandra::priam_server line 365)
[2013-05-13T20:03:07+00:00] INFO: Processing cron[log_cluster_state] action create (cassandra::priam_server line 376)
[2013-05-13T20:03:08+00:00] INFO: cron[log_cluster_state] added crontab entry
[2013-05-13T20:03:08+00:00] INFO: Processing cron[log_gossip_info] action create (cassandra::priam_server line 386)
================================================================================
Error executing action `create` on resource 'cron[log_gossip_info]'
================================================================================
Chef::Exceptions::Cron
----------------------
Error updating state of log_gossip_info, exit: 1
Resource Declaration:
---------------------
# In /var/tmp/knewton/chef-solo/site-cookbooks/cassandra/recipes/priam_server.rb
386: cron "log_gossip_info" do
387: minute "18"
388: hour "3,9,15,21"
389: command <<EOF
390: nodetool -h0 gossipinfo | awk '{ if($0 ~ /^\//) printf("\n%s", $0) ; else printf("%s", $0) ; } | logger -p local1.info -t nodetool_gossipinfo
391: EOF
392: end
393:
Compiled Resource:
------------------
# Declared in /var/tmp/knewton/chef-solo/site-cookbooks/cassandra/recipes/priam_server.rb:386:in `from_file'
cron("log_gossip_info") do
action :create
retries 0
retry_delay 2
minute "18"
hour "3,9,15,21"
day "*"
month "*"
weekday "*"
command "nodetool -h0 gossipinfo | awk '{ if($0 ~ /^//) printf(\"\n%s\", $0) ; else printf(\"%s\", $0) ; } | logger -p local1.info -t nodetool_gossipinfo\n"
user "root"
cookbook_name :cassandra
recipe_name "priam_server"
end
[2013-05-13T20:03:08+00:00] ERROR: Running exception handlers
[2013-05-13T20:03:08+00:00] INFO: Exception caught: Log Collection Exception Handler is now running.
[2013-05-13T20:03:08+00:00] INFO: Log tarball_name generated: PN-Cassandra_2013-05-13__20_03
[2013-05-13T20:03:08+00:00] INFO: Collecting the following logs: /var/log/chef/ /var/tmp/knewton/chef-solo/chef-stacktrace.out /var/log/cfn-init.log /var/log/knewton/
[2013-05-13T20:03:08+00:00] INFO: Posting logs to s3://knewton-deploy-failure-logs/PN-Cassandra_2013-05-13__20_03.tar.gz
[2013-05-13T20:03:08+00:00] INFO: Chef run failed, sending CFN signal
[2013-05-13T20:03:08+00:00] INFO: Sending failure signal to CloudFormation for chef[cassandra]@i-402f3023
[2013-05-13T20:03:09+00:00] INFO: CloudFormation signaled successfully with FAILURE.
[2013-05-13T20:03:09+00:00] ERROR: Exception handlers complete
[2013-05-13T20:03:09+00:00] FATAL: Stacktrace dumped to /var/tmp/knewton/chef-solo/chef-stacktrace.out
[2013-05-13T20:03:09+00:00] FATAL: Chef::Exceptions::Cron: cron[log_gossip_info] (cassandra::priam_server line 386) had an error: Chef::Exceptions::Cron: Error updating state of log_gossip_info, exit: 1
@pcn

pcn commented May 13, 2013

Copy link
Copy Markdown
Author

And the answer is probably to escape the %. Turns out this wasn't tested/in use yet as I thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment