class Formatron::ChefClients
creates chef clients
Public Class Methods
new( directory:, aws:, bucket:, name:, target:, ec2_key:, administrator_name:, administrator_password:, hosted_zone_name:, vpc:, external:, configuration:, databag_secret: )
click to toggle source
rubocop:disable Metrics/ParameterLists rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength
# File lib/formatron/chef_clients.rb, line 7 def initialize( directory:, aws:, bucket:, name:, target:, ec2_key:, administrator_name:, administrator_password:, hosted_zone_name:, vpc:, external:, configuration:, databag_secret: ) @chef_clients = {} if external.nil? bastions = Util::VPC.instances :bastion, vpc chef_servers = Util::VPC.instances :chef_server, vpc else bastions = Util::VPC.instances :bastion, external, vpc chef_servers = Util::VPC.instances :chef_server, external, vpc end bastions = Hash[bastions.map { |k, v| [k, v.sub_domain] }] chef_servers.each do |key, chef_server| @chef_clients[key] = Chef.new( directory: directory, aws: aws, bucket: bucket, name: name, target: target, username: chef_server.username, organization: chef_server.organization.short_name, ssl_verify: chef_server.ssl_verify, chef_sub_domain: chef_server.sub_domain, ec2_key: ec2_key, administrator_name: administrator_name, administrator_password: administrator_password, bastions: bastions, hosted_zone_name: hosted_zone_name, server_stack: chef_server.stack || name, guid: chef_server.guid, configuration: configuration, databag_secret: databag_secret ) end end
Public Instance Methods
get(key = nil)
click to toggle source
rubocop:enable Metrics/MethodLength rubocop:enable Metrics/AbcSize rubocop:enable Metrics/ParameterLists
# File lib/formatron/chef_clients.rb, line 58 def get(key = nil) key ||= @chef_clients.keys[0] @chef_clients[key] end
init()
click to toggle source
# File lib/formatron/chef_clients.rb, line 63 def init @chef_clients.values.each(&:init) end