fog-openstack 0.1.26 → 0.1.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3348399a88b9e9c9d222f75d2f0ded6f74a64f7
4
- data.tar.gz: 5f1b769ff3bc1f12b2e238c6c53bcc585392f9ac
3
+ metadata.gz: d8ababc6eb5751d0de1a39cdb67d8b2ddf1bea19
4
+ data.tar.gz: e610365bca3f0560657855964ed2256f0ae9a335
5
5
  SHA512:
6
- metadata.gz: f1308a13a800a9a95a21fc93d2be5f6d56e4f74c4da952589e3d1f1fce77707baaeb3b42d1cd99244aea26550f6ba5788340ed58bd70c4abb6ad1c1e4a6e70c3
7
- data.tar.gz: 6243316e3b1aa9036847e0b3e052dd111954c0acc9b0e27c8c4dba1a9e4aee87d3a204a4ca6afe1428ce7fd73dbba2a530a1f7bd2606bde728619d34fa1c50c3
6
+ metadata.gz: 5a3af31657b4182f41ccb5b669eb64cf412ade2a99c9ea5f6ffe7ef1c6d655013e45f5b951411e78f77dc830367ce5d7e2427698d743b1f172484ee668cfe5af
7
+ data.tar.gz: 5ba34342b870c574670520189b7f8ac7be919601f61ece0dbd8ee1eb2753a3de785141d2f4548e8d954f68eed67497b9bc3a4bea69802b00536ac45ee0510ae7
@@ -116,6 +116,9 @@ module Fog
116
116
  request :migrate_server
117
117
  request :evacuate_server
118
118
 
119
+ # Server Remote Consoles
120
+ request :remote_consoles
121
+
119
122
  # Service CRUD
120
123
  request :list_services
121
124
  request :enable_service
@@ -338,7 +341,7 @@ module Fog
338
341
  "port_state" => "ACTIVE"
339
342
  }
340
343
  ]
341
- }
344
+ }
342
345
  end
343
346
  end
344
347
 
@@ -25,9 +25,9 @@ module Fog
25
25
  requires :name
26
26
 
27
27
  data = if public_key
28
- service.create_key_pair(name, public_key).body['keypair']
28
+ service.create_key_pair(name, public_key, user_id).body['keypair']
29
29
  else
30
- service.create_key_pair(name).body['keypair']
30
+ service.create_key_pair(name, nil, user_id).body['keypair']
31
31
  end
32
32
  new_attributes = data.reject { |key, _value| !['fingerprint', 'public_key', 'name', 'private_key', 'user_id'].include?(key) }
33
33
  merge_attributes(new_attributes)
@@ -2,7 +2,7 @@ module Fog
2
2
  module Compute
3
3
  class OpenStack
4
4
  class Real
5
- def create_key_pair(key_name, public_key = nil)
5
+ def create_key_pair(key_name, public_key = nil, user_id = nil)
6
6
  data = {
7
7
  'keypair' => {
8
8
  'name' => key_name
@@ -10,6 +10,7 @@ module Fog
10
10
  }
11
11
 
12
12
  data['keypair']['public_key'] = public_key unless public_key.nil?
13
+ data['keypair']['user_id'] = user_id unless user_id.nil?
13
14
 
14
15
  request(
15
16
  :body => Fog::JSON.encode(data),
@@ -2,7 +2,9 @@ module Fog
2
2
  module Compute
3
3
  class OpenStack
4
4
  class Real
5
- def delete_key_pair(key_name)
5
+ def delete_key_pair(key_name, user_id = nil)
6
+ options = {}
7
+ options[:user_id] = user_id unless user_id.nil?
6
8
  request(
7
9
  :expects => [202, 204],
8
10
  :method => 'DELETE',
@@ -3,6 +3,7 @@ module Fog
3
3
  class OpenStack
4
4
  class Real
5
5
  # Get a vnc console for an instance.
6
+ # For microversion < 2.6 as it has been replaced with remote-consoles
6
7
  #
7
8
  # === Parameters
8
9
  # * server_id <~String> - The ID of the server.
@@ -13,12 +14,20 @@ module Fog
13
14
  # * url <~String>
14
15
  # * type <~String>
15
16
  def get_vnc_console(server_id, console_type)
17
+ fixed_microversion = nil
18
+ if microversion_newer_than?('2.5')
19
+ fixed_microversion = @microversion
20
+ @microversion = '2.5'
21
+ end
22
+
16
23
  body = {
17
24
  'os-getVNCConsole' => {
18
25
  'type' => console_type
19
26
  }
20
27
  }
21
- server_action(server_id, body)
28
+ result = server_action(server_id, body)
29
+ @microversion = fixed_microversion if fixed_microversion
30
+ result
22
31
  end
23
32
  end
24
33
 
@@ -0,0 +1,54 @@
1
+ module Fog
2
+ module Compute
3
+ class OpenStack
4
+ class Real
5
+ # Get a vnc console for an instance.
6
+ # For microversion >= 2.6
7
+ #
8
+ # === Parameters
9
+ # * server_id <~String> - The ID of the server.
10
+ # * protocol <~String> - The protocol of remote console. The valid values are vnc, spice, rdp, serial and mks.
11
+ # The protocol mks is added since Microversion 2.8.
12
+ # * type <~String> - The type of remote console. The valid values are novnc, xvpvnc, rdp-html5, spice-html5,
13
+ # serial, and webmks. The type webmks is added since Microversion 2.8.
14
+ # === Returns
15
+ # * response <~Excon::Response>:
16
+ # * body <~Hash>:
17
+ # * url <~String>
18
+ # * type <~String>
19
+ # * protocol <~String>
20
+ def remote_consoles(server_id, protocol, type)
21
+ if microversion_newer_than?('2.6')
22
+ body = {
23
+ 'remote_console' => {
24
+ 'protocol' => protocol, 'type' => type
25
+ }
26
+ }
27
+
28
+ request(
29
+ :body => Fog::JSON.encode(body),
30
+ :expects => 200,
31
+ :method => 'POST',
32
+ :path => "servers/#{server_id}/remote-consoles"
33
+ )
34
+ end
35
+ end
36
+ end
37
+
38
+ class Mock
39
+ def remote_consoles(_server_id, _protocol, _type)
40
+ response = Excon::Response.new
41
+ response.status = 200
42
+ response.body = {
43
+ "remote_console" => {
44
+ "url" => "http://192.168.27.100:6080/vnc_auto.html?token=e629bcbf-6f9e-4276-9ea1-d6eb0e618da5",
45
+ "type" => "novnc",
46
+ "protocol" => "vnc"
47
+ }
48
+ }
49
+ response
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module OpenStack
3
- VERSION = '0.1.26'.freeze
3
+ VERSION = '0.1.27'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.26
4
+ version: 0.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-22 00:00:00.000000000 Z
11
+ date: 2018-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -426,6 +426,7 @@ files:
426
426
  - lib/fog/compute/openstack/requests/reboot_server.rb
427
427
  - lib/fog/compute/openstack/requests/rebuild_server.rb
428
428
  - lib/fog/compute/openstack/requests/release_address.rb
429
+ - lib/fog/compute/openstack/requests/remote_consoles.rb
429
430
  - lib/fog/compute/openstack/requests/remove_aggregate_host.rb
430
431
  - lib/fog/compute/openstack/requests/remove_fixed_ip.rb
431
432
  - lib/fog/compute/openstack/requests/remove_flavor_access.rb