Class: Formatron
- Inherits:
-
Object
- Object
- Formatron
- Defined in:
- lib/formatron.rb,
lib/formatron/aws.rb,
lib/formatron/cli.rb,
lib/formatron/dsl.rb,
lib/formatron/chef.rb,
lib/formatron/config.rb,
lib/formatron/logger.rb,
lib/formatron/s3/path.rb,
lib/formatron/version.rb,
lib/formatron/chef/ssh.rb,
lib/formatron/external.rb,
lib/formatron/util/dsl.rb,
lib/formatron/util/ssh.rb,
lib/formatron/util/vpc.rb,
lib/formatron/chef/keys.rb,
lib/formatron/chef/knife.rb,
lib/formatron/chef/winrm.rb,
lib/formatron/cli/deploy.rb,
lib/formatron/completion.rb,
lib/formatron/util/shell.rb,
lib/formatron/util/winrm.rb,
lib/formatron/cli/destroy.rb,
lib/formatron/chef_clients.rb,
lib/formatron/external/dsl.rb,
lib/formatron/cli/provision.rb,
lib/formatron/config/reader.rb,
lib/formatron/dsl/formatron.rb,
lib/formatron/chef/berkshelf.rb,
lib/formatron/cli/completion.rb,
lib/formatron/cloud_formation.rb,
lib/formatron/generators/util.rb,
lib/formatron/external/outputs.rb,
lib/formatron/s3/configuration.rb,
lib/formatron/dsl/formatron/vpc.rb,
lib/formatron/cli/generators/guid.rb,
lib/formatron/generators/instance.rb,
lib/formatron/s3/chef_server_cert.rb,
lib/formatron/s3/chef_server_keys.rb,
lib/formatron/dsl/formatron/global.rb,
lib/formatron/generators/bootstrap.rb,
lib/formatron/generators/credentials.rb,
lib/formatron/generators/util/readme.rb,
lib/formatron/cli/generators/instance.rb,
lib/formatron/cloud_formation/scripts.rb,
lib/formatron/cli/generators/bootstrap.rb,
lib/formatron/cloud_formation/template.rb,
lib/formatron/dsl/formatron/global/ec2.rb,
lib/formatron/dsl/formatron/vpc/subnet.rb,
lib/formatron/generators/bootstrap/ec2.rb,
lib/formatron/generators/bootstrap/ssl.rb,
lib/formatron/generators/util/cookbook.rb,
lib/formatron/aws/cloud_formation_stack.rb,
lib/formatron/generators/util/gitignore.rb,
lib/formatron/cli/generators/credentials.rb,
lib/formatron/generators/instance/config.rb,
lib/formatron/generators/bootstrap/config.rb,
lib/formatron/s3/cloud_formation_template.rb,
lib/formatron/cloud_formation/template/vpc.rb,
lib/formatron/dsl/formatron/global/windows.rb,
lib/formatron/dsl/formatron/vpc/subnet/acl.rb,
lib/formatron/cli/generators/databag_secret.rb,
lib/formatron/cloud_formation/resources/ec2.rb,
lib/formatron/cloud_formation/resources/iam.rb,
lib/formatron/cloud_formation/resources/route53.rb,
lib/formatron/dsl/formatron/vpc/subnet/instance.rb,
lib/formatron/generators/instance/formatronfile.rb,
lib/formatron/generators/bootstrap/formatronfile.rb,
lib/formatron/cloud_formation/template/parameters.rb,
lib/formatron/cloud_formation/template/vpc/subnet.rb,
lib/formatron/dsl/formatron/vpc/subnet/chef_server.rb,
lib/formatron/dsl/formatron/vpc/subnet/instance/chef.rb,
lib/formatron/cloud_formation/template/vpc/subnet/acl.rb,
lib/formatron/cloud_formation/template/vpc/subnet/nat.rb,
lib/formatron/dsl/formatron/vpc/subnet/instance/setup.rb,
lib/formatron/dsl/formatron/vpc/subnet/instance/policy.rb,
lib/formatron/dsl/formatron/vpc/subnet/instance/volume.rb,
lib/formatron/cloud_formation/resources/cloud_formation.rb,
lib/formatron/cloud_formation/template/vpc/subnet/bastion.rb,
lib/formatron/cloud_formation/template/vpc/subnet/instance.rb,
lib/formatron/dsl/formatron/vpc/subnet/instance/block_device.rb,
lib/formatron/cloud_formation/template/vpc/subnet/chef_server.rb,
lib/formatron/dsl/formatron/vpc/subnet/instance/security_group.rb,
lib/formatron/dsl/formatron/vpc/subnet/instance/setup/variable.rb,
lib/formatron/dsl/formatron/vpc/subnet/chef_server/organization.rb,
lib/formatron/cloud_formation/template/vpc/subnet/instance/setup.rb,
lib/formatron/dsl/formatron/vpc/subnet/instance/policy/statement.rb,
lib/formatron/cloud_formation/template/vpc/subnet/instance/policy.rb,
lib/formatron/cloud_formation/template/vpc/subnet/instance/block_devices.rb,
lib/formatron/cloud_formation/template/vpc/subnet/instance/security_group.rb
Overview
add version to class
Defined Under Namespace
Modules: CloudFormation, Completion, Config, Generators, S3, Util Classes: AWS, CLI, Chef, ChefClients, DSL, External
Constant Summary collapse
- FORMATRONFILE =
'Formatronfile'
- WORKING_DIRECTORY =
'.formatron'
- LOG =
Logger.new($stdout).tap do |log| log.progname = 'Formatron' end
- VERSION =
'0.1.16'
Instance Attribute Summary collapse
-
#protected ⇒ Object
(also: #protected?)
readonly
Returns the value of attribute protected.
Instance Method Summary collapse
-
#_deploy_chef_server_certs ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#_destroy_chef_server_cert ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#_destroy_chef_server_keys ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#deploy ⇒ Object
rubocop:enable Metrics/AbcSize rubocop:enable Metrics/MethodLength.
-
#destroy ⇒ Object
rubocop:enable Metrics/ParameterLists.
-
#initialize(credentials:, directory:, target:) ⇒ Formatron
constructor
rubocop:disable Metrics/MethodLength.
- #provision(guid: nil) ⇒ Object
Constructor Details
#initialize(credentials:, directory:, target:) ⇒ Formatron
rubocop:disable Metrics/MethodLength
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/formatron.rb', line 26 def initialize(credentials:, directory:, target:) @working_directory = File.join directory, WORKING_DIRECTORY, target @target = target @aws = AWS.new credentials: credentials @config = Config.target( directory: directory, target: target ) @external = External.new( target: @target, config: @config, aws: @aws ) @dsl = DSL.new( file: File.join(directory, FORMATRONFILE), config: @config, target: @target, external: @external, aws: @aws ) _initialize end |
Instance Attribute Details
#protected ⇒ Object (readonly) Also known as: protected?
Returns the value of attribute protected.
22 23 24 |
# File 'lib/formatron.rb', line 22 def protected @protected end |
Instance Method Details
#_deploy_chef_server_certs ⇒ Object
rubocop:disable Metrics/MethodLength
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/formatron.rb', line 225 def _deploy_chef_server_certs @chef_servers.values.each do |chef_servers| chef_servers.values.each do |chef_server| S3::ChefServerCert.deploy( aws: @aws, kms_key: @kms_key, bucket: @bucket, name: @name, target: @target, guid: chef_server.guid, cert: chef_server.ssl_cert, key: chef_server.ssl_key ) end end end |
#_destroy_chef_server_cert ⇒ Object
rubocop:disable Metrics/MethodLength
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/formatron.rb', line 277 def _destroy_chef_server_cert @chef_servers.values.each do |chef_servers| chef_servers.values.each do |chef_server| S3::ChefServerCert.destroy( aws: @aws, bucket: @bucket, name: @name, target: @target, guid: chef_server.guid ) end end rescue => error LOG.warn error end |
#_destroy_chef_server_keys ⇒ Object
rubocop:disable Metrics/MethodLength
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/formatron.rb', line 295 def _destroy_chef_server_keys @chef_servers.values.each do |chef_servers| chef_servers.values.each do |chef_server| S3::ChefServerKeys.destroy( aws: @aws, bucket: @bucket, name: @name, target: @target, guid: chef_server.guid ) end end rescue => error LOG.warn error end |
#deploy ⇒ Object
rubocop:enable Metrics/AbcSize rubocop:enable Metrics/MethodLength
153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/formatron.rb', line 153 def deploy _deploy_configuration _deploy_chef_server_certs if @cloud_formation_template[:Resources].empty? _destroy_template _destroy_stack else _deploy_template _deploy_stack end end |
#destroy ⇒ Object
rubocop:enable Metrics/ParameterLists
204 205 206 207 208 209 210 211 |
# File 'lib/formatron.rb', line 204 def destroy _destroy_chef_instances _destroy_configuration _destroy_chef_server_cert _destroy_chef_server_keys _destroy_template _destroy_stack end |
#provision(guid: nil) ⇒ Object
165 166 167 168 169 |
# File 'lib/formatron.rb', line 165 def provision(guid: nil) @all_instances.each do |key, instances| _provision_vpc key, instances, guid end end |