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:disable Metrics/MethodLength.
-
#initialize(aws:, bucket:, name:, target:, guid:, ec2_key:) ⇒ Keys
constructor
rubocop:disable Metrics/ParameterLists.
- #organization_key ⇒ Object
- #unlink ⇒ Object
-
#user_key ⇒ Object
rubocop:enable Metrics/MethodLength.
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
42 43 44 |
# File 'lib/formatron/chef/keys.rb', line 42 def ec2_key File.join @directory, 'ec2_key' end |
#init ⇒ Object
rubocop:disable Metrics/MethodLength
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/formatron/chef/keys.rb', line 19 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 File.chmod 0600, ec2_key end |
#organization_key ⇒ Object
38 39 40 |
# File 'lib/formatron/chef/keys.rb', line 38 def organization_key S3::ChefServerKeys.organization_pem_path directory: @directory end |
#unlink ⇒ Object
46 47 48 |
# File 'lib/formatron/chef/keys.rb', line 46 def unlink FileUtils.rm_rf @directory unless @directory.nil? end |
#user_key ⇒ Object
rubocop:enable Metrics/MethodLength
34 35 36 |
# File 'lib/formatron/chef/keys.rb', line 34 def user_key S3::ChefServerKeys.user_pem_path directory: @directory end |