CloudyScripts 1.5.22 → 1.5.23

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.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ require 'rake/testtask'
12
12
 
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.name = 'CloudyScripts'
15
- s.version = '1.5.22'
15
+ s.version = '1.5.23'
16
16
  s.has_rdoc = true
17
17
  s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
18
18
  s.summary = 'Scripts to facilitate programming for infrastructure clouds.'
@@ -37,11 +37,12 @@ module StateTransitionHelper
37
37
  # * ssh_keydata => contents of key-file (either use ssh_keyfile or ssh_keydata)
38
38
  # Returns:
39
39
  # * OS of the connected machine
40
- def connect(dns_name, user_name, ssh_keyfile = nil, ssh_keydata = nil)
40
+ def connect(dns_name, user_name, ssh_keyfile = nil, ssh_keydata = nil,
41
+ trials = 5, wait_between_trials = 20)
41
42
  post_message("connecting '#{user_name}' to #{dns_name}...")
42
43
  connected = false
43
44
  last_connection_problem = ""
44
- remaining_trials = 5
45
+ remaining_trials = trials-1
45
46
  while !connected && remaining_trials > 0
46
47
  remaining_trials -= 1
47
48
  if ssh_keyfile != nil
@@ -68,7 +69,7 @@ module StateTransitionHelper
68
69
  raise Exception.new("no key information specified")
69
70
  end
70
71
  if !connected
71
- sleep(20) #try again
72
+ sleep(wait_between_trials) #try again
72
73
  end
73
74
  end
74
75
  if !connected
@@ -24,6 +24,8 @@ class Ami2EbsConversion < Ec2Script
24
24
  # * description => description on AMI to be created (optional)
25
25
  # * temp_device_name => [default /dev/sdj] device name used to attach the temporary storage; change this only if there's already a volume attacged as /dev/sdj (optional, default is /dev/sdj)
26
26
  # * root_device_name"=> [default /dev/sda1] device name used for the root device (optional)
27
+ # * connect_trials => number of trials during ssh connect to machine
28
+ # * connect_interval => seconds between two ssh connect trials
27
29
  def initialize(input_params)
28
30
  super(input_params)
29
31
  end
@@ -52,6 +54,12 @@ class Ami2EbsConversion < Ec2Script
52
54
  if @input_params[:ssh_username] == nil
53
55
  @input_params[:ssh_username] = "root"
54
56
  end
57
+ if @input_params[:connect_trials] == nil
58
+ @input_params[:connect_trials] = 6
59
+ end
60
+ if @input_params[:connect_interval] == nil
61
+ @input_params[:connect_interval] = 20
62
+ end
55
63
  end
56
64
 
57
65
  def load_initial_state()
@@ -100,7 +108,10 @@ class Ami2EbsConversion < Ec2Script
100
108
  class StorageAttached < Ami2EbsConversionState
101
109
  def enter
102
110
  @context[:result][:os] =
103
- connect(@context[:dns_name], @context[:ssh_username], @context[:ssh_keyfile], @context[:ssh_keydata])
111
+ connect(@context[:dns_name], @context[:ssh_username],
112
+ @context[:ssh_keyfile], @context[:ssh_keydata],
113
+ @context[:connect_trials], @context[:connect_interval]
114
+ )
104
115
  create_fs(@context[:dns_name], @context[:temp_device_name])
105
116
  FileSystemCreated.new(@context)
106
117
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 22
9
- version: 1.5.22
8
+ - 23
9
+ version: 1.5.23
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matthias Jung
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-10 00:00:00 +01:00
17
+ date: 2011-01-24 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency