chef_backup 0.1.1 → 0.2.0.pre1
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 +3 -3
- data/lib/chef_backup/data_map.rb +1 -1
- data/lib/chef_backup/logger.rb +10 -5
- data/lib/chef_backup/runner.rb +10 -12
- data/lib/chef_backup/strategy/backup/tar.rb +2 -2
- data/lib/chef_backup/strategy/restore/tar.rb +3 -3
- metadata +21 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51de6280ecd6ede16153afcfb70d6fcfa508e76dfa48dea7858d5d5fcc4be278
|
4
|
+
data.tar.gz: a358070ef671054bda4e8b21bc6e6bb51fb915b31bded0567d4c717731fff0c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbc70201b088ac22f49d34cfb6114eebfe62f8b2f8cca7fd3beb5255b54df77dddcdc76287f3474f284532b387a9297c8659c4eaf5c5a50444536579c7e98354
|
7
|
+
data.tar.gz: 96e4e39b9d0083c81a0ba2dbf009f32545e027aa5a5a5f0f3beb91eb34f7fae0a17f9493e1c766979ec73719ee5104c28aae8fa59d739141ba9d49a64d6aa805
|
data/lib/chef_backup/config.rb
CHANGED
data/lib/chef_backup/data_map.rb
CHANGED
data/lib/chef_backup/logger.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require "highline"
|
2
|
-
|
3
1
|
module ChefBackup
|
4
2
|
# Basic Logging Class
|
5
3
|
class Logger
|
@@ -16,17 +14,24 @@ module ChefBackup
|
|
16
14
|
|
17
15
|
def initialize(logfile = nil)
|
18
16
|
$stdout = logfile ? File.open(logfile, "ab") : $stdout
|
19
|
-
|
17
|
+
end
|
18
|
+
|
19
|
+
# pastel.decorate is a lightweight replacement for highline.color
|
20
|
+
def pastel
|
21
|
+
@pastel ||= begin
|
22
|
+
require "pastel" unless defined?(Pastel)
|
23
|
+
Pastel.new
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
def log(msg, level = :info)
|
23
28
|
case level
|
24
29
|
when :warn
|
25
30
|
msg = "WARNING: #{msg}"
|
26
|
-
$stdout.puts(color? ?
|
31
|
+
$stdout.puts(color? ? pastel.decorate(msg, :yellow) : msg)
|
27
32
|
when :error
|
28
33
|
msg = "ERROR: #{msg}"
|
29
|
-
$stdout.puts(color? ?
|
34
|
+
$stdout.puts(color? ? pastel.decorate(msg, :red) : msg)
|
30
35
|
else
|
31
36
|
$stdout.puts(msg)
|
32
37
|
end
|
data/lib/chef_backup/runner.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
require "pathname"
|
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
|
@@ -60,16 +60,14 @@ module ChefBackup
|
|
60
60
|
# @return [String] A path to backup tarball or EBS snapshot ID
|
61
61
|
#
|
62
62
|
def restore_strategy
|
63
|
-
@restore_strategy ||=
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
72
|
-
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
|
73
71
|
end
|
74
72
|
|
75
73
|
#
|
@@ -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
|
@@ -244,7 +243,8 @@ class TarBackup
|
|
244
243
|
msg << 'continuing. You can skip this message by passing a "--yes" '
|
245
244
|
msg << 'argument. Do you wish to proceed? (y/N):'
|
246
245
|
|
247
|
-
|
246
|
+
require "tty-prompt" unless defined?(TTY::Prompt)
|
247
|
+
exit(1) unless TTY::Prompt.new(interrupt: :exit).ask(msg) =~ /^y/i
|
248
248
|
end
|
249
249
|
end
|
250
250
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
require "pathname"
|
3
|
-
require "forwardable"
|
1
|
+
require "fileutils" unless defined?(FileUtils)
|
2
|
+
require "pathname" unless defined?(Pathname)
|
3
|
+
require "forwardable" unless defined?(Forwardable)
|
4
4
|
require "chef_backup/deep_merge"
|
5
5
|
|
6
6
|
# rubocop:disable IndentationWidth
|
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.2.0.pre1
|
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: 2021-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -31,25 +31,33 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '4.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: pastel
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '1.6'
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
39
|
+
version: '0'
|
43
40
|
type: :runtime
|
44
41
|
prerelease: false
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: tty-prompt
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
46
50
|
requirements:
|
47
51
|
- - "~>"
|
48
52
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
50
|
-
|
53
|
+
version: '0.21'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
51
59
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
60
|
+
version: '0.21'
|
53
61
|
description: A library to backup a Chef Server
|
54
62
|
email:
|
55
63
|
- oss@chef.io
|
@@ -94,11 +102,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
102
|
version: '0'
|
95
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
104
|
requirements:
|
97
|
-
- - "
|
105
|
+
- - ">"
|
98
106
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
107
|
+
version: 1.3.1
|
100
108
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.1.6
|
102
110
|
signing_key:
|
103
111
|
specification_version: 4
|
104
112
|
summary: A library to backup a Chef Server
|