Class: Formatron::Chef::Keys
- Inherits:
-
Object
- Object
- Formatron::Chef::Keys
- Defined in:
- lib/formatron/chef/keys.rb
Overview
Download the Chef Server keys
Instance Method Summary collapse
- #ec2_key ⇒ Object
-
#init ⇒ Object
rubocop:enable Metrics/ParameterLists.
-
#initialize(aws:, bucket:, name:, target:, guid:, ec2_key:) ⇒ Keys
constructor
rubocop:disable Metrics/ParameterLists.
- #organization_key ⇒ Object
- #unlink ⇒ Object
- #user_key ⇒ Object
Constructor Details
#initialize(aws:, bucket:, name:, target:, guid:, ec2_key:) ⇒ Keys
rubocop:disable Metrics/ParameterLists
8 9 10 11 12 13 14 15 |
# File 'lib/formatron/chef/keys.rb', line 8 def initialize(aws:, bucket:, name:, target:, guid:, ec2_key:) @aws = aws @bucket = bucket @name = name @target = target @guid = guid @ec2_key = ec2_key end |
Instance Method Details
#ec2_key ⇒ Object
39 40 41 |
# File 'lib/formatron/chef/keys.rb', line 39 def ec2_key File.join @directory, 'ec2_key' end |
#init ⇒ Object
rubocop:enable Metrics/ParameterLists
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/formatron/chef/keys.rb', line 18 def init @directory = Dir.mktmpdir 'formatron-chef-server-keys-' S3::ChefServerKeys.get( aws: @aws, bucket: @bucket, name: @name, target: @target, guid: @guid, directory: @directory ) File.write ec2_key, @ec2_key end |
#organization_key ⇒ Object
35 36 37 |
# File 'lib/formatron/chef/keys.rb', line 35 def organization_key S3::ChefServerKeys.organization_pem_path directory: @directory end |
#unlink ⇒ Object
43 44 45 |
# File 'lib/formatron/chef/keys.rb', line 43 def unlink FileUtils.rm_rf @directory unless @directory.nil? end |
#user_key ⇒ Object
31 32 33 |
# File 'lib/formatron/chef/keys.rb', line 31 def user_key S3::ChefServerKeys.user_pem_path directory: @directory end |