nova-dsl 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/simple_provision.rb +1 -3
- data/lib/common/helpers.rb +2 -2
- data/lib/nova/wrapper/nova_console_wrapper.rb +4 -6
- data/lib/version.rb +1 -1
- metadata +1 -1
data/lib/common/helpers.rb
CHANGED
@@ -9,7 +9,7 @@ module Common
|
|
9
9
|
# @param block [Proc] system call 'system' or whateveg
|
10
10
|
# @return [Object] console output of the call within block
|
11
11
|
def self.system_call(args ={}, &block)
|
12
|
-
|
12
|
+
LOGGER.debug("Calling system calls with parameters: #{args}")
|
13
13
|
type_checker args[:source], String
|
14
14
|
src = "source #{args[:source]} && " unless args[:source].nil?
|
15
15
|
src ||= ''
|
@@ -25,6 +25,7 @@ module Common
|
|
25
25
|
|
26
26
|
block_commands = yield
|
27
27
|
block_commands = block_commands.split("\n").map { |x| x.strip }
|
28
|
+
LOGGER.debug("Calling system call with args: #{args.inspect} \n commands: #{block_commands*"\n"}")
|
28
29
|
|
29
30
|
result_stdout = nil
|
30
31
|
result_stderr = nil
|
@@ -42,7 +43,6 @@ module Common
|
|
42
43
|
if status.success?; ok_count+=1 else fail_count+=1 end
|
43
44
|
LOGGER.error("#{result_stderr}") unless status.success?
|
44
45
|
|
45
|
-
|
46
46
|
cmd_result = {}
|
47
47
|
cmd_result[:status] = status.exitstatus
|
48
48
|
cmd_result[:out] = status.success? ? result_stdout : result_stderr
|
@@ -22,17 +22,15 @@ module NovaDsl
|
|
22
22
|
|
23
23
|
configs[:security_groups] ||= %w(default)
|
24
24
|
|
25
|
-
configs[:source]
|
26
|
-
|
27
|
-
Common::system_call(:source => configs[:source]){
|
25
|
+
Common::system_call(:source => configs[:source]) {
|
28
26
|
"/usr/local/bin/nova boot --image #{configs[:image]} --flavor #{configs[:flavor]} --key_name #{configs[:key]} --security_groups #{configs[:security_groups]*','} #{configs[:name]}"
|
29
27
|
|
30
28
|
}
|
31
29
|
end
|
32
30
|
|
33
|
-
def nova_list
|
31
|
+
def nova_list(configs = {})
|
34
32
|
LOGGER.debug("Call 'nova list' ")
|
35
|
-
results = Common::system_call(:source =>
|
33
|
+
results = Common::system_call(:source => configs[:source]) {
|
36
34
|
"/usr/local/bin/nova list"
|
37
35
|
}
|
38
36
|
|
@@ -40,7 +38,7 @@ module NovaDsl
|
|
40
38
|
|
41
39
|
results.each do |result|
|
42
40
|
if result[:status].eql?(0)
|
43
|
-
|
41
|
+
vms.merge!(parse_nova_list_stdout result[:out])
|
44
42
|
else
|
45
43
|
LOGGER.debug("Skipping command stdout parsing because exitstatus is #{result[:status]}")
|
46
44
|
end
|
data/lib/version.rb
CHANGED