remind101 / stacker_blueprints

DEPRECATED - moved to:
https://github.com/cloudtools/stacker_blueprints
BSD 2-Clause "Simplified" License
39 stars 53 forks source link

Error when using new sns::Topic blueprint without subscriptions. #152

Closed Evnsan closed 6 years ago

Evnsan commented 6 years ago

Hello guys, First of all, thank you for the excellent work.

Today I tried to change an old stack of mine and got the following error:

File "...github.com_remind101_stacker_blueprints/stacker_blueprints/sns.py", line 136, in create_topic

sqs_subs = [sub for sub in topic_subs if sub["Protocol"] == "sqs"]
TypeError: 'NoneType' object is not iterable

Here is my stack:

- name: sns                                                                   
  class_path: stacker_blueprints.sns.Topics                                   
  enabled: true                                                               
  variables:                                                                  
    Topics:                                                                   
      LifeCycleHookTopic:                                                     
      DisplayName: "cassandra-lifecycle-hook"

If I change the stack to define an empty Subscription list, it works

- name: sns                                                                   
  class_path: stacker_blueprints.sns.Topics                                   
  enabled: true                                                               
  variables:                                                                  
    Topics:                                                                   
      LifeCycleHookTopic:                                                     
      DisplayName: "cassandra-lifecycle-hook"
      Subscription: []
Lowercases commented 6 years ago

Hey @Evnsan , thanks for providing this info!

Just to double-check, the original stack is (note the extra indent before DisplayName):

- name: sns                                                                   
  class_path: stacker_blueprints.sns.Topics                                   
  enabled: true                                                               
  variables:                                                                  
    Topics:                                                                   
      LifeCycleHookTopic:                                                     
        DisplayName: "cassandra-lifecycle-hook"

correct?

I've managed to reproduce the error, the patch we added assumes Subscription to be a list. I'll work on a the test and its fix right away.

Evnsan commented 6 years ago

Yes, I forgot the extra spaces in this issue report. My fault. The correct stack are:

- name: sns                                                                   
  class_path: stacker_blueprints.sns.Topics                                   
  enabled: true                                                               
  variables:                                                                  
    Topics:                                                                   
      LifeCycleHookTopic:                                                     
        DisplayName: "cassandra-lifecycle-hook"

and

- name: sns                                                                   
  class_path: stacker_blueprints.sns.Topics                                   
  enabled: true                                                               
  variables:                                                                  
    Topics:                                                                   
      LifeCycleHookTopic:                                                     
        DisplayName: "cassandra-lifecycle-hook"
        Subscription: []

Thanks for the quick response and for the fix

Lowercases commented 6 years ago

@Evnsan Just merged the change. Thanks again for the report!