Class: Hyrb::Tasks::DigitalOcean::SSHKeys

Inherits:
Hyrb::Task
  • Object
show all
Defined in:
lib/hyrb/tasks/digital_ocean.rb

Instance Attribute Summary

Attributes inherited from Hyrb::Task

#env, #pipeline

Instance Method Summary collapse

Methods inherited from Hyrb::Task

depends, #initialize, prompt, prompts, #run_before

Constructor Details

This class inherits a constructor from Hyrb::Task

Instance Method Details

#run(env) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/hyrb/tasks/digital_ocean.rb', line 38

def run(env)
  env.digital_ocean_ssh_keys = Parallel.map(env.digital_ocean_client.ssh_keys.all, in_threads: 12) do |dokey|
    env.digital_ocean_client.ssh_keys.get(dokey.id)
  end

  env.digital_ocean_ssh_keys.each do |k|
    dev = env.developers.find { |dev| dev.keys.include? k.ssh_pub_key }
    dev.digital_ocean_id = k.id if dev
  end
end