chef_backup 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/chef_backup/config.rb +17 -17
- data/lib/chef_backup/data_map.rb +18 -12
- data/lib/chef_backup/deep_merge.rb +145 -0
- data/lib/chef_backup/helpers.rb +46 -10
- data/lib/chef_backup/logger.rb +11 -6
- data/lib/chef_backup/mash.rb +226 -0
- data/lib/chef_backup/runner.rb +17 -21
- data/lib/chef_backup/strategy/backup/custom.rb +1 -2
- data/lib/chef_backup/strategy/backup/ebs.rb +3 -6
- data/lib/chef_backup/strategy/backup/lvm.rb +2 -4
- data/lib/chef_backup/strategy/backup/object.rb +2 -4
- data/lib/chef_backup/strategy/backup/tar.rb +26 -10
- data/lib/chef_backup/strategy/restore/tar.rb +69 -43
- data/lib/chef_backup/strategy.rb +10 -10
- data/lib/chef_backup/version.rb +1 -1
- data/lib/chef_backup.rb +8 -8
- metadata +21 -161
- data/.gitignore +0 -23
- data/.kitchen.yml +0 -30
- data/.rubocop.yml +0 -21
- data/.travis.yml +0 -6
- data/Gemfile +0 -4
- data/Guardfile +0 -22
- data/README.md +0 -21
- data/Rakefile +0 -44
- data/chef_backup.gemspec +0 -33
- data/spec/fixtures/chef-server-running.json +0 -589
- data/spec/spec_helper.rb +0 -98
- data/spec/unit/data_map_spec.rb +0 -59
- data/spec/unit/helpers_spec.rb +0 -88
- data/spec/unit/runner_spec.rb +0 -185
- data/spec/unit/shared_examples/helpers.rb +0 -20
- data/spec/unit/strategy/backup/lvm_spec.rb +0 -0
- data/spec/unit/strategy/backup/shared_examples/backup.rb +0 -92
- data/spec/unit/strategy/backup/tar_spec.rb +0 -327
- data/spec/unit/strategy/restore/lvm_spec.rb +0 -0
- data/spec/unit/strategy/restore/shared_examples/restore.rb +0 -84
- data/spec/unit/strategy/restore/tar_spec.rb +0 -255
- data/spec/unit/strategy_spec.rb +0 -36
data/lib/chef_backup/runner.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
1
|
+
require "fileutils" unless defined?(FileUtils)
|
|
2
|
+
require "pathname" unless defined?(Pathname)
|
|
3
3
|
|
|
4
4
|
module ChefBackup
|
|
5
5
|
# ChefBackup::Runner class initializes the strategy and runs the action
|
|
@@ -7,8 +7,6 @@ module ChefBackup
|
|
|
7
7
|
include ChefBackup::Helpers
|
|
8
8
|
include ChefBackup::Exceptions
|
|
9
9
|
|
|
10
|
-
attr_reader :restore_param
|
|
11
|
-
|
|
12
10
|
#
|
|
13
11
|
# @param running_config [Hash] A hash of the private-chef-running.json
|
|
14
12
|
# or the CLI args for a restore
|
|
@@ -17,7 +15,7 @@ module ChefBackup
|
|
|
17
15
|
#
|
|
18
16
|
def initialize(running_config)
|
|
19
17
|
ChefBackup::Config.config = running_config
|
|
20
|
-
ChefBackup::Logger.logger(service_config[
|
|
18
|
+
ChefBackup::Logger.logger(service_config["backup"]["logfile"] || nil)
|
|
21
19
|
end
|
|
22
20
|
|
|
23
21
|
#
|
|
@@ -47,7 +45,7 @@ module ChefBackup
|
|
|
47
45
|
# @return [String] String name of the configured backup strategy
|
|
48
46
|
#
|
|
49
47
|
def backup_strategy
|
|
50
|
-
service_config[
|
|
48
|
+
service_config["backup"]["strategy"]
|
|
51
49
|
end
|
|
52
50
|
|
|
53
51
|
#
|
|
@@ -55,23 +53,21 @@ module ChefBackup
|
|
|
55
53
|
# or a path to a tarball
|
|
56
54
|
#
|
|
57
55
|
def restore_param
|
|
58
|
-
config[
|
|
56
|
+
config["restore_param"]
|
|
59
57
|
end
|
|
60
58
|
|
|
61
59
|
#
|
|
62
60
|
# @return [String] A path to backup tarball or EBS snapshot ID
|
|
63
61
|
#
|
|
64
62
|
def restore_strategy
|
|
65
|
-
@restore_strategy ||=
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
end
|
|
74
|
-
end
|
|
63
|
+
@restore_strategy ||= if tarball?
|
|
64
|
+
unpack_tarball
|
|
65
|
+
manifest["strategy"]
|
|
66
|
+
elsif ebs_snapshot?
|
|
67
|
+
"ebs"
|
|
68
|
+
else
|
|
69
|
+
raise InvalidStrategy, "#{restore_param} is not a valid backup"
|
|
70
|
+
end
|
|
75
71
|
end
|
|
76
72
|
|
|
77
73
|
#
|
|
@@ -79,7 +75,7 @@ module ChefBackup
|
|
|
79
75
|
#
|
|
80
76
|
def tarball?
|
|
81
77
|
file = Pathname.new(File.expand_path(restore_param))
|
|
82
|
-
file.exist? && file.extname ==
|
|
78
|
+
file.exist? && file.extname == ".tgz"
|
|
83
79
|
end
|
|
84
80
|
|
|
85
81
|
#
|
|
@@ -104,7 +100,7 @@ module ChefBackup
|
|
|
104
100
|
#
|
|
105
101
|
def backup_name
|
|
106
102
|
if tarball?
|
|
107
|
-
Pathname.new(restore_param).basename.sub_ext(
|
|
103
|
+
Pathname.new(restore_param).basename.sub_ext("").to_s
|
|
108
104
|
elsif ebs_snapshot?
|
|
109
105
|
restore_param
|
|
110
106
|
end
|
|
@@ -117,7 +113,7 @@ module ChefBackup
|
|
|
117
113
|
# @return [String] A path to the restore directory
|
|
118
114
|
#
|
|
119
115
|
def restore_directory
|
|
120
|
-
config[
|
|
116
|
+
config["restore_dir"] ||= begin
|
|
121
117
|
dir_name = File.join(tmp_dir, backup_name)
|
|
122
118
|
if File.directory?(dir_name)
|
|
123
119
|
# clean restore directory if it exists
|
|
@@ -135,7 +131,7 @@ module ChefBackup
|
|
|
135
131
|
def manifest
|
|
136
132
|
@manifest ||= begin
|
|
137
133
|
file = "#{restore_directory}/manifest.json"
|
|
138
|
-
ensure_file!(file, InvalidTarball,
|
|
134
|
+
ensure_file!(file, InvalidTarball, "No manifest found in tarball")
|
|
139
135
|
JSON.parse(File.read(file))
|
|
140
136
|
end
|
|
141
137
|
end
|
|
@@ -17,12 +17,9 @@ class ChefBackup::Strategy::EbsBackup < ChefBackup::Strategy::TarBackup
|
|
|
17
17
|
cleanup
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def verify_ebs
|
|
21
|
-
end
|
|
20
|
+
def verify_ebs; end
|
|
22
21
|
|
|
23
|
-
def take_ebs_snapshot
|
|
24
|
-
end
|
|
22
|
+
def take_ebs_snapshot; end
|
|
25
23
|
|
|
26
|
-
def copy_opscode_config
|
|
27
|
-
end
|
|
24
|
+
def copy_opscode_config; end
|
|
28
25
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require 'fileutils'
|
|
2
2
|
require 'json'
|
|
3
3
|
require 'time'
|
|
4
|
-
require 'highline/import'
|
|
5
4
|
|
|
6
5
|
# rubocop:disable IndentationWidth
|
|
7
6
|
module ChefBackup
|
|
@@ -56,8 +55,7 @@ class TarBackup
|
|
|
56
55
|
cmd = [chpst,
|
|
57
56
|
"-u #{pg_user}",
|
|
58
57
|
pg_dumpall,
|
|
59
|
-
"> #{sql_file}"
|
|
60
|
-
].join(' ')
|
|
58
|
+
"> #{sql_file}"].join(' ')
|
|
61
59
|
log "Dumping Postgresql database to #{sql_file}"
|
|
62
60
|
shell_out!(cmd, env: ["PGOPTIONS=#{pg_options}"])
|
|
63
61
|
data_map.services['postgresql']['pg_dump_success'] = true
|
|
@@ -85,11 +83,24 @@ class TarBackup
|
|
|
85
83
|
data_map.add_config(config, "/etc/#{config}")
|
|
86
84
|
end
|
|
87
85
|
|
|
86
|
+
populate_versions
|
|
87
|
+
|
|
88
88
|
# Don't forget the upgrades!
|
|
89
89
|
if service_config.key?('upgrades')
|
|
90
90
|
data_map.add_service('upgrades', service_config['upgrades']['dir'])
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
+
add_ha_services
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def populate_versions
|
|
97
|
+
project_names.each do |project|
|
|
98
|
+
path = File.join(addon_install_dir(project), '/version-manifest.json')
|
|
99
|
+
data_map.add_version(project, version_from_manifest_file(path))
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def add_ha_services
|
|
93
104
|
if ha? && !config_only?
|
|
94
105
|
data_map.add_service('keepalived', service_config['keepalived']['dir'])
|
|
95
106
|
data_map.add_ha_info('provider', service_config['ha']['provider'])
|
|
@@ -108,12 +119,12 @@ class TarBackup
|
|
|
108
119
|
end
|
|
109
120
|
end
|
|
110
121
|
|
|
111
|
-
DEFAULT_STATEFUL_SERVICES = %w
|
|
122
|
+
DEFAULT_STATEFUL_SERVICES = %w[rabbitmq
|
|
112
123
|
opscode-solr4
|
|
113
124
|
elasticsearch
|
|
114
125
|
redis_lb
|
|
115
126
|
postgresql
|
|
116
|
-
bookshelf
|
|
127
|
+
bookshelf].freeze
|
|
117
128
|
|
|
118
129
|
def stateful_services
|
|
119
130
|
if service_config.key?('drbd') && service_config['drbd']['enable'] == true
|
|
@@ -129,6 +140,10 @@ class TarBackup
|
|
|
129
140
|
[project_name] + enabled_addons.keys
|
|
130
141
|
end
|
|
131
142
|
|
|
143
|
+
def project_names
|
|
144
|
+
([project_name] + enabled_addons.keys).uniq
|
|
145
|
+
end
|
|
146
|
+
|
|
132
147
|
# The data_map is a working record of all of the data that is backed up.
|
|
133
148
|
def data_map
|
|
134
149
|
@data_map ||= ChefBackup::DataMap.new do |data|
|
|
@@ -150,7 +165,7 @@ class TarBackup
|
|
|
150
165
|
if backend? && !config_only?
|
|
151
166
|
if !online?
|
|
152
167
|
ask_to_go_offline unless offline_permission_granted?
|
|
153
|
-
stop_chef_server(except: [
|
|
168
|
+
stop_chef_server(except: %i[keepalived postgresql])
|
|
154
169
|
dump_db
|
|
155
170
|
stop_service(:postgresql)
|
|
156
171
|
stopped = true
|
|
@@ -165,7 +180,7 @@ class TarBackup
|
|
|
165
180
|
cleanup
|
|
166
181
|
log 'Backup Complete!'
|
|
167
182
|
rescue => e
|
|
168
|
-
log "Something
|
|
183
|
+
log "Something went terribly wrong, aborting backup", :error
|
|
169
184
|
log e.message, :error
|
|
170
185
|
cleanup
|
|
171
186
|
start_chef_server
|
|
@@ -181,7 +196,7 @@ class TarBackup
|
|
|
181
196
|
Dir["#{tmp_dir}/*"].map { |f| File.basename(f) }.join(' ')
|
|
182
197
|
].join(' ').strip
|
|
183
198
|
|
|
184
|
-
res = shell_out(cmd, cwd: tmp_dir)
|
|
199
|
+
res = shell_out!(cmd, cwd: tmp_dir)
|
|
185
200
|
res
|
|
186
201
|
end
|
|
187
202
|
|
|
@@ -189,7 +204,7 @@ class TarBackup
|
|
|
189
204
|
log "Exporting tarball to #{export_dir}"
|
|
190
205
|
cmd = "rsync -chaz #{tmp_dir}/#{export_filename} #{export_dir}/"
|
|
191
206
|
|
|
192
|
-
res = shell_out(cmd)
|
|
207
|
+
res = shell_out!(cmd)
|
|
193
208
|
res
|
|
194
209
|
end
|
|
195
210
|
|
|
@@ -228,7 +243,8 @@ class TarBackup
|
|
|
228
243
|
msg << 'continuing. You can skip this message by passing a "--yes" '
|
|
229
244
|
msg << 'argument. Do you wish to proceed? (y/N):'
|
|
230
245
|
|
|
231
|
-
|
|
246
|
+
require "tty-prompt" unless defined?(TTY::Prompt)
|
|
247
|
+
exit(1) unless TTY::Prompt.new(interrupt: :exit).ask(msg) =~ /^y/i
|
|
232
248
|
end
|
|
233
249
|
end
|
|
234
250
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
4
|
-
require
|
|
1
|
+
require "fileutils" unless defined?(FileUtils)
|
|
2
|
+
require "pathname" unless defined?(Pathname)
|
|
3
|
+
require "forwardable" unless defined?(Forwardable)
|
|
4
|
+
require "chef_backup/deep_merge"
|
|
5
5
|
|
|
6
6
|
# rubocop:disable IndentationWidth
|
|
7
7
|
module ChefBackup
|
|
@@ -11,7 +11,7 @@ class TarRestore
|
|
|
11
11
|
# rubocop:enable IndentationWidth
|
|
12
12
|
include ChefBackup::Helpers
|
|
13
13
|
include ChefBackup::Exceptions
|
|
14
|
-
include
|
|
14
|
+
include ChefBackup::Mixin::DeepMerge
|
|
15
15
|
extend Forwardable
|
|
16
16
|
|
|
17
17
|
attr_accessor :tarball_path
|
|
@@ -21,14 +21,16 @@ class TarRestore
|
|
|
21
21
|
|
|
22
22
|
def initialize(path)
|
|
23
23
|
@tarball_path = path
|
|
24
|
-
@log = ChefBackup::Logger.logger(service_config[
|
|
24
|
+
@log = ChefBackup::Logger.logger(service_config["backup"]["logfile"] || nil)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def restore
|
|
28
|
-
log
|
|
29
|
-
|
|
28
|
+
log "Restoring Chef Server from backup"
|
|
29
|
+
return unless check_manifest_version
|
|
30
|
+
|
|
31
|
+
cleanse_chef_server(config["agree_to_cleanse"])
|
|
30
32
|
if ha?
|
|
31
|
-
log
|
|
33
|
+
log "Performing HA restore - please ensure that keepalived is not running on the standby host"
|
|
32
34
|
fix_ha_plugins
|
|
33
35
|
check_ha_volume
|
|
34
36
|
touch_drbd_ready
|
|
@@ -44,64 +46,63 @@ class TarRestore
|
|
|
44
46
|
reconfigure_add_ons
|
|
45
47
|
restart_add_ons
|
|
46
48
|
cleanup
|
|
47
|
-
log
|
|
49
|
+
log "Restoration Completed!"
|
|
48
50
|
end
|
|
49
51
|
|
|
50
52
|
def manifest
|
|
51
53
|
@manifest ||= begin
|
|
52
|
-
manifest = File.expand_path(File.join(ChefBackup::Config[
|
|
53
|
-
|
|
54
|
+
manifest = File.expand_path(File.join(ChefBackup::Config["restore_dir"],
|
|
55
|
+
"manifest.json"))
|
|
54
56
|
ensure_file!(manifest, InvalidManifest, "#{manifest} not found")
|
|
55
57
|
JSON.parse(File.read(manifest))
|
|
56
58
|
end
|
|
57
59
|
end
|
|
58
60
|
|
|
59
61
|
def restore_db_dump?
|
|
60
|
-
manifest[
|
|
62
|
+
manifest["services"]["postgresql"]["pg_dump_success"] && !frontend?
|
|
61
63
|
rescue NoMethodError
|
|
62
64
|
false
|
|
63
65
|
end
|
|
64
66
|
|
|
65
67
|
def import_db
|
|
66
|
-
start_service(
|
|
67
|
-
sql_file = File.join(ChefBackup::Config[
|
|
68
|
-
|
|
68
|
+
start_service("postgresql")
|
|
69
|
+
sql_file = File.join(ChefBackup::Config["restore_dir"],
|
|
70
|
+
"chef_backup-#{manifest["backup_time"]}.sql")
|
|
69
71
|
ensure_file!(sql_file, InvalidDatabaseDump, "#{sql_file} not found")
|
|
70
72
|
|
|
71
73
|
cmd = [chpst,
|
|
72
|
-
"-u #{manifest[
|
|
74
|
+
"-u #{manifest["services"]["postgresql"]["username"]}",
|
|
73
75
|
pgsql,
|
|
74
|
-
"-U #{manifest[
|
|
76
|
+
"-U #{manifest["services"]["postgresql"]["username"]}",
|
|
75
77
|
"-d #{database_name}",
|
|
76
|
-
"< #{sql_file}"
|
|
77
|
-
|
|
78
|
-
log 'Importing Database dump'
|
|
78
|
+
"< #{sql_file}"].join(" ")
|
|
79
|
+
log "Importing Database dump"
|
|
79
80
|
shell_out!(cmd, env: ["PGOPTIONS=#{pg_options}"])
|
|
80
81
|
end
|
|
81
82
|
|
|
82
83
|
def restore_services
|
|
83
|
-
manifest.key?(
|
|
84
|
+
manifest.key?("services") && manifest["services"].keys.each do |service|
|
|
84
85
|
restore_data(:services, service)
|
|
85
86
|
end
|
|
86
87
|
end
|
|
87
88
|
|
|
88
89
|
def restore_configs
|
|
89
|
-
manifest.key?(
|
|
90
|
+
manifest.key?("configs") && manifest["configs"].keys.each do |config|
|
|
90
91
|
restore_data(:configs, config)
|
|
91
92
|
end
|
|
92
93
|
end
|
|
93
94
|
|
|
94
95
|
def touch_sentinel
|
|
95
|
-
dir =
|
|
96
|
-
sentinel = File.join(dir,
|
|
96
|
+
dir = "/var/opt/opscode"
|
|
97
|
+
sentinel = File.join(dir, "bootstrapped")
|
|
97
98
|
FileUtils.mkdir_p(dir) unless File.directory?(dir)
|
|
98
|
-
File.open(sentinel,
|
|
99
|
+
File.open(sentinel, "w") { |file| file.write "bootstrapped!" }
|
|
99
100
|
end
|
|
100
101
|
|
|
101
102
|
def restore_data(type, name)
|
|
102
|
-
source = File.expand_path(File.join(config[
|
|
103
|
-
|
|
104
|
-
destination = manifest[type.to_s][name][
|
|
103
|
+
source = File.expand_path(File.join(config["restore_dir"],
|
|
104
|
+
manifest[type.to_s][name]["data_dir"]))
|
|
105
|
+
destination = manifest[type.to_s][name]["data_dir"]
|
|
105
106
|
FileUtils.mkdir_p(destination) unless File.directory?(destination)
|
|
106
107
|
cmd = "rsync -chaz --delete #{source}/ #{destination}"
|
|
107
108
|
log "Restoring the #{name} data"
|
|
@@ -109,22 +110,42 @@ class TarRestore
|
|
|
109
110
|
end
|
|
110
111
|
|
|
111
112
|
def backup_name
|
|
112
|
-
@backup_name ||= Pathname.new(tarball_path).basename.sub_ext(
|
|
113
|
+
@backup_name ||= Pathname.new(tarball_path).basename.sub_ext("").to_s
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def check_manifest_version
|
|
117
|
+
unless manifest["versions"]
|
|
118
|
+
log "no version information in manifest"
|
|
119
|
+
return true
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
manifest["versions"].each_pair do |name, data|
|
|
123
|
+
installed = version_from_manifest_file(data["path"])
|
|
124
|
+
|
|
125
|
+
if installed == :no_version
|
|
126
|
+
log "Warning: #{name} @ #{data["version"]} not installed"
|
|
127
|
+
elsif installed["version"] != data["version"]
|
|
128
|
+
log "package #{name} #{installed["version"]} installed, but backup was"\
|
|
129
|
+
" from #{data["version"]}. Please install correct version, restore, then upgrade."
|
|
130
|
+
return false
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
true
|
|
113
134
|
end
|
|
114
135
|
|
|
115
136
|
def fix_ha_plugins
|
|
116
|
-
log
|
|
117
|
-
plugins_dir =
|
|
118
|
-
drbd_plugin = File.join(plugins_dir,
|
|
137
|
+
log "Fixing HA plugins directory (https://github.com/chef/chef-server/issues/115)"
|
|
138
|
+
plugins_dir = "/var/opt/opscode/plugins"
|
|
139
|
+
drbd_plugin = File.join(plugins_dir, "chef-ha-drbd.rb")
|
|
119
140
|
|
|
120
141
|
FileUtils.mkdir_p(plugins_dir) unless Dir.exist?(plugins_dir)
|
|
121
|
-
FileUtils.ln_sf(
|
|
142
|
+
FileUtils.ln_sf("/opt/opscode/chef-server-plugin.rb", drbd_plugin) unless
|
|
122
143
|
File.exist?(drbd_plugin)
|
|
123
144
|
end
|
|
124
145
|
|
|
125
146
|
def check_ha_volume
|
|
126
|
-
log
|
|
127
|
-
ha_data_dir = manifest[
|
|
147
|
+
log "Checking that the HA storage volume is mounted"
|
|
148
|
+
ha_data_dir = manifest["ha"]["path"]
|
|
128
149
|
|
|
129
150
|
unless ha_data_dir_mounted?(ha_data_dir)
|
|
130
151
|
raise "Please mount the data directory #{ha_data_dir} and perform any DRBD configuration before continuing"
|
|
@@ -132,23 +153,28 @@ class TarRestore
|
|
|
132
153
|
end
|
|
133
154
|
|
|
134
155
|
def ha_data_dir_mounted?(ha_data_dir)
|
|
135
|
-
File.read(
|
|
156
|
+
File.read("/proc/mounts").split("\n").grep(/#{ha_data_dir}/).count > 0
|
|
136
157
|
end
|
|
137
158
|
|
|
138
159
|
def touch_drbd_ready
|
|
139
|
-
log
|
|
140
|
-
FileUtils.touch(
|
|
141
|
-
File.exist?(
|
|
160
|
+
log "Touching drbd_ready file"
|
|
161
|
+
FileUtils.touch("/var/opt/opscode/drbd/drbd_ready") unless
|
|
162
|
+
File.exist?("/var/opt/opscode/drbd/drbd_ready")
|
|
142
163
|
end
|
|
143
164
|
|
|
144
165
|
def reconfigure_server
|
|
145
|
-
log
|
|
166
|
+
log "Reconfiguring the Chef Server"
|
|
146
167
|
shell_out("#{ctl_command} reconfigure")
|
|
147
168
|
end
|
|
148
169
|
|
|
149
170
|
def cleanse_chef_server(agree)
|
|
150
|
-
log
|
|
151
|
-
|
|
171
|
+
log "Cleaning up any old files"
|
|
172
|
+
# The chef-server-ctl cleanse command deliberately waits 60 seconds to give
|
|
173
|
+
# you an option to cancel it. Therefore, don't count it in the timeout that
|
|
174
|
+
# the user provided. If the user has eagerly dismissed that wait period,
|
|
175
|
+
# then don't elongate the timeout. The user can do this with the -c flag.
|
|
176
|
+
timeout = shell_timeout + (agree ? 0 : 60) if shell_timeout
|
|
177
|
+
shell_out!("#{ctl_command} cleanse #{agree || ""}", "timeout" => timeout)
|
|
152
178
|
end
|
|
153
179
|
|
|
154
180
|
def running_config
|
data/lib/chef_backup/strategy.rb
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
#
|
|
3
3
|
# All Rights Reserved
|
|
4
4
|
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
require
|
|
9
|
-
require
|
|
10
|
-
require
|
|
11
|
-
require
|
|
12
|
-
require
|
|
13
|
-
require
|
|
14
|
-
require
|
|
5
|
+
require "chef_backup/strategy/backup/tar"
|
|
6
|
+
require "chef_backup/strategy/backup/lvm"
|
|
7
|
+
require "chef_backup/strategy/backup/ebs"
|
|
8
|
+
require "chef_backup/strategy/backup/object"
|
|
9
|
+
require "chef_backup/strategy/backup/custom"
|
|
10
|
+
require "chef_backup/strategy/restore/tar"
|
|
11
|
+
require "chef_backup/strategy/restore/lvm"
|
|
12
|
+
require "chef_backup/strategy/restore/ebs"
|
|
13
|
+
require "chef_backup/strategy/restore/object"
|
|
14
|
+
require "chef_backup/strategy/restore/custom"
|
|
15
15
|
|
|
16
16
|
module ChefBackup
|
|
17
17
|
# ChefBackup::Strategy factory returns an ChefBackup::Strategy object
|
data/lib/chef_backup/version.rb
CHANGED
data/lib/chef_backup.rb
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
#
|
|
3
3
|
# All Rights Reserved
|
|
4
4
|
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
require
|
|
9
|
-
require
|
|
10
|
-
require
|
|
11
|
-
require
|
|
12
|
-
require
|
|
5
|
+
require "chef_backup/version"
|
|
6
|
+
require "chef_backup/exceptions"
|
|
7
|
+
require "chef_backup/config"
|
|
8
|
+
require "chef_backup/logger"
|
|
9
|
+
require "chef_backup/data_map"
|
|
10
|
+
require "chef_backup/helpers"
|
|
11
|
+
require "chef_backup/runner"
|
|
12
|
+
require "chef_backup/strategy"
|