corl 0.5.5 → 0.5.6
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 +7 -7
- data/README.rdoc +586 -21
- data/VERSION +1 -1
- data/bootstrap/os/ubuntu/05_ruby.sh +1 -1
- data/corl.gemspec +4 -4
- data/lib/CORL/provisioner/puppetnode.rb +2 -2
- data/lib/core/plugin/fog_machine.rb +2 -0
- data/lib/core/plugin/node.rb +1 -1
- data/lib/core/util/puppet/resource.rb +75 -74
- data/lib/core/util/puppet/resource_group.rb +51 -49
- data/lib/core/util/puppet.rb +20 -12
- data/lib/nucleon/action/node/image.rb +18 -16
- data/lib/nucleon/action/node/provision.rb +5 -3
- data/locales/en.yml +21 -0
- metadata +151 -112
data/lib/core/plugin/node.rb
CHANGED
@@ -896,7 +896,7 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
896
896
|
|
897
897
|
admin_command = ''
|
898
898
|
if as_admin
|
899
|
-
admin_command = config.delete(:admin_command, 'sudo -i')
|
899
|
+
admin_command = config.delete(:admin_command, 'sudo -i')
|
900
900
|
admin_command = extension_set(:admin_command, admin_command, config)
|
901
901
|
else
|
902
902
|
config.delete(:admin_command)
|
@@ -3,101 +3,102 @@ module CORL
|
|
3
3
|
module Util
|
4
4
|
module Puppet
|
5
5
|
class Resource < Core
|
6
|
-
|
6
|
+
|
7
7
|
include Mixin::SubConfig
|
8
|
-
|
8
|
+
|
9
9
|
#-----------------------------------------------------------------------------
|
10
10
|
# Constructor / Destructor
|
11
|
-
|
11
|
+
|
12
12
|
def initialize(group, info, title, properties = {})
|
13
13
|
super({
|
14
14
|
:group => group,
|
15
15
|
:title => string(title),
|
16
16
|
:info => symbol_map(hash(info)),
|
17
17
|
:ready => false
|
18
|
-
})
|
19
|
-
|
18
|
+
}, {}, true, true, false)
|
19
|
+
|
20
|
+
import(properties)
|
20
21
|
end
|
21
|
-
|
22
|
+
|
22
23
|
#-----------------------------------------------------------------------------
|
23
24
|
# Property accessors / modifiers
|
24
|
-
|
25
|
+
|
25
26
|
def group
|
26
27
|
return _get(:group)
|
27
28
|
end
|
28
|
-
|
29
|
+
|
29
30
|
#---
|
30
|
-
|
31
|
+
|
31
32
|
def info(default = {})
|
32
33
|
return hash(_get(:info, default))
|
33
34
|
end
|
34
|
-
|
35
|
+
|
35
36
|
#---
|
36
|
-
|
37
|
+
|
37
38
|
def info=info
|
38
39
|
_set(:info, hash(info))
|
39
40
|
end
|
40
|
-
|
41
|
+
|
41
42
|
#---
|
42
|
-
|
43
|
+
|
43
44
|
def title(default = '')
|
44
45
|
return string(_get(:title, default))
|
45
46
|
end
|
46
|
-
|
47
|
+
|
47
48
|
#---
|
48
|
-
|
49
|
+
|
49
50
|
def title=info
|
50
51
|
_set(:title, string(info))
|
51
52
|
end
|
52
|
-
|
53
|
+
|
53
54
|
#---
|
54
|
-
|
55
|
+
|
55
56
|
def ready(default = false)
|
56
57
|
return test(_get(:ready, default))
|
57
58
|
end
|
58
|
-
|
59
|
+
|
59
60
|
#---
|
60
|
-
|
61
|
+
|
61
62
|
def defaults(defaults, options = {})
|
62
63
|
super(defaults, options)
|
63
|
-
|
64
|
+
|
64
65
|
_set(:ready, false)
|
65
|
-
return self
|
66
|
+
return self
|
66
67
|
end
|
67
68
|
|
68
69
|
#---
|
69
|
-
|
70
|
+
|
70
71
|
def import(properties, options = {})
|
71
72
|
super(properties, options)
|
72
|
-
|
73
|
+
|
73
74
|
_set(:ready, false)
|
74
|
-
return self
|
75
|
+
return self
|
75
76
|
end
|
76
|
-
|
77
|
+
|
77
78
|
#-----------------------------------------------------------------------------
|
78
79
|
# Resource operations
|
79
|
-
|
80
|
+
|
80
81
|
def ensure_ready(options = {})
|
81
82
|
unless ready
|
82
83
|
process(options)
|
83
84
|
end
|
84
85
|
end
|
85
|
-
|
86
|
+
|
86
87
|
#---
|
87
|
-
|
88
|
+
|
88
89
|
def process(options = {})
|
89
90
|
config = Config.ensure(options)
|
90
|
-
|
91
|
+
|
91
92
|
tag(config[:tag])
|
92
93
|
render(config)
|
93
94
|
translate(config)
|
94
|
-
|
95
|
+
|
95
96
|
_set(:ready, true) # Ready for resource creation
|
96
97
|
return self
|
97
98
|
end
|
98
|
-
|
99
|
+
|
99
100
|
#---
|
100
|
-
|
101
|
+
|
101
102
|
def tag(tags, append = true)
|
102
103
|
unless Data.empty?(tags)
|
103
104
|
if tags.is_a?(String)
|
@@ -106,145 +107,145 @@ class Resource < Core
|
|
106
107
|
tags = tags.flatten
|
107
108
|
end
|
108
109
|
resource_tags = get(:tag)
|
109
|
-
|
110
|
+
|
110
111
|
if ! resource_tags || ! append
|
111
112
|
set(:tag, tags)
|
112
113
|
else
|
113
114
|
tags.each do |tag|
|
114
|
-
resource_tags << tag unless resource_tags.include?(tag)
|
115
|
+
resource_tags << tag unless resource_tags.include?(tag)
|
115
116
|
end
|
116
117
|
set(:tag, resource_tags)
|
117
118
|
end
|
118
119
|
end
|
119
120
|
return self
|
120
121
|
end
|
121
|
-
|
122
|
+
|
122
123
|
#---
|
123
|
-
|
124
|
+
|
124
125
|
def self.render(resource_info, options = {})
|
125
126
|
resource = string_map(resource_info)
|
126
127
|
config = Config.ensure(options)
|
127
|
-
|
128
|
+
|
128
129
|
resource.keys.each do |name|
|
129
130
|
if match = name.to_s.match(/^(.+)_template$/)
|
130
131
|
target = match.captures[0]
|
131
|
-
|
132
|
+
|
132
133
|
config.set(:normalize_template, config.get("normalize_#{target}", true))
|
133
134
|
config.set(:interpolate_template, config.get("interpolate_#{target}", true))
|
134
|
-
|
135
|
+
|
135
136
|
input_data = resource[target]
|
136
137
|
resource[target] = CORL.template(config, resource[name]).render(input_data)
|
137
|
-
|
138
|
+
|
138
139
|
if config.get(:debug, false)
|
139
140
|
CORL.ui.info("\n", { :prefix => false })
|
140
141
|
CORL.ui_group("#{resource[name]} template", :cyan) do |ui|
|
141
142
|
ui.info("-----------------------------------------------------")
|
142
|
-
|
143
|
+
|
143
144
|
source_dump = Console.blue(Data.to_json(input_data, true))
|
144
|
-
value_render = Console.green(resource[target])
|
145
|
-
|
145
|
+
value_render = Console.green(resource[target])
|
146
|
+
|
146
147
|
ui.info("Data:\n#{source_dump}")
|
147
148
|
ui.info("Rendered:\n#{value_render}")
|
148
|
-
ui.info("\n", { :prefix => false })
|
149
|
+
ui.info("\n", { :prefix => false })
|
149
150
|
end
|
150
151
|
end
|
151
|
-
resource.delete(name)
|
152
|
+
resource.delete(name)
|
152
153
|
end
|
153
154
|
end
|
154
|
-
return resource
|
155
|
+
return resource
|
155
156
|
end
|
156
|
-
|
157
|
+
|
157
158
|
#---
|
158
159
|
|
159
160
|
def render(options = {})
|
160
161
|
resource = self.class.render(export, options)
|
161
162
|
clear
|
162
|
-
import(Config.ensure(resource).export, options)
|
163
|
+
import(Config.ensure(resource).export, options)
|
163
164
|
return self
|
164
165
|
end
|
165
|
-
|
166
|
+
|
166
167
|
#---
|
167
|
-
|
168
|
+
|
168
169
|
def translate(options = {})
|
169
170
|
config = Config.ensure(options)
|
170
|
-
|
171
|
+
|
171
172
|
set(:before, translate_resource_refs(get(:before), config)) if get(:before)
|
172
173
|
set(:notify, translate_resource_refs(get(:notify), config)) if get(:notify)
|
173
|
-
set(:require, translate_resource_refs(get(:require), config)) if get(:require)
|
174
|
+
set(:require, translate_resource_refs(get(:require), config)) if get(:require)
|
174
175
|
set(:subscribe, translate_resource_refs(get(:subscribe), config)) if get(:subscribe)
|
175
|
-
|
176
|
+
|
176
177
|
return self
|
177
178
|
end
|
178
179
|
|
179
180
|
#-----------------------------------------------------------------------------
|
180
181
|
# Utilities
|
181
|
-
|
182
|
+
|
182
183
|
def translate_resource_refs(resource_refs, options = {})
|
183
184
|
return :undef if Data.undef?(resource_refs)
|
184
|
-
|
185
|
+
|
185
186
|
config = Config.ensure(options)
|
186
187
|
resource_names = config.get(:resource_names, {})
|
187
188
|
title_prefix = config.get(:title_prefix, '')
|
188
|
-
|
189
|
+
|
189
190
|
title_pattern = config.get(:title_pattern, '^\s*([^\[\]]+)\s*$')
|
190
191
|
title_group = config.get(:title_var_group, 1)
|
191
192
|
title_flags = config.get(:title_flags, '')
|
192
193
|
title_regexp = Regexp.new(title_pattern, title_flags.split(''))
|
193
|
-
|
194
|
-
allow_single = config.get(:allow_single_return, true)
|
195
|
-
|
194
|
+
|
195
|
+
allow_single = config.get(:allow_single_return, true)
|
196
|
+
|
196
197
|
type_name = info[:name].sub(/^\@?\@/, '')
|
197
198
|
values = []
|
198
|
-
|
199
|
+
|
199
200
|
composite_resources = group.composite_resources
|
200
|
-
|
201
|
+
|
201
202
|
case resource_refs
|
202
203
|
when String
|
203
204
|
if resource_refs.empty?
|
204
|
-
return :undef
|
205
|
+
return :undef
|
205
206
|
else
|
206
207
|
resource_refs = resource_refs.split(/\s*,\s*/)
|
207
208
|
end
|
208
|
-
|
209
|
+
|
209
210
|
when ::Puppet::Resource
|
210
|
-
resource_refs = [ resource_refs ]
|
211
|
+
resource_refs = [ resource_refs ]
|
211
212
|
end
|
212
|
-
|
213
|
+
|
213
214
|
resource_refs.collect! do |value|
|
214
215
|
if value.is_a?(::Puppet::Resource) || ! value.to_s.match(title_regexp)
|
215
216
|
value.to_s
|
216
|
-
|
217
|
-
elsif resource_names.has_key?(value.
|
217
|
+
|
218
|
+
elsif resource_names.has_key?(value.to_sym)
|
218
219
|
if ! title_prefix.empty?
|
219
220
|
"#{title_prefix}_#{value}"
|
220
221
|
else
|
221
222
|
value.to_s
|
222
223
|
end
|
223
|
-
|
224
|
+
|
224
225
|
elsif composite_resources.has_key?(value.to_sym) && ! composite_resources[value.to_sym].empty?
|
225
226
|
results = []
|
226
227
|
composite_resources[value.to_sym].each do |resource_name|
|
227
228
|
unless title_prefix.empty?
|
228
229
|
resource_name = "#{title_prefix}_#{resource_name}"
|
229
230
|
end
|
230
|
-
results << resource_name
|
231
|
+
results << resource_name
|
231
232
|
end
|
232
233
|
results
|
233
|
-
|
234
|
+
|
234
235
|
else
|
235
236
|
nil
|
236
|
-
end
|
237
|
+
end
|
237
238
|
end
|
238
|
-
|
239
|
+
|
239
240
|
resource_refs.flatten.each do |ref|
|
240
|
-
unless ref.nil?
|
241
|
+
unless ref.nil?
|
241
242
|
unless ref.is_a?(::Puppet::Resource)
|
242
243
|
ref = ref.match(title_regexp) ? ::Puppet::Resource.new(type_name, ref) : ::Puppet::Resource.new(ref)
|
243
244
|
end
|
244
245
|
values << ref unless ref.nil?
|
245
246
|
end
|
246
247
|
end
|
247
|
-
|
248
|
+
|
248
249
|
return values[0] if allow_single && values.length == 1
|
249
250
|
return values
|
250
251
|
end
|
@@ -3,81 +3,82 @@ module CORL
|
|
3
3
|
module Util
|
4
4
|
module Puppet
|
5
5
|
class ResourceGroup < Core
|
6
|
-
|
6
|
+
|
7
7
|
include Mixin::SubConfig
|
8
|
-
|
8
|
+
|
9
9
|
#-----------------------------------------------------------------------------
|
10
10
|
# Constructor / Destructor
|
11
|
-
|
11
|
+
|
12
12
|
def initialize(type_info, default = {})
|
13
13
|
super({
|
14
14
|
:info => hash(type_info),
|
15
15
|
:default => symbol_map(hash(default))
|
16
|
-
})
|
16
|
+
}, {}, true, true, false)
|
17
|
+
|
17
18
|
self.resources = {}
|
18
19
|
end
|
19
|
-
|
20
|
+
|
20
21
|
#---
|
21
|
-
|
22
|
+
|
22
23
|
def inspect
|
23
24
|
"#{self.class}#{info.to_s}[#{composite_resources.keys.length}]"
|
24
25
|
end
|
25
|
-
|
26
|
+
|
26
27
|
#-----------------------------------------------------------------------------
|
27
28
|
# Property accessors / modifiers
|
28
|
-
|
29
|
+
|
29
30
|
def info(default = {})
|
30
31
|
return hash(_get(:info, default))
|
31
32
|
end
|
32
|
-
|
33
|
+
|
33
34
|
#---
|
34
|
-
|
35
|
+
|
35
36
|
def info=info
|
36
37
|
_set(:info, hash(info))
|
37
38
|
end
|
38
|
-
|
39
|
+
|
39
40
|
#---
|
40
|
-
|
41
|
+
|
41
42
|
def default(default = {})
|
42
43
|
return hash(_get(:default, default))
|
43
44
|
end
|
44
|
-
|
45
|
+
|
45
46
|
#---
|
46
|
-
|
47
|
+
|
47
48
|
def default=default
|
48
49
|
_set(:default, symbol_map(hash(default)))
|
49
50
|
end
|
50
|
-
|
51
|
+
|
51
52
|
#---
|
52
|
-
|
53
|
+
|
53
54
|
def resources(default = {})
|
54
55
|
return hash(_get(:resources, default))
|
55
56
|
end
|
56
|
-
|
57
|
+
|
57
58
|
#---
|
58
|
-
|
59
|
+
|
59
60
|
def resources=resources
|
60
61
|
_set(:resources, symbol_map(hash(resources)))
|
61
62
|
end
|
62
|
-
|
63
|
+
|
63
64
|
#---
|
64
|
-
|
65
|
+
|
65
66
|
def composite_resources(default = {})
|
66
67
|
return hash(_get(:composite_resources, default))
|
67
68
|
end
|
68
|
-
|
69
|
+
|
69
70
|
#---
|
70
|
-
|
71
|
+
|
71
72
|
def composite_resources=resources
|
72
73
|
_set(:composite_resources, symbol_map(hash(resources)))
|
73
74
|
end
|
74
|
-
|
75
|
+
|
75
76
|
#---
|
76
|
-
|
77
|
+
|
77
78
|
def add(resources, options = {})
|
78
|
-
config = Config.ensure(options)
|
79
|
-
resources = normalize(info[:name], resources
|
80
|
-
|
79
|
+
config = Config.ensure(options)
|
80
|
+
resources = normalize(info[:name], Data.clone(resources), config)
|
81
|
+
|
81
82
|
unless Data.empty?(resources)
|
82
83
|
collection = self.resources
|
83
84
|
resources.each do |title, resource|
|
@@ -88,21 +89,21 @@ class ResourceGroup < Core
|
|
88
89
|
end
|
89
90
|
return self
|
90
91
|
end
|
91
|
-
|
92
|
+
|
92
93
|
#---
|
93
|
-
|
94
|
+
|
94
95
|
def add_composite_resource(name, resource_names)
|
95
96
|
name = name.to_sym
|
96
|
-
composite = self.composite_resources
|
97
|
+
composite = self.composite_resources
|
97
98
|
composite[name] = [] unless composite[name].is_a?(Array)
|
98
|
-
|
99
|
+
|
99
100
|
unless resource_names.is_a?(Array)
|
100
101
|
resource_names = [ resource_names ]
|
101
102
|
end
|
102
|
-
|
103
|
+
|
103
104
|
resource_names.each do |r_name|
|
104
105
|
r_name = r_name.to_sym
|
105
|
-
|
106
|
+
|
106
107
|
unless composite[name].include?(r_name)
|
107
108
|
composite[name] << r_name
|
108
109
|
end
|
@@ -113,44 +114,45 @@ class ResourceGroup < Core
|
|
113
114
|
|
114
115
|
#-----------------------------------------------------------------------------
|
115
116
|
# Resource operations
|
116
|
-
|
117
|
+
|
117
118
|
def normalize(type_name, resources, options = {})
|
118
119
|
self.composite_resources = {}
|
119
|
-
|
120
|
+
|
120
121
|
config = Config.ensure(options)
|
121
122
|
resources = Data.value(resources)
|
122
|
-
|
123
|
+
|
123
124
|
unless Data.empty?(resources)
|
124
125
|
resource_names = {}
|
125
|
-
|
126
|
+
|
126
127
|
resources.keys.each do |name|
|
127
128
|
if ! resources[name] || resources[name].empty? || ! resources[name].is_a?(Hash)
|
128
129
|
resources.delete(name)
|
129
130
|
else
|
130
131
|
normalize = true
|
131
|
-
|
132
|
+
|
132
133
|
namevar = Puppet.namevar(type_name, name)
|
134
|
+
|
133
135
|
if resources[name].has_key?(namevar)
|
134
136
|
value = resources[name][namevar]
|
135
137
|
if Data.empty?(value)
|
136
138
|
resources.delete(name)
|
137
139
|
normalize = false
|
138
|
-
|
140
|
+
|
139
141
|
elsif value.is_a?(Array)
|
140
142
|
value.each do |item|
|
141
143
|
item_name = "#{name}_#{item}".gsub(/\-/, '_')
|
142
|
-
|
144
|
+
|
143
145
|
new_resource = resources[name].clone
|
144
146
|
new_resource[namevar] = item
|
145
|
-
|
146
|
-
resources[item_name] = Resource.new(self, info, item_name, new_resource).defaults(default, config)
|
147
|
+
|
148
|
+
resources[item_name] = Resource.new(self, info, item_name, new_resource).defaults(default, config)
|
147
149
|
add_composite_resource(name, item_name)
|
148
150
|
end
|
149
151
|
resources.delete(name)
|
150
152
|
normalize = false
|
151
|
-
end
|
153
|
+
end
|
152
154
|
end
|
153
|
-
|
155
|
+
|
154
156
|
if normalize
|
155
157
|
resource = Resource.new(self, info, name, resources[name]).defaults(default, config)
|
156
158
|
resource_names[name] = true
|
@@ -158,7 +160,7 @@ class ResourceGroup < Core
|
|
158
160
|
end
|
159
161
|
end
|
160
162
|
end
|
161
|
-
|
163
|
+
|
162
164
|
config[:resource_names] = resource_names
|
163
165
|
resources.each do |name, resource|
|
164
166
|
resource.process(config)
|
@@ -167,14 +169,14 @@ class ResourceGroup < Core
|
|
167
169
|
return translate(resources, config)
|
168
170
|
end
|
169
171
|
protected :normalize
|
170
|
-
|
172
|
+
|
171
173
|
#---
|
172
|
-
|
174
|
+
|
173
175
|
def translate(resources, options = {})
|
174
176
|
config = Config.ensure(options)
|
175
177
|
results = {}
|
176
|
-
prefix = config.get(:resource_prefix, '')
|
177
|
-
|
178
|
+
prefix = config.get(:resource_prefix, '')
|
179
|
+
|
178
180
|
resources.each do |name, resource|
|
179
181
|
unless prefix.empty?
|
180
182
|
name = "#{prefix}_#{name}"
|
data/lib/core/util/puppet.rb
CHANGED
@@ -115,20 +115,25 @@ module Puppet
|
|
115
115
|
end
|
116
116
|
|
117
117
|
display_name = puppet_scope.parent_module_name ? puppet_scope.parent_module_name : 'toplevel'
|
118
|
+
display = [ :debug, :info, :warn, :error ].include? CORL.log_level
|
118
119
|
|
119
120
|
case type[:type]
|
120
121
|
when :type, :define
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
if display
|
123
|
+
CORL.ui_group(Util::Console.cyan(display_name)) do |ui|
|
124
|
+
rendered_title = Util::Console.blue(title)
|
125
|
+
rendered_resource = Util::Console.green("#{type_name(type[:name])}[#{rendered_title}]")
|
126
|
+
ui.info("Adding #{type[:type]} #{rendered_resource}")
|
127
|
+
end
|
125
128
|
end
|
126
129
|
add_definition(type, title, properties, config)
|
127
130
|
when :class
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
131
|
+
if display
|
132
|
+
CORL.ui_group(Util::Console.cyan(display_name)) do |ui|
|
133
|
+
rendered_title = Util::Console.blue(title)
|
134
|
+
rendered_resource = Util::Console.green("Class[#{rendered_title}]")
|
135
|
+
ui.info("Adding class #{rendered_resource}")
|
136
|
+
end
|
132
137
|
end
|
133
138
|
add_class(title, properties, config)
|
134
139
|
end
|
@@ -204,6 +209,7 @@ module Puppet
|
|
204
209
|
return false unless puppet_scope
|
205
210
|
|
206
211
|
display_name = puppet_scope.parent_module_name ? puppet_scope.parent_module_name : 'toplevel'
|
212
|
+
display = [ :debug, :info, :warn, :error ].include? CORL.log_level
|
207
213
|
|
208
214
|
if resource_name.is_a?(Array)
|
209
215
|
resource_name = resource_name.flatten
|
@@ -215,10 +221,12 @@ module Puppet
|
|
215
221
|
classes = Config.lookup(name, nil, config)
|
216
222
|
if classes.is_a?(Array)
|
217
223
|
classes.each do |klass|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
224
|
+
if display
|
225
|
+
CORL.ui_group(Util::Console.cyan(display_name)) do |ui|
|
226
|
+
rendered_klass = Util::Console.blue(klass)
|
227
|
+
rendered_resource = Util::Console.green("Class[#{rendered_klass}]")
|
228
|
+
ui.info("Including #{rendered_resource}")
|
229
|
+
end
|
222
230
|
end
|
223
231
|
class_data[klass] = properties
|
224
232
|
end
|
@@ -3,28 +3,28 @@ module Nucleon
|
|
3
3
|
module Action
|
4
4
|
module Node
|
5
5
|
class Image < Nucleon.plugin_class(:nucleon, :cloud_action)
|
6
|
-
|
6
|
+
|
7
7
|
#-----------------------------------------------------------------------------
|
8
8
|
# Info
|
9
|
-
|
9
|
+
|
10
10
|
def self.describe
|
11
11
|
super(:node, :image, 610)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
#-----------------------------------------------------------------------------
|
15
15
|
# Settings
|
16
|
-
|
16
|
+
|
17
17
|
def configure
|
18
18
|
super do
|
19
19
|
register :image_nodes, :array, nil do |values|
|
20
20
|
if values.nil?
|
21
21
|
warn('corl.actions.image.errors.image_nodes_empty')
|
22
|
-
next false
|
22
|
+
next false
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
node_plugins = CORL.loaded_plugins(:CORL, :node)
|
26
26
|
success = true
|
27
|
-
|
27
|
+
|
28
28
|
values.each do |value|
|
29
29
|
if info = CORL.plugin_class(:CORL, :node).translate_reference(value)
|
30
30
|
if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
|
@@ -34,32 +34,34 @@ class Image < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
success
|
37
|
-
end
|
37
|
+
end
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
#---
|
42
|
-
|
42
|
+
|
43
43
|
def ignore
|
44
44
|
[ :nodes ]
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
def arguments
|
48
48
|
[ :image_nodes ]
|
49
49
|
end
|
50
50
|
|
51
51
|
#-----------------------------------------------------------------------------
|
52
52
|
# Operations
|
53
|
-
|
53
|
+
|
54
54
|
def execute
|
55
55
|
super do |local_node|
|
56
56
|
ensure_network do
|
57
57
|
batch_success = network.batch(settings[:image_nodes], settings[:node_provider], settings[:parallel]) do |node|
|
58
|
-
info('
|
59
|
-
node.create_image
|
58
|
+
info('start', { :provider => node.plugin_provider, :name => node.plugin_name })
|
59
|
+
success = node.create_image
|
60
|
+
success('complete', { :provider => node.plugin_provider, :name => node.plugin_name }) if success
|
61
|
+
success
|
60
62
|
end
|
61
|
-
myself.status = code.batch_error unless batch_success
|
62
|
-
end
|
63
|
+
myself.status = code.batch_error unless batch_success
|
64
|
+
end
|
63
65
|
end
|
64
66
|
end
|
65
67
|
end
|