Skip to content

Instantly share code, notes, and snippets.

@vignesh-v3
Created December 4, 2016 09:27
Show Gist options
  • Save vignesh-v3/42960030a34df8f263b0aff52cc11cf5 to your computer and use it in GitHub Desktop.
Save vignesh-v3/42960030a34df8f263b0aff52cc11cf5 to your computer and use it in GitHub Desktop.
Recipe: hwk::masterslave
* cookbook_file[/etc/mysql/my.cnf] action create (up to date)
* execute[refresh mysql] action run
- execute sudo service mysql restart
* cookbook_file[/tmp/master.sh] action create
- update content in file /tmp/master.sh from 4bcd5c to bfb0e9
--- /tmp/master.sh 2016-12-04 09:15:24.164434654 +0000
+++ /tmp/.chef-master20161204-23389-xen7ra.sh 2016-12-04 09:25:05.392434654 +0000
@@ -2,8 +2,8 @@
mysql -e "FLUSH PRIVILEGES;"
-USE newdatabase;
-FLUSH TABLES WITH READ LOCK;
-UNLOCK TABLES;
-QUIT;
+mysql -e "USE newdatabase;"
+mysql -e "FLUSH TABLES WITH READ LOCK;"
+mysql -e "UNLOCK TABLES;"
+mysql -e "QUIT;"
* execute[run the bash script] action run
================================================================================
Error executing action `run` on resource 'execute[run the bash script]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of su -c /tmp/master.sh root ----
STDOUT:
STDERR: /tmp/master.sh: line 3: $'\r': command not found
/tmp/master.sh: line 4: $'\r': command not found
ERROR 1049 (42000) at line 1: Unknown database 'newdatabase'
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'QUIT' at line 1
---- End output of su -c /tmp/master.sh root ----
Ran su -c /tmp/master.sh root returned 1
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/hwk/recipes/masterslave.rb
17: execute 'run the bash script' do
18: command "su -c /tmp/master.sh root"
19: end
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/hwk/recipes/masterslave.rb:17:in `from_file'
execute("run the bash script") do
action [:run]
retries 0
retry_delay 2
default_guard_interpreter :execute
command "su -c /tmp/master.sh root"
backup 5
returns 0
declared_type :execute
cookbook_name "hwk"
recipe_name "masterslave"
end
Platform:
---------
x86_64-linux
Running handlers:
[2016-12-04T09:25:05+00:00] ERROR: Running exception handlers
Running handlers complete
[2016-12-04T09:25:05+00:00] ERROR: Exception handlers complete
Chef Client failed. 6 resources updated in 15 seconds
[2016-12-04T09:25:05+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2016-12-04T09:25:05+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-12-04T09:25:05+00:00] ERROR: execute[run the bash script] (hwk::masterslave line 17) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of su -c /tmp/master.sh root ----
STDOUT:
STDERR: /tmp/master.sh: line 3: $'\r': command not found
/tmp/master.sh: line 4: $'\r': command not found
ERROR 1049 (42000) at line 1: Unknown database 'newdatabase'
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'QUIT' at line 1
---- End output of su -c /tmp/master.sh root ----
Ran su -c /tmp/master.sh root returned 1
[2016-12-04T09:25:05+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Converge failed on instance <default-ubuntu-1404>. Please see .kitchen/logs/default-ubuntu-1404.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment