cloudspin-stack 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cloudspin/cli.rb +1 -2
- data/lib/cloudspin/stack/definition.rb +19 -6
- data/lib/cloudspin/stack/instance.rb +6 -2
- data/lib/cloudspin/stack/instance_configuration.rb +10 -15
- data/lib/cloudspin/stack/remote_definition.rb +1 -1
- data/lib/cloudspin/stack/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a0cac1862741e42e43595507f3013533717bbfd7927c449fd3dd61428008040
|
4
|
+
data.tar.gz: b3bcc54327a0a33d64185d4c9441f96a995fc7ca16bd735c7b3501e8f4abf0a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5d3fd779e9faf9c3a7e05023147006974a41b28978c792dc24fb831b9890e344cddbec786e2a06b7f16b724b70dcb10ac72a06e20abb902a311c309da8a1250
|
7
|
+
data.tar.gz: 9eb450340c002f38f675542952359bfbe8611c7cd53b78623c5f0e60bc5af3e7677d6c780cca667162fd6214d59f59d3c1ccd107cdb228818efb09a2ecd7712b
|
data/lib/cloudspin/cli.rb
CHANGED
@@ -15,8 +15,7 @@ module Cloudspin
|
|
15
15
|
class_option :source,
|
16
16
|
:aliases => '-s',
|
17
17
|
:banner => 'PATH-OR-URL',
|
18
|
-
:
|
19
|
-
:desc => 'Path to terraform project source files'
|
18
|
+
:desc => 'Path to terraform project source files. Defaults to ./src'
|
20
19
|
|
21
20
|
class_option :environment,
|
22
21
|
:aliases => '-e',
|
@@ -27,15 +27,28 @@ module Cloudspin
|
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
30
|
-
def self.from_location(definition_location
|
31
|
-
|
32
|
-
|
30
|
+
def self.from_location(definition_location = nil,
|
31
|
+
definition_cache_folder: '.cloudspin/definitions',
|
32
|
+
stack_configuration: nil
|
33
|
+
)
|
34
|
+
resolved_definition_location = if ! definition_location.nil?
|
35
|
+
# puts "DEBUG: definition_location has been explicitly set to #{definition_location}"
|
36
|
+
definition_location
|
37
|
+
elsif ! stack_configuration.nil? && stack_configuration['definition_location']
|
38
|
+
# puts "DEBUG: definition_location comes from the stack configuration (#{stack_configuration})"
|
39
|
+
stack_configuration['definition_location']
|
40
|
+
else
|
41
|
+
'./src'
|
42
|
+
end
|
43
|
+
|
44
|
+
# puts "DEBUG: get definition from location #{resolved_definition_location}"
|
45
|
+
if RemoteDefinition.is_remote?(resolved_definition_location)
|
33
46
|
# puts "DEBUG: Downloading remote stack definition"
|
34
|
-
local_definition_folder = RemoteDefinition.new(
|
47
|
+
local_definition_folder = RemoteDefinition.new(resolved_definition_location).fetch(definition_cache_folder)
|
35
48
|
from_file("#{local_definition_folder}/stack-definition.yaml", from_remote: true)
|
36
49
|
else
|
37
|
-
# puts "DEBUG: Using local stack definition source: #{
|
38
|
-
from_file("#{
|
50
|
+
# puts "DEBUG: Using local stack definition source: #{resolved_definition_location}/stack-definition.yaml"
|
51
|
+
from_file("#{resolved_definition_location}/stack-definition.yaml")
|
39
52
|
end
|
40
53
|
end
|
41
54
|
|
@@ -32,7 +32,11 @@ module Cloudspin
|
|
32
32
|
)
|
33
33
|
self.from_files(
|
34
34
|
instance_configuration_files,
|
35
|
-
stack_definition: Definition.from_location(
|
35
|
+
stack_definition: Definition.from_location(
|
36
|
+
definition_location,
|
37
|
+
definition_cache_folder: "#{base_folder}/.cloudspin/definitions",
|
38
|
+
stack_configuration: InstanceConfiguration.load_configuration_values(instance_configuration_files)['stack']
|
39
|
+
),
|
36
40
|
base_folder: base_folder,
|
37
41
|
base_working_folder: base_working_folder
|
38
42
|
)
|
@@ -68,7 +72,7 @@ module Cloudspin
|
|
68
72
|
end
|
69
73
|
|
70
74
|
def self.add_terraform_backend_source(terraform_source_folder)
|
71
|
-
puts "DEBUG: Creating file #{terraform_source_folder}/_cloudspin_created_backend.tf"
|
75
|
+
# puts "DEBUG: Creating file #{terraform_source_folder}/_cloudspin_created_backend.tf"
|
72
76
|
File.open("#{terraform_source_folder}/_cloudspin_created_backend.tf", 'w') { |backend_file|
|
73
77
|
backend_file.write(<<~TF_BACKEND_SOURCE
|
74
78
|
terraform {
|
@@ -52,11 +52,7 @@ module Cloudspin
|
|
52
52
|
stack_definition:,
|
53
53
|
base_folder: '.'
|
54
54
|
)
|
55
|
-
configuration_values =
|
56
|
-
configuration_files.flatten.each { |config_file|
|
57
|
-
# puts "DEBUG: Reading configuration file: #{config_file}"
|
58
|
-
configuration_values = configuration_values.deep_merge(yaml_file_to_hash(config_file))
|
59
|
-
}
|
55
|
+
configuration_values = load_configuration_values(configuration_files)
|
60
56
|
self.new(
|
61
57
|
stack_definition: stack_definition,
|
62
58
|
base_folder: base_folder,
|
@@ -64,6 +60,15 @@ module Cloudspin
|
|
64
60
|
)
|
65
61
|
end
|
66
62
|
|
63
|
+
def self.load_configuration_values(configuration_files)
|
64
|
+
configuration_values = {}
|
65
|
+
configuration_files.flatten.each { |config_file|
|
66
|
+
# puts "DEBUG: Reading configuration file: #{config_file}"
|
67
|
+
configuration_values = configuration_values.deep_merge(yaml_file_to_hash(config_file))
|
68
|
+
}
|
69
|
+
configuration_values
|
70
|
+
end
|
71
|
+
|
67
72
|
def self.yaml_file_to_hash(yaml_file)
|
68
73
|
if File.exists?(yaml_file)
|
69
74
|
YAML.load_file(yaml_file) || {}
|
@@ -94,16 +99,6 @@ module Cloudspin
|
|
94
99
|
"#{instance_identifier}.tfstate"
|
95
100
|
end
|
96
101
|
|
97
|
-
# def instance_identifier
|
98
|
-
# if instance_values['identifier']
|
99
|
-
# instance_values['identifier']
|
100
|
-
# elsif instance_values['group']
|
101
|
-
# stack_name + '-' + instance_values['group']
|
102
|
-
# else
|
103
|
-
# stack_name
|
104
|
-
# end
|
105
|
-
# end
|
106
|
-
|
107
102
|
def to_s
|
108
103
|
{
|
109
104
|
'instance_identifier' => instance_identifier,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudspin-stack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 'kief '
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-terraform
|