cleanfb 0.2.1.16 → 0.2.1.122

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cleanfb/version.rb +1 -1
  3. data/lib/cleanfb.rb +19 -17
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 370081ee67f4323fae0a4d7b9062587f7667b601
4
- data.tar.gz: e662e75e235c4c12071276eb8e83f9f5c96db2d9
3
+ metadata.gz: c8e97bfe9d3804f18b7e531c62511c7c6d06ab5f
4
+ data.tar.gz: f868cc0c89b1d4f1e918b26bda9f16cd73fc7736
5
5
  SHA512:
6
- metadata.gz: 7686159e3736e345c03dd483c11fe398711a54b4230e0704f2c8fd71da9de28db962c27b0858d090175cfa7af45dc1c236d265d93bf37a211cad6f392c048fa5
7
- data.tar.gz: 13bdc61276ef2877060cb4532e1142817835a57a979469e68b797e5a4a672e78850fae48330b8da7eb412d84bb0ea77e3adf64baad925f88365709f6bf42113e
6
+ metadata.gz: 5487df3cc63b0970f91888f80f21d156d3de2f50ea6e6c718d2576f595f1d969ea79d111d96ec9a7e2e1f2eddb660ceb3a383015c59efa30755e29dfd4362c32
7
+ data.tar.gz: 8b13121342737d031c4ec104c22a6b420eca87f860622ff1cc4709399b92e087c0d0de1c547c8d4c7834ea233ff00cbed11293f92eee46d8a7f20d99d225989b
@@ -1,3 +1,3 @@
1
1
  module Cleanfb
2
- VERSION = "0.2.1.16"
2
+ VERSION = "0.2.1.122"
3
3
  end
data/lib/cleanfb.rb CHANGED
@@ -6,7 +6,8 @@ module Cleanfb
6
6
 
7
7
  class Clean
8
8
 
9
- attr_accessor :options = {}
9
+ options = {}
10
+ hostname = ""
10
11
 
11
12
  def show_help
12
13
  puts "HELP"
@@ -17,22 +18,23 @@ module Cleanfb
17
18
  OptionParser.new do |opts|
18
19
  opts.banner = ""
19
20
  opts.on("-h", "--help", "Display help information") {show_help}
20
- opts.on("-f", "--force", "Ignore all prompts") { |f| @options[:force] = f }
21
- opts.on("-nNAME", "--name=NAME", "Hostname") { |n| @options[:hostname] = n }
22
- end.parse!
21
+ opts.on("-f", "--force", "Ignore all prompts") { |f| options[:force] = f }
22
+ opts.on("-nNAME", "--name=NAME", "Hostname") { |n| hostname = n }
23
+ end
23
24
  end
24
25
 
25
- def remove
26
26
 
27
- unless @options[:force]
28
- print "Remove #{@options[:hostname]} ? y|n: "
27
+ def remove()
28
+
29
+ unless options[:force]
30
+ print "Remove #{hostname} ? y|n: "
29
31
  ans = STDIN.gets.chomp
30
32
  end
31
33
 
32
- if(@options[:force] || ans =~ /^y/)
33
- cmd = `puppet filebucket list -l|grep -i #{@options[:hostname]}`
34
+ if(options[:force] || ans =~ /^y/)
35
+ cmd = `puppet filebucket list -l|grep -i #{hostname}`
34
36
 
35
- unless @options[:force]
37
+ unless options[:force]
36
38
  test = cmd.split(" ").last
37
39
  multi_match = false
38
40
 
@@ -42,7 +44,7 @@ module Cleanfb
42
44
  print "Matched multiple hosts. Remove all? y|n: "
43
45
  ans = STDIN.gets.chomp
44
46
 
45
- return "Ending run" unless (@options[:force] || ans =~/^y/)
47
+ return "Ending run" unless (options[:force] || ans =~/^y/)
46
48
  end
47
49
  end
48
50
 
@@ -54,10 +56,10 @@ module Cleanfb
54
56
 
55
57
  start = (sum.scan /\w/).join("/")
56
58
 
59
+ file = line.split(" ")[3].split("/").last
57
60
  name = file.split("_")[0]
58
61
  date = line.split(" ")[1]
59
62
  time = line.split(" ")[2]
60
- file = line.split(" ")[3].split("/").last
61
63
 
62
64
  save_dir = "/root/saved_configs/"
63
65
 
@@ -73,19 +75,19 @@ module Cleanfb
73
75
  cmd = `mv -f #{path}contents /root/saved_configs/#{name}/#{date}_#{time}_#{file}`
74
76
  cmd = `rm -rf #{path}`
75
77
  else
76
- puts "No file #{@options[:hostname]} found."
78
+ puts "No file #{hostname} found."
77
79
  end
78
80
  end
79
81
  end
80
82
 
81
83
  else
82
- puts "No file #{@options[:hostname]} found."
84
+ puts "No file #{hostname} found."
83
85
  end
84
86
 
85
87
  return
86
88
  end
87
89
 
88
- def store host
90
+ def store(host)
89
91
 
90
92
  cmd = `puppet filebucket list -l|grep -i #{host}`
91
93
  unless(cmd.nil? || cmd.empty?)
@@ -94,10 +96,10 @@ module Cleanfb
94
96
  sum = line.split(" ")[0]
95
97
  start = (sum.scan /\w/).join("/")
96
98
 
99
+ file = line.split(" ")[3].split("/").last
97
100
  name = file.split("_")[0]
98
101
  date = line.split(" ")[1]
99
102
  time = line.split(" ")[2]
100
- file = line.split(" ")[3].split("/").last
101
103
 
102
104
  save_dir = "/root/saved_configs/"
103
105
 
@@ -122,7 +124,7 @@ module Cleanfb
122
124
  return
123
125
  end
124
126
 
125
- def restore
127
+ def restore()
126
128
 
127
129
  return "Please supply a file" if (ARGV[0].nil? || ARGV[0].empty?)
128
130
 
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.1.16
4
+ version: 0.2.1.122
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-08 00:00:00.000000000 Z
11
+ date: 2018-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler