0

While trying the following example on chef leaning:

https://learn.chef.io/manage-a-web-app/ubuntu/configure-the-database/

I ran in to an issue with this piece of code

# Create a path to the SQL file in the Chef cache.
create_tables_script_path = File.join(Chef::Config[:file_cache_path], 'create-tables.sql')

The file is not showing up in the location specified:

STDOUT:
       STDERR: sh: /tmp/create-tables.sql: No such file or directory
       ---- End output of mysql -h 127.0.0.1 -u db_admin -pdatabase_password -D my_company < /tmp/create-tables.sql ----

The file does show up in:

/tmp/kitchen/cache

Any ideas on what to tweak?

TyMac
  • 783
  • 2
  • 9
  • 32

1 Answers1

0

I ended up just editing the execute code block below that in the chef learning example to point the the (i guess new default) location:

# Seed the database with a table and test data.
execute 'initialize my_company database' do
  command "mysql -h 127.0.0.1 -u db_admin -p I_luv_flapjacks -D my_company < /tmp/kitchen/cache/create-tables.sql"
  not_if  "mysql -h 127.0.0.1 -u db_admin -p I_luv_flapjacks -D my_company -e 'describe customers;'"
end
TyMac
  • 783
  • 2
  • 9
  • 32