terraspace 0.6.13 → 0.6.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/terraspace/cli.rb +1 -1
- data/lib/terraspace/logger.rb +6 -2
- data/lib/terraspace/shell.rb +18 -16
- data/lib/terraspace/terraform/args/default.rb +1 -1
- data/lib/terraspace/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9980c8cd350d2b3c724d4dd3ff46a6388ee9c558377315e7320a35617c9810c6
|
4
|
+
data.tar.gz: 3bb3f797da63bf403cf8868ddb516cc8411cd3e92d16895876adbf06444dfab4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8da2856e9d86af65f0256a90cb4b675b17b48288ed3e752383ece1f0d90e7e1d9c044ecae8727403a698aed1bdac1578a52e25b5f481b63c4057d5e5cf357ac9
|
7
|
+
data.tar.gz: 78dd758735d162b8aaacc5d0840853d82a3d08a134e9707bf73cc7cf7918bcb078ea565a0c8ed1893f48699dcfc21c0cf5d7f240f8b6564ba61ab4ffc759831d
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.6.15] - 2021-10-01
|
7
|
+
- [#140](https://github.com/boltops-tools/terraspace/pull/140) fix terraspace output and Enter a value handling
|
8
|
+
|
9
|
+
## [0.6.14] - 2021-09-30
|
10
|
+
- [#134](https://github.com/boltops-tools/terraspace/pull/134) Use file not plan for the var-files argument
|
11
|
+
- [#139](https://github.com/boltops-tools/terraspace/pull/139) Fix terraspace output to not add extra newlines
|
12
|
+
- terraspace list: change default to show both stacks and modules
|
13
|
+
|
6
14
|
## [0.6.13] - 2021-08-10
|
7
15
|
- use terraspace-bundler 0.4.0
|
8
16
|
|
data/lib/terraspace/cli.rb
CHANGED
@@ -28,7 +28,7 @@ module Terraspace
|
|
28
28
|
option :reconfigure, type: :boolean, desc: "Add terraform -reconfigure option"
|
29
29
|
}
|
30
30
|
type_option = Proc.new {
|
31
|
-
option :type, default: "
|
31
|
+
option :type, default: "all", aliases: %w[t], desc: "Type: stack, module, or all"
|
32
32
|
}
|
33
33
|
|
34
34
|
desc "all SUBCOMMAND", "all subcommands"
|
data/lib/terraspace/logger.rb
CHANGED
@@ -20,8 +20,12 @@ module Terraspace
|
|
20
20
|
# Used to allow terraform output to always go to stdout
|
21
21
|
# Terraspace output goes to stderr by default
|
22
22
|
# See: terraspace/shell.rb
|
23
|
-
def stdout(msg)
|
24
|
-
|
23
|
+
def stdout(msg, newline: true)
|
24
|
+
if newline
|
25
|
+
puts msg
|
26
|
+
else
|
27
|
+
print msg
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
data/lib/terraspace/shell.rb
CHANGED
@@ -20,13 +20,18 @@ module Terraspace
|
|
20
20
|
def shell
|
21
21
|
env = @options[:env] || {}
|
22
22
|
env.stringify_keys!
|
23
|
-
if
|
23
|
+
if system?
|
24
24
|
system(env, @command, chdir: @mod.cache_dir)
|
25
25
|
else
|
26
26
|
popen3(env)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
def system?
|
31
|
+
@options[:shell] == "system" || # terraspace console
|
32
|
+
ENV['TS_RUNNER_SYSTEM'] # allow manual override
|
33
|
+
end
|
34
|
+
|
30
35
|
def popen3(env)
|
31
36
|
Open3.popen3(env, @command, chdir: @mod.cache_dir) do |stdin, stdout, stderr, wait_thread|
|
32
37
|
handle_streams(stdin, stdout, stderr)
|
@@ -54,7 +59,7 @@ module Terraspace
|
|
54
59
|
lines = buffer.split("\n")
|
55
60
|
lines.each do |line|
|
56
61
|
if f.fileno == stdout.fileno
|
57
|
-
handle_stdout(line)
|
62
|
+
handle_stdout(line, newline: !suppress_newline(line))
|
58
63
|
handle_input(stdin, line)
|
59
64
|
else
|
60
65
|
handle_stderr(line)
|
@@ -62,9 +67,15 @@ module Terraspace
|
|
62
67
|
end
|
63
68
|
end
|
64
69
|
end
|
70
|
+
handle_stdout("\n") # final newline at the end is exactly system behavior
|
65
71
|
end
|
66
72
|
end
|
67
73
|
|
74
|
+
def suppress_newline(line)
|
75
|
+
line.size == 8192 && line[-1] != "\n" || # when buffer is very large buffer.split("\n") only gives 8192 chars at a time
|
76
|
+
line.include?("Enter a value:") # prompt
|
77
|
+
end
|
78
|
+
|
68
79
|
def handle_stderr(line)
|
69
80
|
@error ||= Error.new
|
70
81
|
@error.lines << line # aggregate all error lines
|
@@ -81,19 +92,14 @@ module Terraspace
|
|
81
92
|
files.find { |f| !f.eof }.nil?
|
82
93
|
end
|
83
94
|
|
84
|
-
# Terraform doesnt seem to stream the line that prompts with "Enter a value:" when using Open3.popen3
|
85
|
-
# Hack around it by mimicking the "Enter a value:" prompt
|
86
|
-
#
|
87
|
-
# Note: system does stream the prompt but using Open3.popen3 so we can capture output to save to logs.
|
88
95
|
def handle_input(stdin, line)
|
89
|
-
# stdout doesnt seem to flush and show "Enter a value: " look for earlier output
|
90
96
|
patterns = [
|
91
|
-
"
|
97
|
+
"Enter a value:",
|
92
98
|
"\e[0m\e[1mvar.", # prompts for variable input. can happen on plan or apply. looking for bold marker also in case "var." shows up somewhere else
|
93
99
|
]
|
94
100
|
if patterns.any? { |pattern| line.include?(pattern) }
|
95
|
-
|
96
|
-
stdin.write_nonblock(
|
101
|
+
answer = $stdin.gets
|
102
|
+
stdin.write_nonblock(answer)
|
97
103
|
end
|
98
104
|
end
|
99
105
|
|
@@ -109,16 +115,12 @@ module Terraspace
|
|
109
115
|
end
|
110
116
|
end
|
111
117
|
|
112
|
-
def handle_stdout(line)
|
113
|
-
prompted = line.include?('Enter a value')
|
114
|
-
@prompt_shown ||= prompted
|
115
|
-
return if @prompt_shown && prompted
|
116
|
-
|
118
|
+
def handle_stdout(line, newline: true)
|
117
119
|
# Terraspace logger has special stdout method so original terraform output
|
118
120
|
# can be piped to jq. IE:
|
119
121
|
# terraspace show demo --json | jq
|
120
122
|
if logger.respond_to?(:stdout) && !@options[:log_to_stderr]
|
121
|
-
logger.stdout(line)
|
123
|
+
logger.stdout(line, newline: newline)
|
122
124
|
else
|
123
125
|
logger.info(line)
|
124
126
|
end
|
data/lib/terraspace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -849,7 +849,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
849
849
|
- !ruby/object:Gem::Version
|
850
850
|
version: '0'
|
851
851
|
requirements: []
|
852
|
-
rubygems_version: 3.
|
852
|
+
rubygems_version: 3.1.6
|
853
853
|
signing_key:
|
854
854
|
specification_version: 4
|
855
855
|
summary: 'Terraspace: The Terraspace Framework'
|