dust-deploy 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/changelog.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Changelog
2
2
  =============
3
3
 
4
+ 0.2.3
5
+ ------------
6
+
7
+ - improved iptables rule sorting, several minor improvements
8
+
9
+
4
10
  0.2.2
5
11
  ------------
6
12
 
@@ -7,7 +7,7 @@ class Debsecan < Thor
7
7
  ::Dust.print_msg 'configuring debsecan'
8
8
 
9
9
  # if config is simply set to "true", use defaults
10
- config = {} unless config.class == Hash
10
+ config = {} unless config.is_a? Hash
11
11
 
12
12
  # setting default config variables (unless already set)
13
13
  config['report'] ||= false
@@ -63,7 +63,7 @@ class Iptables < Thor
63
63
  rule['protocol'] ||= ['tcp'] if rule['dport'] or rule['sport']
64
64
 
65
65
  # convert non-array variables to array, so we won't get hickups when using .each and .combine
66
- rule.each { |k, v| rule[k] = [ rule[k] ] if rule[k].class != Array }
66
+ rule.each { |k, v| rule[k] = [ rule[k] ] unless rule[k].is_a? Array }
67
67
 
68
68
  next unless check_ipversion rule, ipv
69
69
 
@@ -164,17 +164,30 @@ class Iptables < Thor
164
164
  # make sure the options are sorted in a way that works.
165
165
  sorted = []
166
166
  result.each do |r|
167
- # bring to the front
168
- r = r.sort_by { |x| if x.include? '--match' then -1 else 1 end }
169
- r = r.sort_by { |x| if x.include? '--protocol' then -1 else 1 end }
170
- # shift to the end
171
- r = r.sort_by { |x| if x.include? '--jump' then 1 else -1 end }
172
- r = r.sort_by { |x| if x.include? '--to-port' then 1 else -1 end }
173
- r = r.sort_by { |x| if x.include? '--to-destination' then 1 else -1 end }
174
- r = r.sort_by { |x| if x.include? '--to-source' then 1 else -1 end }
175
- r = r.sort_by { |x| if x.include? '--ttl-set' then 1 else -1 end }
176
- r = r.sort_by { |x| if x.include? '--clamp-mss-to-pmtu' then 1 else -1 end }
177
- r = r.sort_by { |x| if x.include? '--reject-with' then 1 else -1 end }
167
+ # sort rules so it makes sense
168
+ r = r.sort_by do |x|
169
+ if x.include? '--match'
170
+ -1
171
+ elsif x.include? '--protocol'
172
+ -2
173
+ elsif x.include? '--jump'
174
+ 1
175
+ elsif x.include? '--to-port'
176
+ 2
177
+ elsif x.include? '--to-destination'
178
+ 3
179
+ elsif x.include? '--to-source'
180
+ 4
181
+ elsif x.include? '--ttl-set'
182
+ 5
183
+ elsif x.include? '--clamp-mss-to-pmtu'
184
+ 6
185
+ elsif x.include? '--reject-with'
186
+ 7
187
+ else
188
+ 0
189
+ end
190
+ end
178
191
  sorted.push r
179
192
  end
180
193
 
@@ -11,7 +11,7 @@ class Repositories < Thor
11
11
  puts
12
12
 
13
13
  # if repo is present but not a hash use defaults
14
- repo = {} unless repo.class == Hash
14
+ repo = {} unless repo.is_a? Hash
15
15
 
16
16
  # setting defaults
17
17
  repo['url'] ||= 'http://ftp.debian.org/debian/' if node.is_debian? true
@@ -4,7 +4,7 @@ class ResolvConf < Thor
4
4
  ::Dust.print_msg "configuring resolv.conf\n"
5
5
 
6
6
  # if config is just true, create empty hash and use defaults
7
- config = {} unless config.class == Hash
7
+ config = {} unless config.is_a? Hash
8
8
 
9
9
  # setting default config variables (unless already set)
10
10
  config['nameservers'] ||= [ '208.67.222.222', '208.67.220.220' ] # opendns
@@ -6,7 +6,7 @@ class UnattendedUpgrades < Thor
6
6
  return unless node.uses_apt?
7
7
  node.install_package 'unattended-upgrades'
8
8
 
9
- config = {} unless config.class == Hash
9
+ config = {} unless config.is_a? Hash
10
10
 
11
11
  # set defaults for non-set config
12
12
  config['enable'] ||= 1
data/lib/dust/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dust
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 2
9
- version: 0.2.2
8
+ - 3
9
+ version: 0.2.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - kris kechagia
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-01-05 00:00:00 +01:00
17
+ date: 2012-01-08 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency