ns-fog 1.22.3 → 1.22.4

Sign up to get free protection for your applications and to get access to all the features.
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.3'
10
- s.date = '2014-05-29'
9
+ s.version = '1.22.4'
10
+ s.date = '2014-07-14'
11
11
  s.rubyforge_project = 'fog'
12
12
 
13
13
  ## Make sure your summary is short. The description may be as long
@@ -91,6 +91,8 @@ module Fog
91
91
  request :delete_key_pairs
92
92
  request :attach_key_pairs
93
93
  request :detach_key_pairs
94
+
95
+ request :upload_userdata_attachment
94
96
 
95
97
  #request :describe_images
96
98
  #request :capture_instance
@@ -1,5 +1,6 @@
1
1
  require 'fog/compute/models/server'
2
2
  require 'ostruct'
3
+ require 'base64'
3
4
 
4
5
  module Fog
5
6
  module Compute
@@ -22,6 +23,8 @@ module Fog
22
23
  attribute :zone
23
24
  attribute :last_modified, :alias => 'status_time'
24
25
  attribute :transition_status
26
+ attribute :userdata_type
27
+ attribute :userdata_value
25
28
 
26
29
  # Used to store the NIC information of the described instance.
27
30
  attribute :vxnets
@@ -95,6 +98,20 @@ module Fog
95
98
  'vxnets' => vxnet_ids
96
99
  }
97
100
 
101
+ if userdata_value
102
+ if userdata_type == 'plain'
103
+ options['userdata_value'] = Base64.encode64(userdata_value)
104
+ elsif userdata_type == 'tar'
105
+ attachment_id = service.upload_userdata_attachment(
106
+ 'attachment_content' => Base64.encode64(userdata_value),
107
+ 'attachment_name' => 'userdata-tar'
108
+ ).body['attachment_id']
109
+ options['userdata_value'] = attachment_id
110
+ end
111
+ options['need_userdata'] = 1
112
+ options['userdata_type'] = userdata_type
113
+ end
114
+
98
115
  self.id = service.run_instances(image_id, 1, options).body['instances'].first
99
116
  wait_for {ready?}
100
117
  end
@@ -0,0 +1,30 @@
1
+ module Fog
2
+ module Compute
3
+ class QingCloud
4
+ class Real
5
+
6
+ # Delete a key pair that you own
7
+ # {API Reference}[https://docs.qingcloud.com/api/userdata/upload_userdata_attachment.html]
8
+ def upload_userdata_attachment(options)
9
+ request(options.merge('action' => 'UploadUserDataAttachment')
10
+ end
11
+
12
+ end
13
+
14
+ class Mock
15
+
16
+ def upload_userdata_attachment(options)
17
+ response = Excon::Response.new
18
+ response.status = 200
19
+ response.body = {
20
+ 'action' => 'UploadUserDataAttachment',
21
+ 'attachment_id' => 'uda-' + Fog::Mock.random_hex(8),
22
+ 'ret_code' => 0
23
+ }
24
+ response
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
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.3
4
+ version: 1.22.4
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-05-29 00:00:00.000000000 Z
12
+ date: 2014-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog-core
@@ -3448,6 +3448,7 @@ files:
3448
3448
  - lib/fog/qingcloud/requests/compute/stop_instances.rb
3449
3449
  - lib/fog/qingcloud/requests/compute/terminate_instances.rb
3450
3450
  - lib/fog/qingcloud/requests/compute/update_routers.rb
3451
+ - lib/fog/qingcloud/requests/compute/upload_userdata_attachment.rb
3451
3452
  - lib/fog/rackspace.rb
3452
3453
  - lib/fog/rackspace/auto_scale.rb
3453
3454
  - lib/fog/rackspace/block_storage.rb