herdst_worker 0.2.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69a6b8037b56c968110ba5faf884dba06e7657a183f29e54a579c895271d6fcd
|
4
|
+
data.tar.gz: 14a40a92fe51da5820b3db3b6832b82d975a174d562f7863a899db49f050a36c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02ba88a9e9258a8b125f6a237b31d176e5ad99b23e1eaec5b7d7ece07124b24e2915f4f8d3d56f1491f978e85e5d282d71f04c3b5a0e6a1b135ca58e120bbcb4
|
7
|
+
data.tar.gz: 2cc884209904ff5a829fb19c0fd3a5a66317fe76de7c4d8c313f112f6fb9f9b048cbb40779e7b72156e04ebd415084aa8f7b251a27a51849615d3ef0b3b7d6b5
|
@@ -63,7 +63,7 @@ module HerdstWorker
|
|
63
63
|
|
64
64
|
|
65
65
|
def get_tasks_info
|
66
|
-
metadata = make_request!(
|
66
|
+
metadata = make_request!(get_task_metadata_uri)
|
67
67
|
|
68
68
|
ecs_client = Aws::ECS::Client.new(
|
69
69
|
:region => self.secrets["AWS_REGION"],
|
@@ -78,6 +78,24 @@ module HerdstWorker
|
|
78
78
|
:include => ["TAGS"]
|
79
79
|
)
|
80
80
|
end
|
81
|
+
|
82
|
+
|
83
|
+
def get_services_info
|
84
|
+
info = self.get_tasks_info
|
85
|
+
|
86
|
+
ecs_client = Aws::ECS::Client.new(
|
87
|
+
:region => self.secrets["AWS_REGION"],
|
88
|
+
:credentials => self.aws_credentials
|
89
|
+
)
|
90
|
+
|
91
|
+
ecs_client.describe_services({
|
92
|
+
:cluster => info["tasks"][0]["cluster_arn"],
|
93
|
+
:services => [
|
94
|
+
info["tasks"][0]["group"].sub("services:")
|
95
|
+
],
|
96
|
+
:include => ["TAGS"]
|
97
|
+
})
|
98
|
+
end
|
81
99
|
|
82
100
|
|
83
101
|
def get_aws_credentials!
|
@@ -164,7 +182,7 @@ module HerdstWorker
|
|
164
182
|
|
165
183
|
|
166
184
|
private
|
167
|
-
def
|
185
|
+
def get_task_metadata_uri
|
168
186
|
ENV["ECS_CONTAINER_METADATA_URI"].to_s + "/task"
|
169
187
|
end
|
170
188
|
|
@@ -92,6 +92,8 @@ module HerdstWorker
|
|
92
92
|
|
93
93
|
|
94
94
|
def create_email_queue_message(template, company, message_data, attributes = nil, delay = 2)
|
95
|
+
company_key = company.class.name.downcase.to_sym
|
96
|
+
|
95
97
|
# Convert instances of ApplicationRecord to attributes instead of json representation
|
96
98
|
message_data.each do |key, value|
|
97
99
|
message_data[key] = value.attributes if value.is_a?(ActiveRecord::Base)
|
@@ -108,8 +110,8 @@ module HerdstWorker
|
|
108
110
|
data[:type] = "email"
|
109
111
|
data[:template] = template
|
110
112
|
data[:data] = message_data || {}
|
111
|
-
data[:data][
|
112
|
-
|
113
|
+
data[:data][company_key] = company unless data[:data][company_key].present?
|
114
|
+
|
113
115
|
# Add message structure
|
114
116
|
message = Hash.new
|
115
117
|
message[:id] = SecureRandom.hex(32)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herdst_worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Herd.St
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|