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.
@@ -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' autoscales and adds an instance, puppetsdb will
20
- # take the configuration of 'reference_node01' and copy the yaml configuration
21
- # for the new instance 'i-abcdef' if the new instance created was 'i-abcdef'.
22
- # This means you must use the instance-id as your 'certname' in puppet. This
23
- # cannot be avoided for AutoScaling cannot provide OS-level information. It is
24
- # entirely possible to make this handler more complex to retrieve the
25
- # 'certname' that makes sense for your environment.
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
- msg_data = msg.as_sns_message.to_h
39
- sns_msg_data = JSON.load(msg_data[:body])
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 = msg_data.message_id
45
- instance_id = sns_msg_data['EC2InstanceId']
46
- event_type = sns_msg_data['Event']
47
- autoscale_name = sns_msg_data['AutoScalingGroupName']
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}'")
@@ -1,3 +1,3 @@
1
1
  module SQSPoller
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
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-11-23 00:00:00 -05:00
17
+ date: 2012-12-06 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency