Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import/export dump with configurable filesystem location #160

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions cookbooks/block_device/libraries/block_device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
# http://www.rightscale.com/terms.php and, if applicable, other agreements
# such as a RightScale Master Subscription Agreement.

begin
require 'rightscale_tools'
rescue LoadError
Chef::Log.warn("Missing gem 'rightscale_tools'")
end

require 'rightscale_tools'

module RightScale
module BlockDeviceHelper
Expand Down
2 changes: 2 additions & 0 deletions cookbooks/block_device/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

rightscale_marker

include_recipe "rightscale::install_tools"

class Chef::Recipe
include RightScale::BlockDeviceHelper
end
Expand Down
3 changes: 3 additions & 0 deletions cookbooks/db/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
# Database driver class to be used based on the type of driver
default[:db][:client][:driver] = ""

# Database import/export dump temp location
default[:db][:dump][:location] = '/tmp'

# Server state variables
#
# Default value for DB status
Expand Down
875 changes: 446 additions & 429 deletions cookbooks/db/metadata.json

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions cookbooks/db/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,23 @@
:display_name => "Import/export settings for database dump file management.",
:type => "hash"

attribute 'db/dump/location',
:display_name => 'Database Dump Location',
:description => 'The location where database dumps for import and export will' +
'be stored temporarily. Set to the desired location, ensuring the filesystem' +
'the folder resides in has enough space.',
:required => 'optional',
:choice => [
'/tmp',
'/mnt/ephemeral',
'/mnt/storage'
],
:default => '/tmp',
:recipes => [
"db::do_dump_import",
"db::do_dump_export"
]

attribute "db/dump/storage_account_provider",
:display_name => "Dump Storage Account Provider",
:description =>
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/db/recipes/do_dump_export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# Set up all db/dump/* attributes
dumpfilename = node[:db][:dump][:prefix] + "-" + Time.now.strftime("%Y%m%d%H%M") + ".gz"
dumpfilepath = "/tmp/#{dumpfilename}"
dumpfilepath = "#{node[:db][:dump][:location]}/#{dumpfilename}"

databasename = node[:db][:dump][:database_name]

Expand Down
2 changes: 1 addition & 1 deletion cookbooks/db/recipes/do_dump_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Chef::Resource::RubyBlock

db_name = node[:db][:dump][:database_name]
prefix = node[:db][:dump][:prefix]
dumpfilepath_without_extension = "/tmp/" + prefix
dumpfilepath_without_extension = "#{node[:db][:dump][:location]}/" + prefix
container = node[:db][:dump][:container]
cloud = node[:db][:dump][:storage_account_provider]
command_to_execute = "/opt/rightscale/sandbox/bin/ros_util get" +
Expand Down