cleanfb 0.1.5.0 → 0.2.0.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 +4 -4
- data/exe/cleanfb +6 -1
- data/lib/cleanfb/version.rb +1 -1
- data/lib/cleanfb.rb +48 -1
- 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: 89bb9afdedece34a64562247912640a103e15107
|
4
|
+
data.tar.gz: 4875c18855bd4c88997d3a692fe84242a7e289c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63950e72bb3cd07dffc49a8554814f35b7f014cfef9da9a995fa29ee0b0b5d11db867312dee83bc7066bdbce2336d444694949ea4467d6fd6699922f383935aa
|
7
|
+
data.tar.gz: 54d33fd1e44b4665dc8de0ca895422c5cf24c6132bd66f625ddf25088f6bd5e5529462cdcbb1e3e578237e4fdbadc91e93fcd26547dab340e6e28776bb0bde2b
|
data/exe/cleanfb
CHANGED
@@ -8,7 +8,12 @@ end
|
|
8
8
|
|
9
9
|
cleaner = Cleanfb::Clean.new
|
10
10
|
|
11
|
-
|
11
|
+
unless ARGV.include? "restore"
|
12
|
+
response = cleaner.remove
|
13
|
+
else
|
14
|
+
respone = cleaner.restore
|
15
|
+
end
|
16
|
+
|
12
17
|
unless response.nil? || response.empty? || (response.include? "Please")
|
13
18
|
puts response.magenta
|
14
19
|
else
|
data/lib/cleanfb/version.rb
CHANGED
data/lib/cleanfb.rb
CHANGED
@@ -98,5 +98,52 @@ module Cleanfb
|
|
98
98
|
end
|
99
99
|
return
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
|
+
def restore()
|
103
|
+
|
104
|
+
# return if no args
|
105
|
+
return "Please supply a file" if ARGV[0].nil? || ARGV[0].empty?
|
106
|
+
|
107
|
+
# return the help output if requested
|
108
|
+
if ((ARGV.include? "-h") or (ARGV.include? "--help"))
|
109
|
+
return "Remove backups of an agent from the Puppet master's filebucket.\nBackups are stored at /root/saved_configs/\n\n Usage: cleanfb <client> <options>\n\n options: -h or --help | help and information\n
|
110
|
+
-y | defaults all input to yes\n"
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
arg = ARGV[0]
|
115
|
+
|
116
|
+
# set ans to yes automatically if -y option
|
117
|
+
if !ARGV.nil? and (ARGV.include? "-y") and ARGV.length > 1
|
118
|
+
ans = "y"
|
119
|
+
arg = ARGV[1] if (ARGV.index("-y") == 0)
|
120
|
+
|
121
|
+
# else prompt for answer
|
122
|
+
else
|
123
|
+
print "Restore #{arg} ? y|n: "
|
124
|
+
ans = STDIN.gets.chomp
|
125
|
+
end
|
126
|
+
|
127
|
+
# if yes, retrieve the files and remove them
|
128
|
+
if ans == "y" || ans == "yes"
|
129
|
+
|
130
|
+
file = arg
|
131
|
+
sum = Digest::MD5.file file
|
132
|
+
start = (sum.scan /\w/).join("/")
|
133
|
+
path = "/opt/puppetlabs/puppet/cache/bucket"
|
134
|
+
|
135
|
+
path += "/" + start[0..15] + sum + "/"
|
136
|
+
|
137
|
+
if File.exist? "#{path}/contents"
|
138
|
+
|
139
|
+
puts "Restoring " + path
|
140
|
+
cmd = `mv -f #{file} #{path}contents`
|
141
|
+
else
|
142
|
+
puts "No file #{arg} found."
|
143
|
+
end
|
144
|
+
else
|
145
|
+
puts "No file #{arg} found."
|
146
|
+
end
|
147
|
+
return
|
148
|
+
end
|
102
149
|
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.
|
4
|
+
version: 0.2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lhoffl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|