cleanfb 0.2.7 → 0.2.8
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 +4 -4
- data/README.md +7 -18
- data/exe/cleanfb +1 -5
- data/lib/cleanfb/version.rb +1 -1
- data/lib/cleanfb.rb +12 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ef2158d35dc60f9b8f6ed22c40137b3b5e36148
|
4
|
+
data.tar.gz: 9aea77568b33d0a77b3346dadfa8166c6f75a488
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dae0ebb759c5774cf7d6ac47c4b9320f1684060827e0124c74978f32dd6409825ff3dffc99fcce0ee6111efa9bef3714aa5a409fe51ef16ac7ca5d43ff2539ab
|
7
|
+
data.tar.gz: 8bd6c70e60fbf465e48fec0612d9c46083909195ea2872519f4e2790c0baf4961b756c4a89acc5aed6a60e37c7300ac18fac4ba9bc703a91cb24cb9c293300ac
|
data/README.md
CHANGED
@@ -6,7 +6,6 @@ This tool is intended to be used alongside a Ruby script, capture_config, that c
|
|
6
6
|
If a configuration is removed from the Puppet node, a new copy is automatically retrieved from the Puppet server's filebucket.
|
7
7
|
|
8
8
|
Cleanfb allows out of date configurations to be backed up on the server and for the Puppet node to capture a current configuration.
|
9
|
-
|
10
9
|
Old configurations can also be restored using cleanfb.
|
11
10
|
|
12
11
|
## Installation
|
@@ -15,39 +14,29 @@ Old configurations can also be restored using cleanfb.
|
|
15
14
|
|
16
15
|
## Usage
|
17
16
|
|
18
|
-
cleanfb [
|
17
|
+
cleanfb [options]
|
19
18
|
|
20
19
|
Backup all files associated with the host on the server's filebucket.
|
21
|
-
-
|
22
|
-
--help
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
Backup all files associated with the host on the server's filebucket,
|
27
|
-
and restore the given configuration file.
|
28
|
-
-y | answer yes to all
|
29
|
-
--help | show help message
|
20
|
+
-f, --force | answer yes to all
|
21
|
+
-h, --help | show help message
|
22
|
+
-n, --name=NAME | the hostname to backup
|
23
|
+
-r, --restore=NAME | the file to restore
|
30
24
|
|
31
25
|
## Updating Configuration
|
32
26
|
|
33
27
|
Clean the configuration for a host
|
34
28
|
|
35
|
-
$ cleanfb hostname
|
29
|
+
$ cleanfb --name=hostname -f
|
36
30
|
|
37
31
|
The configuration is now backed up on the server at /root/saved_configs/hostname/date_time_hostname_configuration.json
|
38
|
-
|
39
32
|
A new configuration will be obtained for the host on the next Puppet run.
|
40
33
|
|
41
|
-
|
42
34
|
## Restoring a previous Configuration
|
43
35
|
|
44
36
|
|
45
37
|
To restore a previous saved configuration issue the following command
|
46
38
|
|
47
|
-
$ cleanfb restore
|
48
|
-
|
39
|
+
$ cleanfb restore --restore=/root/saved_configs/hostname/date_time_host_configuration.json
|
49
40
|
|
50
41
|
The current configuration gets backed up and the selected configuration is restored as the primary configuration.
|
51
|
-
|
52
42
|
The restored configuration will be obtained by the host from the server on the next Puppet run.
|
53
|
-
|
data/exe/cleanfb
CHANGED
@@ -9,11 +9,7 @@ end
|
|
9
9
|
cleaner = Cleanfb::Clean.new
|
10
10
|
cleaner.parse_input
|
11
11
|
|
12
|
-
|
13
|
-
response = cleaner.remove
|
14
|
-
else
|
15
|
-
response = cleaner.restore
|
16
|
-
end
|
12
|
+
response = cleaner.run
|
17
13
|
|
18
14
|
unless response.nil? || response.empty? || (response.include? "Please")
|
19
15
|
puts response.magenta
|
data/lib/cleanfb/version.rb
CHANGED
data/lib/cleanfb.rb
CHANGED
@@ -10,6 +10,16 @@ module Cleanfb
|
|
10
10
|
@hostname = ""
|
11
11
|
@restore = ""
|
12
12
|
|
13
|
+
def run
|
14
|
+
if restore == ""
|
15
|
+
remove
|
16
|
+
elsif restore != ""
|
17
|
+
restore
|
18
|
+
else
|
19
|
+
puts "Invalid input. See cleanfb --help for usage"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
13
23
|
def parse_input
|
14
24
|
OptionParser.new do |opts|
|
15
25
|
opts.banner = "Usage: cleanfb [options]..."
|
@@ -45,17 +55,12 @@ module Cleanfb
|
|
45
55
|
print "Matched multiple hosts. Remove all? (y|n): "
|
46
56
|
ans = STDIN.gets.chomp
|
47
57
|
|
48
|
-
return
|
58
|
+
return unless (@force || ans =~/^y/)
|
49
59
|
end
|
50
60
|
end
|
51
61
|
|
52
62
|
(backup cmd) unless (cmd.nil? || cmd.empty?)
|
53
|
-
|
54
|
-
else
|
55
|
-
puts "No file #{@hostname} found."
|
56
63
|
end
|
57
|
-
|
58
|
-
return
|
59
64
|
end
|
60
65
|
|
61
66
|
def backup cmd
|
@@ -104,10 +109,8 @@ module Cleanfb
|
|
104
109
|
puts "puppet filebucket -l backup #{file}"
|
105
110
|
cmd = `puppet filebucket -l backup #{file}`
|
106
111
|
else
|
107
|
-
puts "No file #{@restore} found."
|
112
|
+
puts "No file #{@restore} found to restore."
|
108
113
|
end
|
109
|
-
|
110
|
-
return
|
111
114
|
end
|
112
115
|
|
113
116
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cleanfb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lhoffl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|