staypuft 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17db35905779581497986043c56782829969ded1
4
- data.tar.gz: 8110916cfe794b3531fd11532e4ff800882aafce
3
+ metadata.gz: 83e1ee0be60733db0950f62e2787bd4d9d12a663
4
+ data.tar.gz: 941b4f0986b8b9ab6ca8ee6099de86b4757a143b
5
5
  SHA512:
6
- metadata.gz: 29f22381981d26709e8c81bbd7505947a4951d48a5508690ef7261bf47afc2662cac7f838b76d140a3fa8980fb9cc605ca73c6204181bc1636e06f4e2777814c
7
- data.tar.gz: ed56ecce9c8713e1a30199c379b96984894c6a15b95ed8d6e036fbf74078d6729d3752bd87164c14bea2f50577154df6bc924faac10011b49456bb04273a6bc8
6
+ metadata.gz: da3b904af0ab6b1dc03af6a54f71443a0703282cb8f26c912cc4abbd6b1fb1c559eeab28f7f5404dd7ba284922760a59081bc5a50f84b4ff90cc4c0eead751f4
7
+ data.tar.gz: 075e84a0bf11038a7662cc2ed9d3e4ebb988141dbd4a980b01eb9d4431dbeef9dcf36808acc30dbe1acc020f8774e5361ea4f3d739bc0f3ca4e237dd7e25b8d8
@@ -10,7 +10,7 @@ module Staypuft
10
10
  included do
11
11
  define_method :fencing do
12
12
  instance_variable_get(:@fencing_config) or
13
- instance_variable_set(:@fencing_config, ::Staypuft::Host::Fencing.new(self))
13
+ instance_variable_set(:@fencing_config, ::Staypuft::Fencing.new(self))
14
14
  end
15
15
 
16
16
  define_method :fencing= do |value|
@@ -0,0 +1,53 @@
1
+ module Staypuft
2
+ class Fencing
3
+ include ActiveModel::Validations
4
+
5
+ FENCING_ATTRS = {
6
+ 'general' => ['fencing_enabled',
7
+ 'fencing_type'],
8
+ 'fence_ipmilan' => ['fence_ipmilan_address',
9
+ 'fence_ipmilan_username',
10
+ 'fence_ipmilan_password',
11
+ 'fence_ipmilan_expose_lanplus',
12
+ 'fence_ipmilan_lanplus_options']
13
+ }
14
+
15
+ validates :fencing_type, :presence => true, :if => Proc.new { |f|
16
+ f.fencing_enabled == '1' &&
17
+ @host.interfaces.any?{ |nic| nic.type == 'Nic::BMC' && !nic.marked_for_destruction? }
18
+ }
19
+
20
+ def initialize(host)
21
+ @host = host
22
+ FENCING_ATTRS.each do |key, attrs|
23
+ attrs.each do |name|
24
+ instance_var_name = :"@#{name}"
25
+ value = host.bmc_nic.attrs[name] if host.bmc_nic && host.bmc_nic.attrs.has_key?(name)
26
+ self.class.send(:define_method, name) do
27
+ instance_variable_get(instance_var_name) or
28
+ instance_variable_set(instance_var_name, value)
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ def update(values)
35
+ values.each do |key, value|
36
+ instance_var_name = :"@#{key}"
37
+ instance_variable_set(instance_var_name, value)
38
+ end
39
+
40
+ bmc_nics = @host.interfaces.select{ |interface| interface.type == "Nic::BMC" }
41
+ return if bmc_nics.empty?
42
+
43
+ bmc_nic = bmc_nics[0]
44
+ bmc_nic.attrs.merge!(values)
45
+ bmc_nic.save
46
+ end
47
+
48
+ # compatibility with validates_associated
49
+ def marked_for_destruction?
50
+ false
51
+ end
52
+ end
53
+ end
@@ -1,3 +1,3 @@
1
1
  module Staypuft
2
- VERSION = '0.3.8'
2
+ VERSION = '0.3.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: staypuft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Staypuft team
@@ -99,6 +99,7 @@ files:
99
99
  - app/controllers/staypuft/interface_assignments_controller.rb
100
100
  - app/controllers/staypuft/steps_controller.rb
101
101
  - app/controllers/staypuft/deployments_controller.rb
102
+ - app/models/staypuft/fencing.rb
102
103
  - app/models/staypuft/service/ui_params.rb
103
104
  - app/models/staypuft/layout_role.rb
104
105
  - app/models/staypuft/interface_assigner.rb
@@ -115,7 +116,6 @@ files:
115
116
  - app/models/staypuft/deployment/passwords.rb
116
117
  - app/models/staypuft/service_class.rb
117
118
  - app/models/staypuft/subnet_type.rb
118
- - app/models/staypuft/host/fencing.rb
119
119
  - app/models/staypuft/layout.rb
120
120
  - app/models/staypuft/concerns/vip_nic_scopes.rb
121
121
  - app/models/staypuft/concerns/hostgroup_extensions.rb
@@ -1,55 +0,0 @@
1
- module Staypuft
2
- module Host
3
- class Fencing
4
- include ActiveModel::Validations
5
-
6
- FENCING_ATTRS = {
7
- 'general' => ['fencing_enabled',
8
- 'fencing_type'],
9
- 'fence_ipmilan' => ['fence_ipmilan_address',
10
- 'fence_ipmilan_username',
11
- 'fence_ipmilan_password',
12
- 'fence_ipmilan_expose_lanplus',
13
- 'fence_ipmilan_lanplus_options']
14
- }
15
-
16
- validates :fencing_type, :presence => true, :if => Proc.new { |f|
17
- f.fencing_enabled == '1' &&
18
- @host.interfaces.any?{ |nic| nic.type == 'Nic::BMC' && !nic.marked_for_destruction? }
19
- }
20
-
21
- def initialize(host)
22
- @host = host
23
- FENCING_ATTRS.each do |key, attrs|
24
- attrs.each do |name|
25
- instance_var_name = :"@#{name}"
26
- value = host.bmc_nic.attrs[name] if host.bmc_nic && host.bmc_nic.attrs.has_key?(name)
27
- self.class.send(:define_method, name) do
28
- instance_variable_get(instance_var_name) or
29
- instance_variable_set(instance_var_name, value)
30
- end
31
- end
32
- end
33
- end
34
-
35
- def update(values)
36
- values.each do |key, value|
37
- instance_var_name = :"@#{key}"
38
- instance_variable_set(instance_var_name, value)
39
- end
40
-
41
- bmc_nics = @host.interfaces.select{ |interface| interface.type == "Nic::BMC" }
42
- return if bmc_nics.empty?
43
-
44
- bmc_nic = bmc_nics[0]
45
- bmc_nic.attrs.merge!(values)
46
- bmc_nic.save
47
- end
48
-
49
- # compatibility with validates_associated
50
- def marked_for_destruction?
51
- false
52
- end
53
- end
54
- end
55
- end