rake_terraform 0.21.1.pre5 → 0.21.1.pre6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rake_terraform/version.rb +1 -1
- data/lib/rake_terraform.rb +26 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2496bb28d388840a61a8345f5b36da22a211c05f267743fd2ec9efb83721609
|
4
|
+
data.tar.gz: fbcfdec0df877019c990b6461dc282cd8210f084283af0acf378c18347f06f82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf1b7431705d1585b4fe174f036ef8028f0938965be0cffb7d49e087914e7956f46109f0ed608e49dab74c5941df280d45907f9a216a6016ad605ae3dbf11312
|
7
|
+
data.tar.gz: 17477e27a5f053da9e4f685972b0622bcc8f56cb5eaa1dd9fbed4fa03dda4f63c7a9ed94776f66efbc8ab5193e5099aeb7d548b7a0333f92049e2d77d313f738
|
data/Gemfile.lock
CHANGED
data/lib/rake_terraform.rb
CHANGED
@@ -13,6 +13,9 @@ module RakeTerraform
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.define_installation_tasks(opts = {})
|
16
|
+
logger = opts[:logger] ||
|
17
|
+
Logger.new(STDERR, Logger.const_get(ENV['RKTF_LOG'] || 'WARN'))
|
18
|
+
|
16
19
|
namespace = opts[:namespace] || :terraform
|
17
20
|
version = opts[:version] || '0.10.3'
|
18
21
|
path = opts[:path] || File.join('vendor', 'terraform')
|
@@ -37,16 +40,13 @@ module RakeTerraform
|
|
37
40
|
'terraform_<%= @version %>_<%= @os_id %>_amd64<%= @ext %>'
|
38
41
|
|
39
42
|
t.needs_fetch = lambda do |parameters|
|
40
|
-
logger = Logger.new(STDERR)
|
41
|
-
logger.level = Logger.const_get(ENV['RKTF_LOG'] || 'WARN')
|
42
|
-
|
43
43
|
terraform_binary = File.join(
|
44
44
|
parameters[:path],
|
45
45
|
parameters[:binary_directory],
|
46
46
|
'terraform')
|
47
47
|
version_string = StringIO.new
|
48
48
|
|
49
|
-
logger.debug("Terraform binary
|
49
|
+
logger.debug("Terraform binary should be at: #{terraform_binary}")
|
50
50
|
|
51
51
|
if File.exist?(terraform_binary)
|
52
52
|
command_line = Lino::CommandLineBuilder.for_command(terraform_binary)
|
@@ -62,9 +62,14 @@ module RakeTerraform
|
|
62
62
|
logger.debug(
|
63
63
|
"Terraform version information is: \n#{version_string.string}")
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
version_line = version_string.string.lines.first
|
66
|
+
version_is_correct = version_line =~ /#{version}/
|
67
|
+
|
68
|
+
logger.trace(
|
69
|
+
"Version: '#{version}' is in version line: '#{version_line}'?: " +
|
70
|
+
"#{version_is_correct}")
|
71
|
+
|
72
|
+
return !version_is_correct
|
68
73
|
end
|
69
74
|
|
70
75
|
return true
|
@@ -101,11 +106,20 @@ module RakeTerraform
|
|
101
106
|
t.installation_directory = "#{ENV['HOME']}/.terraform.d/plugins"
|
102
107
|
|
103
108
|
t.needs_fetch = lambda do |parameters|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
+
provider_binary = File.join(
|
110
|
+
parameters[:path],
|
111
|
+
parameters[:binary_directory],
|
112
|
+
"#{dependency}_v#{parameters[:version]}")
|
113
|
+
|
114
|
+
logger.debug(
|
115
|
+
"Terraform provider binary for: #{name} should be at: " +
|
116
|
+
terraform_binary)
|
117
|
+
|
118
|
+
binary_exists = File.exists?(provider_binary)
|
119
|
+
|
120
|
+
logger.trace("Provider file exists?: #{binary_exists}")
|
121
|
+
|
122
|
+
!binary_exists
|
109
123
|
end
|
110
124
|
end
|
111
125
|
end
|