class Formatron::Chef::Keys

Download the Chef Server keys

Public Class Methods

new(directory:, aws:, bucket:, name:, target:, guid:, ec2_key:) click to toggle source

rubocop:disable Metrics/ParameterLists

# File lib/formatron/chef/keys.rb, line 8
def initialize(directory:, aws:, bucket:, name:, target:, guid:, ec2_key:)
  @aws = aws
  @bucket = bucket
  @name = name
  @target = target
  @guid = guid
  @ec2_key = ec2_key
  @directory = directory
end

Public Instance Methods

ec2_key() click to toggle source
# File lib/formatron/chef/keys.rb, line 42
def ec2_key
  File.join @directory, 'ec2_key'
end
init() click to toggle source

rubocop:enable Metrics/ParameterLists

# File lib/formatron/chef/keys.rb, line 19
def init
  S3::ChefServerKeys.get(
    aws: @aws,
    bucket: @bucket,
    name: @name,
    target: @target,
    guid: @guid,
    directory: @directory
  )
  File.write ec2_key, @ec2_key
  File.chmod 0600, ec2_key
end
organization_key() click to toggle source
# File lib/formatron/chef/keys.rb, line 36
def organization_key
  S3::ChefServerKeys.organization_pem_path(
    directory: @directory
  )
end
user_key() click to toggle source
# File lib/formatron/chef/keys.rb, line 32
def user_key
  S3::ChefServerKeys.user_pem_path directory: @directory
end