cleanfb 0.2.1.122 → 0.2.2.1

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