ufo 3.4.1 → 3.4.2
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/ufo/tasks/register.rb +20 -11
- data/lib/ufo/version.rb +1 -1
- data/spec/lib/cli_spec.rb +8 -0
- data/spec/lib/register_spec.rb +16 -16
- 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: 577e905ee782f5880d9d9e5bc69ee622e65b7ded641ea3bbcc48e022bd409a07
|
|
4
|
+
data.tar.gz: b47e630a786fa437df2662879fc2697605a01b1523346ca5718da276db1c20c8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c10fb1658f61cb08b868dc2d7adc473fd618e0e9a8556567908ae7e4745651c33bc25d4ac92046ddf6113ef05a633a10dfdbe88751fab4e45405ef043c8fda76
|
|
7
|
+
data.tar.gz: e322a656ae5e18b423af595a80b111b706c804975f8f0a8adb1ad9e8be4fae9b1972ad994500d8a97e4f0ab24dad712605fe0e286a0992bd9842e2db56cb2239
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
|
5
5
|
|
|
6
|
+
## [3.4.2]
|
|
7
|
+
- Merge pull request #33 from tongueroo/rubyize_format
|
|
8
|
+
- improve rubyize_format so that original log configuration options are kept
|
|
9
|
+
|
|
6
10
|
## [3.4.1]
|
|
7
11
|
- Merge pull request #32 from tongueroo/fix-log-configuration
|
|
8
12
|
- fix log configuration dasherization
|
data/Gemfile.lock
CHANGED
data/lib/ufo/tasks/register.rb
CHANGED
|
@@ -22,10 +22,10 @@ module Ufo
|
|
|
22
22
|
|
|
23
23
|
# aws ecs register-task-definition --cli-input-json file://.ufo/output/hi-web-prod.json
|
|
24
24
|
def register
|
|
25
|
-
data = JSON.parse(IO.read(@template_definition_path)
|
|
26
|
-
|
|
27
|
-
data =
|
|
28
|
-
|
|
25
|
+
data = JSON.parse(IO.read(@template_definition_path))
|
|
26
|
+
puts "@template_definition_path #{@template_definition_path.inspect}"
|
|
27
|
+
data = rubyize_format(data)
|
|
28
|
+
message = "#{data[:family]} task definition registered."
|
|
29
29
|
if @options[:noop]
|
|
30
30
|
message = "NOOP: #{message}"
|
|
31
31
|
else
|
|
@@ -53,19 +53,28 @@ module Ufo
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
|
|
56
|
+
# The ruby aws-sdk expects symbols for keys and AWS docs for the task
|
|
57
|
+
# definition uses json camelCase for the keys. This method transforms
|
|
58
|
+
# the keys to the expected ruby aws-sdk format.
|
|
59
|
+
#
|
|
60
|
+
# One quirk is that the logConfiguration options casing should not be
|
|
61
|
+
# transformed.
|
|
62
|
+
def rubyize_format(original_data)
|
|
63
|
+
data = original_data.to_snake_keys.deep_symbolize_keys
|
|
64
|
+
|
|
59
65
|
definitions = data[:container_definitions]
|
|
60
|
-
definitions.
|
|
66
|
+
definitions.each_with_index do |definition, i|
|
|
61
67
|
next unless definition[:log_configuration]
|
|
62
68
|
options = definition[:log_configuration][:options]
|
|
63
69
|
next unless options
|
|
64
70
|
|
|
65
|
-
options
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
# LogConfiguration options do not get transformed and keep their original
|
|
72
|
+
# structure:
|
|
73
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ECS/Types/ContainerDefinition.html
|
|
74
|
+
original_definition = original_data["containerDefinitions"][i]
|
|
75
|
+
definition[:log_configuration][:options] = original_definition["logConfiguration"]["options"]
|
|
68
76
|
end
|
|
77
|
+
|
|
69
78
|
data
|
|
70
79
|
end
|
|
71
80
|
end
|
data/lib/ufo/version.rb
CHANGED
data/spec/lib/cli_spec.rb
CHANGED
|
@@ -18,6 +18,14 @@ describe Ufo::CLI do
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
context "tasks" do
|
|
21
|
+
before(:each) do
|
|
22
|
+
FileUtils.mkdir_p("#{Ufo.root}/.ufo/data/")
|
|
23
|
+
FileUtils.touch("#{Ufo.root}/.ufo/data/docker_image_name_ufo.txt")
|
|
24
|
+
end
|
|
25
|
+
after(:each) do
|
|
26
|
+
FileUtils.rm_f("#{Ufo.root}/.ufo/data/docker_image_name_ufo.txt")
|
|
27
|
+
end
|
|
28
|
+
|
|
21
29
|
it "build builds task definition" do
|
|
22
30
|
out = execute("exe/ufo tasks build #{@args}")
|
|
23
31
|
expect(out).to include("Task Definitions built")
|
data/spec/lib/register_spec.rb
CHANGED
|
@@ -8,16 +8,16 @@ describe Ufo::Tasks::Register do
|
|
|
8
8
|
context "syslog" do
|
|
9
9
|
let(:data) do
|
|
10
10
|
{
|
|
11
|
-
"
|
|
12
|
-
"logConfiguration"
|
|
13
|
-
"logDriver"
|
|
11
|
+
"containerDefinitions" => [{
|
|
12
|
+
"logConfiguration" => {
|
|
13
|
+
"logDriver" => "syslog"
|
|
14
14
|
}
|
|
15
15
|
}]
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
it "
|
|
20
|
-
result = register.
|
|
19
|
+
it "#rubyize_format" do
|
|
20
|
+
result = register.rubyize_format(data)
|
|
21
21
|
driver = result[:container_definitions][0][:log_configuration][:log_driver]
|
|
22
22
|
expect(driver).to eq "syslog"
|
|
23
23
|
end
|
|
@@ -26,21 +26,21 @@ describe Ufo::Tasks::Register do
|
|
|
26
26
|
context "awslogs" do
|
|
27
27
|
let(:data) do
|
|
28
28
|
{
|
|
29
|
-
"
|
|
30
|
-
"logConfiguration"
|
|
31
|
-
"logDriver"
|
|
32
|
-
"options"
|
|
33
|
-
"awslogs-group"
|
|
34
|
-
"awslogs-region"
|
|
35
|
-
"awslogs-stream-prefix"
|
|
29
|
+
"containerDefinitions" => [{
|
|
30
|
+
"logConfiguration" => {
|
|
31
|
+
"logDriver" => "awslogs",
|
|
32
|
+
"options" => {
|
|
33
|
+
"awslogs-group" => "mygroup",
|
|
34
|
+
"awslogs-region" => "us-east-1",
|
|
35
|
+
"awslogs-stream-prefix" => "mystream"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}]
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
it "
|
|
43
|
-
result = register.
|
|
42
|
+
it "rubyize_format" do
|
|
43
|
+
result = register.rubyize_format(data)
|
|
44
44
|
log_configuration = result[:container_definitions][0][:log_configuration]
|
|
45
45
|
expect(log_configuration[:log_driver]).to eq "awslogs"
|
|
46
46
|
expect(log_configuration[:options].keys).to include("awslogs-group")
|