chef_backup 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef_backup/config.rb +5 -4
- data/lib/chef_backup/helpers.rb +2 -1
- data/lib/chef_backup/strategy/restore/tar.rb +6 -5
- data/lib/chef_backup/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abf3acd4e6bd56e159617ce5fc550b0eca43520bb9a804cac9795ffb86b05c07
|
4
|
+
data.tar.gz: 997e7b9b797959b88b5cff52de0d8f5b10ece2fd23098d89e69a7ac67efba21d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 476e6227c7b64a8fe35467802aca311f5c6c8b80241bb54b21f0ef5d08c40041c218760e965f54798a2806521397c6b272507a7a8f4503c00aafbe3280c7a2e3
|
7
|
+
data.tar.gz: b0d905d8893045fe1c3c3b0ee2c43b785d26d122825abf98185e1e492d6e03f479d228895be01b8d74728fdfd14090c29bcb1eafea56e3246f550e163bcbf52e
|
data/lib/chef_backup/config.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "fileutils" unless defined?(FileUtils)
|
2
2
|
require "json" unless defined?(JSON)
|
3
3
|
require "forwardable" unless defined?(Forwardable)
|
4
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
4
5
|
|
5
6
|
module ChefBackup
|
6
7
|
# ChefBackup Global Config
|
@@ -12,10 +13,10 @@ module ChefBackup
|
|
12
13
|
"backup" => {
|
13
14
|
"always_dump_db" => true,
|
14
15
|
"strategy" => "none",
|
15
|
-
"export_dir" => "/var/opt
|
16
|
-
"project_name" =>
|
17
|
-
"ctl-command" =>
|
18
|
-
"running_filepath" => "/etc
|
16
|
+
"export_dir" => "/var/opt/#{ChefUtils::Dist::Infra::SHORT}-backup",
|
17
|
+
"project_name" => ChefUtils::Dist::Org::LEGACY_CONF_DIR,
|
18
|
+
"ctl-command" => ChefUtils::Dist::Server::SERVER_CTL,
|
19
|
+
"running_filepath" => "/etc/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}/#{ChefUtils::Dist::Server::SERVER}-running.json",
|
19
20
|
"database_name" => "opscode_chef",
|
20
21
|
},
|
21
22
|
}.freeze
|
data/lib/chef_backup/helpers.rb
CHANGED
@@ -3,6 +3,7 @@ require 'json'
|
|
3
3
|
require 'mixlib/shellout'
|
4
4
|
require 'chef_backup/config'
|
5
5
|
require 'chef_backup/logger'
|
6
|
+
require 'chef-utils/dist'
|
6
7
|
|
7
8
|
# rubocop:disable ModuleLength
|
8
9
|
# rubocop:disable IndentationWidth
|
@@ -29,7 +30,7 @@ module Helpers
|
|
29
30
|
'ctl_command' => 'opscode-analytics-ctl'
|
30
31
|
},
|
31
32
|
'chef-ha' => {
|
32
|
-
'config_file' =>
|
33
|
+
'config_file' => "/etc/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}/#{ChefUtils::Dist::Server::SERVER}.rb"
|
33
34
|
},
|
34
35
|
'chef-sync' => {
|
35
36
|
'config_file' => '/etc/chef-sync/chef-sync.rb',
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "fileutils" unless defined?(FileUtils)
|
2
2
|
require "pathname" unless defined?(Pathname)
|
3
3
|
require "forwardable" unless defined?(Forwardable)
|
4
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
4
5
|
require "chef_backup/deep_merge"
|
5
6
|
|
6
7
|
# rubocop:disable IndentationWidth
|
@@ -93,7 +94,7 @@ class TarRestore
|
|
93
94
|
end
|
94
95
|
|
95
96
|
def touch_sentinel
|
96
|
-
dir = "/var/opt
|
97
|
+
dir = "/var/opt/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}"
|
97
98
|
sentinel = File.join(dir, "bootstrapped")
|
98
99
|
FileUtils.mkdir_p(dir) unless File.directory?(dir)
|
99
100
|
File.open(sentinel, "w") { |file| file.write "bootstrapped!" }
|
@@ -135,11 +136,11 @@ class TarRestore
|
|
135
136
|
|
136
137
|
def fix_ha_plugins
|
137
138
|
log "Fixing HA plugins directory (https://github.com/chef/chef-server/issues/115)"
|
138
|
-
plugins_dir = "/var/opt/
|
139
|
+
plugins_dir = "/var/opt/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}/plugins"
|
139
140
|
drbd_plugin = File.join(plugins_dir, "chef-ha-drbd.rb")
|
140
141
|
|
141
142
|
FileUtils.mkdir_p(plugins_dir) unless Dir.exist?(plugins_dir)
|
142
|
-
FileUtils.ln_sf("/opt/
|
143
|
+
FileUtils.ln_sf("/opt/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}/chef-server-plugin.rb", drbd_plugin) unless
|
143
144
|
File.exist?(drbd_plugin)
|
144
145
|
end
|
145
146
|
|
@@ -158,8 +159,8 @@ class TarRestore
|
|
158
159
|
|
159
160
|
def touch_drbd_ready
|
160
161
|
log "Touching drbd_ready file"
|
161
|
-
FileUtils.touch("/var/opt/
|
162
|
-
File.exist?("/var/opt/
|
162
|
+
FileUtils.touch("/var/opt/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}/drbd/drbd_ready") unless
|
163
|
+
File.exist?("/var/opt/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}/drbd/drbd_ready")
|
163
164
|
end
|
164
165
|
|
165
166
|
def reconfigure_server
|
data/lib/chef_backup/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef_backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0.21'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: chef-utils
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 16.5.54
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 16.5.54
|
61
75
|
description: A library to backup a Chef Server
|
62
76
|
email:
|
63
77
|
- oss@chef.io
|