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.
@@ -1,10 +1,8 @@
1
1
  $:.push '.', '..'
2
- require 'nova-dsl'
3
- # Internal dsl example of provisioning new vm
4
2
 
3
+ require 'nova-dsl'
5
4
  provision "dsl-test" do
6
5
  image 999
7
6
  flavor 3
8
7
  key 'gd1'
9
- profile '~/scripts/c4gd.sh'
10
8
  end
@@ -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 => '~/scripts/x25novaDEV.sh') {
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
- vms.merge!(parse_nova_list_stdout result[:out])
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
@@ -1,3 +1,3 @@
1
1
  module NovaDsl
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nova-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: