sqspoller 0.0.1 → 0.0.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.
- data/lib/sqspoller/handlers/puppetsdb.rb +18 -13
- data/lib/sqspoller/version.rb +1 -1
- metadata +3 -3
@@ -16,13 +16,17 @@
|
|
16
16
|
# 'reference_node' will be used as the template. The reference node's
|
17
17
|
# configuration will be used as the basis for the new instance that is created.
|
18
18
|
#
|
19
|
-
# For instance, in the above configuration, if 'auto_scaling_group_name01'
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
# 'certname' that makes sense
|
19
|
+
# For instance, in the above configuration, if 'auto_scaling_group_name01'
|
20
|
+
# autoscales and adds an instance, puppetsdb will take the configuration of
|
21
|
+
# 'reference_node01' and copy the yaml configuration for the new instance
|
22
|
+
# 'i-abcdef' if the new instance created was 'i-abcdef'. This means you must
|
23
|
+
# use the instance-id as your 'certname' in puppet. This cannot be avoided for
|
24
|
+
# AutoScaling cannot provide OS-level information. It is entirely possible to
|
25
|
+
# make this handler more complex to retrieve the 'certname' that makes sense
|
26
|
+
# for your environment.
|
27
|
+
#
|
28
|
+
# Node configurations in the ENC will be removed when the autoscaling event is
|
29
|
+
# terminating an instance (scaling in).
|
26
30
|
|
27
31
|
require 'puppetsdb'
|
28
32
|
require 'json'
|
@@ -35,16 +39,17 @@ module SQSPoller
|
|
35
39
|
domain = conf['domain']
|
36
40
|
template_map = conf['template_map']
|
37
41
|
begin
|
38
|
-
|
39
|
-
sns_msg_data =
|
42
|
+
sns_msg = msg.as_sns_message
|
43
|
+
sns_msg_data = sns_msg.to_h
|
44
|
+
sns_msg_body = JSON.load(msg_data[:body])
|
40
45
|
rescue
|
41
46
|
SQSPoller.warn("#{@queue_name}: Message is not a properly formatted SNS message")
|
42
47
|
return
|
43
48
|
end
|
44
|
-
msg_id =
|
45
|
-
instance_id =
|
46
|
-
event_type =
|
47
|
-
autoscale_name =
|
49
|
+
msg_id = sns_msg.message_id
|
50
|
+
instance_id = sns_msg_body['EC2InstanceId']
|
51
|
+
event_type = sns_msg_body['Event']
|
52
|
+
autoscale_name = sns_msg_body['AutoScalingGroupName']
|
48
53
|
reference_node = template_map[autoscale_name]
|
49
54
|
|
50
55
|
SQSPoller.debug("#{@queue_name}: Found message '#{msg_id}'")
|
data/lib/sqspoller/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Brian Wong
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-
|
17
|
+
date: 2012-12-06 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|