Class: Fog::Compute::DigitalOceanV2::Real

Inherits:
Object
  • Object
show all
Defined in:
lib/ext/fog/compute/digital_ocean_v2.rb

Overview

Fixes an ssh key creation issue currently in fog 1.35.0 This change currently in fog master:

https://github.com/fog/fog/pull/3743

However, unless it gets backported into 1.x, we’ll need this patch until we update fog to 2.x

Instance Method Summary collapse

Instance Method Details

#create_ssh_key(name, public_key) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ext/fog/compute/digital_ocean_v2.rb', line 16

def create_ssh_key(name, public_key)
  create_options = {
    :name       => name,
    :public_key => public_key,
  }

  encoded_body = Fog::JSON.encode(create_options)

  request(
    :expects => [201],
    :headers => {
      'Content-Type' => "application/json; charset=UTF-8",
    },
    :method  => 'POST',
    :path    => '/v2/account/keys',
    :body    => encoded_body,
  )
end