ns-fog 1.22.9 → 1.22.10

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/fog.gemspec CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  ## If your rubyforge_project name is different, then edit it and comment out
7
7
  ## the sub! line in the Rakefile
8
8
  s.name = 'ns-fog'
9
- s.version = '1.22.9'
10
- s.date = '2014-07-21'
9
+ s.version = '1.22.10'
10
+ s.date = '2014-08-07'
11
11
  s.rubyforge_project = 'fog'
12
12
 
13
13
  ## Make sure your summary is short. The description may be as long
@@ -34,6 +34,12 @@ module Fog
34
34
  wait_policy = lambda { |retries| retries < 8 ? 9 - retries : 1 }
35
35
  super(Fog::QingCloud.wait_timeout, wait_policy, &block)
36
36
  end
37
+
38
+ def changing?
39
+ respond_to?(:transition_status) &&
40
+ transition_status && !transition_status.empty?
41
+ end
42
+
37
43
  end
38
44
  end
39
45
  end
@@ -46,7 +46,6 @@ module Fog
46
46
 
47
47
  def rules(direction = nil)
48
48
  requires :id
49
- direction = [:egress, :ingress].index(direction)
50
49
  service.security_group_rules.all('group-id' => id, 'direction' => direction)
51
50
  end
52
51
 
@@ -79,9 +79,15 @@ module Fog
79
79
  status == 'running'
80
80
  end
81
81
 
82
- def reboot
82
+ def changing?
83
+ respond_to?(:transition_status) &&
84
+ transition_status && !transition_status.empty?
85
+ end
86
+
87
+ def reboot(wait = false)
83
88
  requires :id
84
89
  service.reboot_instances(id)
90
+ wait_for { status == 'running' and !changing? } if wait
85
91
  true
86
92
  end
87
93
 
@@ -173,15 +179,17 @@ module Fog
173
179
  Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)
174
180
  end
175
181
 
176
- def start
182
+ def start(wait = false)
177
183
  requires :id
178
184
  service.start_instances(id)
185
+ wait_for { status == 'running' and !changing? } if wait
179
186
  true
180
187
  end
181
188
 
182
- def stop(force = false)
189
+ def stop(wait = false, force = false)
183
190
  requires :id
184
191
  service.stop_instances(id, force)
192
+ wait_for { status == 'stopped' and !changing? } if wait
185
193
  true
186
194
  end
187
195
 
@@ -26,6 +26,7 @@ module Fog
26
26
  data = service.describe_instances(filters).body['instance_set']
27
27
  load(data.map do |x|
28
28
  x['vxnet_ids'] = x['vxnets'].map{|v| v['vxnet_id']}
29
+ x['image_id'] = x['image']['image_id']
29
30
  x
30
31
  end
31
32
  )
@@ -52,14 +53,19 @@ module Fog
52
53
  end
53
54
 
54
55
  # make sure port 22 is open in the first security group
55
- authorized = security_group.ip_permissions.detect do |ip_permission|
56
- ip_permission['ipRanges'].first && ip_permission['ipRanges'].first['cidrIp'] == '0.0.0.0/0' &&
57
- ip_permission['fromPort'] == 22 &&
58
- ip_permission['ipProtocol'] == 'tcp' &&
59
- ip_permission['toPort'] == 22
56
+ authorized = security_group.ingress_rules.detect do |rule|
57
+ rule.port_range == (22..22)
60
58
  end
61
59
  unless authorized
62
- security_group.authorize_port_range(22..22)
60
+ security_group.add_rule(
61
+ 'protocol' => 'tcp',
62
+ 'priority' => 1,
63
+ 'action' => 'accept',
64
+ 'direction' => 0,
65
+ 'port_range' => 22,
66
+ 'name' => 'ssh',
67
+ 'auto_apply' => true
68
+ )
63
69
  end
64
70
 
65
71
  server.save
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ns-fog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.22.9
4
+ version: 1.22.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-21 00:00:00.000000000 Z
12
+ date: 2014-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog-core