cleanfb 0.2.1.15 → 0.2.1.16
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/lib/cleanfb/version.rb +1 -1
- data/lib/cleanfb.rb +13 -16
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 370081ee67f4323fae0a4d7b9062587f7667b601
|
4
|
+
data.tar.gz: e662e75e235c4c12071276eb8e83f9f5c96db2d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7686159e3736e345c03dd483c11fe398711a54b4230e0704f2c8fd71da9de28db962c27b0858d090175cfa7af45dc1c236d265d93bf37a211cad6f392c048fa5
|
7
|
+
data.tar.gz: 13bdc61276ef2877060cb4532e1142817835a57a979469e68b797e5a4a672e78850fae48330b8da7eb412d84bb0ea77e3adf64baad925f88365709f6bf42113e
|
data/lib/cleanfb/version.rb
CHANGED
data/lib/cleanfb.rb
CHANGED
@@ -6,8 +6,7 @@ module Cleanfb
|
|
6
6
|
|
7
7
|
class Clean
|
8
8
|
|
9
|
-
|
10
|
-
hostname = ""
|
9
|
+
attr_accessor :options = {}
|
11
10
|
|
12
11
|
def show_help
|
13
12
|
puts "HELP"
|
@@ -18,24 +17,22 @@ module Cleanfb
|
|
18
17
|
OptionParser.new do |opts|
|
19
18
|
opts.banner = ""
|
20
19
|
opts.on("-h", "--help", "Display help information") {show_help}
|
21
|
-
opts.on("-f", "--force", "Ignore all prompts") { |f| options[:force] = f }
|
22
|
-
opts.on("-nNAME", "--name=NAME", "Hostname") { |n| hostname = n }
|
20
|
+
opts.on("-f", "--force", "Ignore all prompts") { |f| @options[:force] = f }
|
21
|
+
opts.on("-nNAME", "--name=NAME", "Hostname") { |n| @options[:hostname] = n }
|
23
22
|
end.parse!
|
24
23
|
end
|
25
24
|
|
26
25
|
def remove
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
unless options[:force]
|
31
|
-
print "Remove #{hostname} ? y|n: "
|
27
|
+
unless @options[:force]
|
28
|
+
print "Remove #{@options[:hostname]} ? y|n: "
|
32
29
|
ans = STDIN.gets.chomp
|
33
30
|
end
|
34
31
|
|
35
|
-
if(options[:force] || ans =~ /^y/)
|
36
|
-
cmd = `puppet filebucket list -l|grep -i #{hostname}`
|
32
|
+
if(@options[:force] || ans =~ /^y/)
|
33
|
+
cmd = `puppet filebucket list -l|grep -i #{@options[:hostname]}`
|
37
34
|
|
38
|
-
unless options[:force]
|
35
|
+
unless @options[:force]
|
39
36
|
test = cmd.split(" ").last
|
40
37
|
multi_match = false
|
41
38
|
|
@@ -45,7 +42,7 @@ module Cleanfb
|
|
45
42
|
print "Matched multiple hosts. Remove all? y|n: "
|
46
43
|
ans = STDIN.gets.chomp
|
47
44
|
|
48
|
-
return "Ending run" unless (options[:force] || ans =~/^y/)
|
45
|
+
return "Ending run" unless (@options[:force] || ans =~/^y/)
|
49
46
|
end
|
50
47
|
end
|
51
48
|
|
@@ -76,19 +73,19 @@ module Cleanfb
|
|
76
73
|
cmd = `mv -f #{path}contents /root/saved_configs/#{name}/#{date}_#{time}_#{file}`
|
77
74
|
cmd = `rm -rf #{path}`
|
78
75
|
else
|
79
|
-
puts "No file #{hostname} found."
|
76
|
+
puts "No file #{@options[:hostname]} found."
|
80
77
|
end
|
81
78
|
end
|
82
79
|
end
|
83
80
|
|
84
81
|
else
|
85
|
-
puts "No file #{hostname} found."
|
82
|
+
puts "No file #{@options[:hostname]} found."
|
86
83
|
end
|
87
84
|
|
88
85
|
return
|
89
86
|
end
|
90
87
|
|
91
|
-
def store
|
88
|
+
def store host
|
92
89
|
|
93
90
|
cmd = `puppet filebucket list -l|grep -i #{host}`
|
94
91
|
unless(cmd.nil? || cmd.empty?)
|
@@ -125,7 +122,7 @@ module Cleanfb
|
|
125
122
|
return
|
126
123
|
end
|
127
124
|
|
128
|
-
def restore
|
125
|
+
def restore
|
129
126
|
|
130
127
|
return "Please supply a file" if (ARGV[0].nil? || ARGV[0].empty?)
|
131
128
|
|