Sha256: 70dec74bfdc13b6e5f0d53a08c68b93123c0a9c336807fd5716e11caa9423821
Contents?: true
Size: 1.21 KB
Versions: 19
Compression:
Stored size: 1.21 KB
Contents
require 'fileutils' module Vpsb module Tasks class DoApiAccess < BaseTask include AskSupport prepare_squence :has_do_account, :do_host, :do_api_key, :do_client_id def call prepare ask_loop(proc {|r| process(r)}) do ap preparation_results puts "Save this configuration y[es]/n[o]?" end update_knife_rb end private def process(result) return true if result[0].to_s.downcase == 'y' reprepare false end def update_knife_rb File.open(core.get(:knife_rb_path), "w+") { |f| f.write(config) } puts 'Knife.rb file created' end def config <<-EOS cookbook_path ["cookbooks", "site-cookbooks"] node_path "nodes" role_path "roles" environment_path "environments" data_bag_path "data_bags" encrypted_data_bag_secret "data_bag_key" # knife[:secret_file] = "data_bag_key" knife[:secret_file] = "~/chef-solo/data_bag_key" knife[:berkshelf_path] = "cookbooks" knife[:digital_ocean_client_id] = '#{core.get(:do_client_id)}' knife[:digital_ocean_api_key] = '#{core.get(:do_api_key)}' EOS end end end end
Version data entries
19 entries across 19 versions & 1 rubygems