chef_backup 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e93ff902d1ff9163a4d97186565f789f62b49610a5b8e841724d7e08116e08f8
4
- data.tar.gz: aebb94b9cd8ebcb9fab88e633f4845ca5a54724e07e34563f4bd235b23293054
3
+ metadata.gz: abf3acd4e6bd56e159617ce5fc550b0eca43520bb9a804cac9795ffb86b05c07
4
+ data.tar.gz: 997e7b9b797959b88b5cff52de0d8f5b10ece2fd23098d89e69a7ac67efba21d
5
5
  SHA512:
6
- metadata.gz: 75134c17007ac79e63f88ba436e60e8c76444c9b4520038883dbed88a66fba42415b5cf54f73ee2c12a98d3e5b9c23baf1613d3ce7b53491c7bd07ab3f18553a
7
- data.tar.gz: edeb8933695fd89f768090a02da71fa1a52d08e1f0f7823c4fb6ec82abdbb684f70c2147d3b144e845221261c926f1f963a2122ba33a17647631f6e667c4d502
6
+ metadata.gz: 476e6227c7b64a8fe35467802aca311f5c6c8b80241bb54b21f0ef5d08c40041c218760e965f54798a2806521397c6b272507a7a8f4503c00aafbe3280c7a2e3
7
+ data.tar.gz: b0d905d8893045fe1c3c3b0ee2c43b785d26d122825abf98185e1e492d6e03f479d228895be01b8d74728fdfd14090c29bcb1eafea56e3246f550e163bcbf52e
@@ -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/chef-backup",
16
- "project_name" => "opscode",
17
- "ctl-command" => "chef-server-ctl",
18
- "running_filepath" => "/etc/opscode/chef-server-running.json",
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
@@ -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' => '/etc/opscode/chef-server.rb'
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/opscode"
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/opscode/plugins"
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/opscode/chef-server-plugin.rb", drbd_plugin) unless
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/opscode/drbd/drbd_ready") unless
162
- File.exist?("/var/opt/opscode/drbd/drbd_ready")
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
@@ -1,4 +1,4 @@
1
1
  # ChefBackup module
2
2
  module ChefBackup
3
- VERSION = "0.2.0".freeze
3
+ VERSION = "0.3.0".freeze
4
4
  end
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.2.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: 2021-12-17 00:00:00.000000000 Z
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