flapjack_configurator 1.0.0

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.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +47 -0
  4. data/Dockerfile +11 -0
  5. data/Gemfile +3 -0
  6. data/README.md +139 -0
  7. data/Rakefile +19 -0
  8. data/bin/flapjack_configurator +82 -0
  9. data/example.yml +121 -0
  10. data/flapjack_configurator.gemspec +29 -0
  11. data/lib/flapjack_configurator.rb +32 -0
  12. data/lib/flapjack_configurator/entity_mapper.rb +70 -0
  13. data/lib/flapjack_configurator/flapjack_config.rb +72 -0
  14. data/lib/flapjack_configurator/flapjack_contact.rb +156 -0
  15. data/lib/flapjack_configurator/flapjack_media.rb +23 -0
  16. data/lib/flapjack_configurator/flapjack_notification_rule.rb +39 -0
  17. data/lib/flapjack_configurator/flapjack_object_base.rb +86 -0
  18. data/lib/flapjack_configurator/flapjack_pagerduty.rb +28 -0
  19. data/lib/flapjack_configurator/flapjack_sub_object_base.rb +33 -0
  20. data/lib/flapjack_configurator/user_configuration.rb +107 -0
  21. data/lib/flapjack_configurator/version.rb +6 -0
  22. data/spec/docker_test_wrapper.rb +52 -0
  23. data/spec/functional/all_entity_spec.rb +19 -0
  24. data/spec/functional/config_test_common.rb +58 -0
  25. data/spec/functional/configuration_contact_attributes_spec.rb +18 -0
  26. data/spec/functional/configuration_contact_entities_spec.rb +116 -0
  27. data/spec/functional/configuration_contact_notification_media_spec.rb +73 -0
  28. data/spec/functional/configuration_contact_notification_rules_spec.rb +58 -0
  29. data/spec/functional/configuration_contact_removal_spec.rb +83 -0
  30. data/spec/functional/test_configs/changes/attributes.yaml +24 -0
  31. data/spec/functional/test_configs/changes/notification_media.yaml +155 -0
  32. data/spec/functional/test_configs/changes/notification_rules.yaml +143 -0
  33. data/spec/functional/test_configs/entities.yaml +71 -0
  34. data/spec/functional/test_configs/initial/attributes.yaml +24 -0
  35. data/spec/functional/test_configs/initial/notification_media.yaml +155 -0
  36. data/spec/functional/test_configs/initial/notification_rules.yaml +143 -0
  37. data/spec/functional/test_configs/obj_removal_setup.yaml +106 -0
  38. data/spec/spec_helper.rb +9 -0
  39. metadata +211 -0
@@ -0,0 +1,71 @@
1
+ # Entities search test file
2
+ # No initial/changes as entities aren't attributes
3
+ ---
4
+
5
+ contacts:
6
+ default_test:
7
+ details:
8
+ first_name: TestFirstName
9
+ last_name: TestLastName
10
+ email: test.contact.email@example.com
11
+ timezone: EST5EDT
12
+
13
+ notification_media:
14
+ email:
15
+ address: default.address@example.foo
16
+ interval: 100
17
+ rollup_threshold: 1
18
+
19
+ notification_rules:
20
+ defaults: {}
21
+
22
+ entities:
23
+ default: true
24
+
25
+ search_test:
26
+ details:
27
+ first_name: TestFirstName
28
+ last_name: TestLastName
29
+ email: test.contact.email@example.com
30
+ timezone: EST5EDT
31
+
32
+ notification_media:
33
+ email:
34
+ address: default.address@example.foo
35
+ interval: 100
36
+ rollup_threshold: 1
37
+
38
+ notification_rules:
39
+ defaults: {}
40
+
41
+ # Priority ordering is:
42
+ # 1: Exact entities
43
+ # 2: Blacklist entities
44
+ # 3: Blacklist regex
45
+ # 4: Entities regex
46
+ entities:
47
+ exact:
48
+ # Whitelist a few specific entities
49
+ - testentity-1
50
+ - testentity-3
51
+ # Within blacklists
52
+ - testentity-31
53
+ - testentity-71
54
+
55
+ regex:
56
+ # Whitelist some ranges
57
+ - "testentity-[234][0-9]"
58
+ - "testentity-[678][0-9]"
59
+
60
+ entities_blacklist:
61
+ exact:
62
+ # Blacklist some specific values within the whitelist ranges
63
+ - testentity-21
64
+ - testentity-23
65
+ - testentity-61
66
+ - testentity-63
67
+
68
+ regex:
69
+ # Blacklist some ranges values within the whitelist ranges
70
+ - "testentity-3[0-9]"
71
+ - "testentity-7[0-9]"
@@ -0,0 +1,24 @@
1
+ # Initial attributes write
2
+ ---
3
+
4
+ contacts:
5
+ attribute_test:
6
+ details:
7
+ first_name: TestFirstName
8
+ last_name: TestLastName
9
+ email: test.contact.email@example.com
10
+ timezone: EST5EDT
11
+
12
+ notification_media: {}
13
+ notification_rules: {}
14
+
15
+ # Write two contacts to check for crosstalk
16
+ attribute_test2:
17
+ details:
18
+ first_name: Test2FirstName
19
+ last_name: Test2LastName
20
+ email: test2.contact.email@example.com
21
+ timezone: MST7MDT
22
+
23
+ notification_media: {}
24
+ notification_rules: {}
@@ -0,0 +1,155 @@
1
+ # Initial notification_media test config
2
+ # Intentionally big to hit many scenarios
3
+ ---
4
+ baseline_options:
5
+ notification_media:
6
+ pagerduty:
7
+ subdomain: BaselinePDSubdomain
8
+ token: BaselinePDToken
9
+ service_key: BaselinePDServiceKey
10
+ interval: 100
11
+ rollup_threshold: 10
12
+
13
+ email:
14
+ address: baseline.address@example.foo
15
+ interval: 102
16
+ rollup_threshold: 11
17
+
18
+ jabber:
19
+ address: baseline_room@jabber.example.foo
20
+ interval: 103
21
+ rollup_threshold: 12
22
+
23
+ contacts:
24
+ # nmt: Notification media test
25
+ nmt_baseline_inheritence:
26
+ details:
27
+ first_name: TestFirstName
28
+ last_name: TestLastName
29
+ email: test.contact.email@example.com
30
+ timezone: MST7MDT
31
+ notification_rules:
32
+ defaults: {}
33
+
34
+ notification_media:
35
+ pagerduty: {}
36
+ email: {}
37
+ jabber: {}
38
+
39
+ nmt_default_partial_inheritance:
40
+ details:
41
+ first_name: TestFirstName
42
+ last_name: TestLastName
43
+ email: test.contact.email@example.com
44
+ timezone: MST7MDT
45
+ notification_rules:
46
+ defaults: {}
47
+
48
+ notification_media:
49
+ defaults:
50
+ address: default_address@example.foo
51
+ subdomain: DefaultPDSubdomain
52
+ interval: 200
53
+
54
+ pagerduty: {}
55
+ email: {}
56
+ jabber: {}
57
+
58
+ nmt_default_full_inheritance:
59
+ details:
60
+ first_name: TestFirstName
61
+ last_name: TestLastName
62
+ email: test.contact.email@example.com
63
+ timezone: MST7MDT
64
+ notification_rules:
65
+ defaults: {}
66
+
67
+ notification_media:
68
+ defaults:
69
+ subdomain: DefaultPDSubdomain
70
+ token: DefaultPDToken
71
+ service_key: DefaultPDServiceKey
72
+ address: default.address@example.foo
73
+ interval: 300
74
+ rollup_threshold: 30
75
+
76
+ pagerduty: {}
77
+ email: {}
78
+ jabber: {}
79
+
80
+ nmt_partial_contacts:
81
+ details:
82
+ first_name: TestFirstName
83
+ last_name: TestLastName
84
+ email: test.contact.email@example.com
85
+ timezone: MST7MDT
86
+ notification_rules:
87
+ defaults: {}
88
+
89
+ notification_media:
90
+ pagerduty:
91
+ subdomain: ContactPDSubdomain
92
+
93
+ email:
94
+ address: contact.address@example.com
95
+
96
+ jabber:
97
+ address: contact_room@jabber.example.com
98
+
99
+ nmt_full_contacts:
100
+ details:
101
+ first_name: TestFirstName
102
+ last_name: TestLastName
103
+ email: test.contact.email@example.com
104
+ timezone: MST7MDT
105
+ notification_rules:
106
+ defaults: {}
107
+
108
+ notification_media:
109
+ defaults:
110
+ subdomain: DefaultPDSubdomain
111
+ token: DefaultPDToken
112
+ service_key: DefaultPDServiceKey
113
+ address: default.address@example.foo
114
+ interval: 300
115
+ rollup_threshold: 30
116
+
117
+ pagerduty:
118
+ token: ContactPDToken
119
+ service_key: ContactPDServiceKey
120
+ subdomain: ContactPDSubdomain
121
+ interval: 400
122
+ rollup_threshold: 40
123
+
124
+ email:
125
+ address: contact.address@example.com
126
+ interval: 401
127
+ rollup_threshold: 41
128
+
129
+ jabber:
130
+ address: contact_room@jabber.example.com
131
+ interval: 402
132
+ rollup_threshold: 42
133
+
134
+ nmt_real_world:
135
+ details:
136
+ first_name: TestFirstName
137
+ last_name: TestLastName
138
+ email: test.contact.email@example.com
139
+ timezone: MST7MDT
140
+ notification_rules:
141
+ defaults: {}
142
+
143
+ notification_media:
144
+ defaults:
145
+ interval: 500
146
+ rollup_threshold: 50
147
+
148
+ pagerduty:
149
+ subdomain: ContactPDSubdomain2
150
+
151
+ email:
152
+ address: contact.address2@example.com
153
+
154
+ jabber:
155
+ address: contact_room2@jabber.example.com
@@ -0,0 +1,143 @@
1
+ # Initial test config
2
+ # Intentionally big to hit many scenarios
3
+ ---
4
+ baseline_options:
5
+ notification_rules:
6
+ rules_1:
7
+ warning_media:
8
+ - basething1
9
+ - basething2
10
+ critical_media:
11
+ - basething3
12
+ - basething4
13
+
14
+ rules_2:
15
+ warning_media:
16
+ - basething5
17
+ - basething6
18
+ critical_media:
19
+ - basething7
20
+ - basething8
21
+
22
+ contacts:
23
+ # nrt: Notification media test
24
+ nrt_baseline_inheritence:
25
+ details:
26
+ first_name: TestFirstName
27
+ last_name: TestLastName
28
+ email: test.contact.email@example.com
29
+ timezone: MST7MDT
30
+ notification_media: {}
31
+
32
+ notification_rules:
33
+ rules_1: {}
34
+ rules_2: {}
35
+
36
+ nrt_default_partial_inheritance:
37
+ details:
38
+ first_name: TestFirstName
39
+ last_name: TestLastName
40
+ email: test.contact.email@example.com
41
+ timezone: MST7MDT
42
+ notification_media: {}
43
+
44
+ notification_rules:
45
+ defaults:
46
+ warning_media:
47
+ - defaultthing1
48
+ - defaultthing2
49
+ unknown_media:
50
+ - defaultthing3
51
+ - defaultthing4
52
+
53
+ rules_1: {}
54
+ rules_2: {}
55
+
56
+ nrt_default_full_inheritance:
57
+ details:
58
+ first_name: TestFirstName
59
+ last_name: TestLastName
60
+ email: test.contact.email@example.com
61
+ timezone: MST7MDT
62
+ notification_media: {}
63
+
64
+ notification_rules:
65
+ defaults:
66
+ critical_media:
67
+ - defaultthing5
68
+ - defaultthing6
69
+ warning_media:
70
+ - defaultthing7
71
+ - defaultthing8
72
+ unknown_media:
73
+ - defaultthing9
74
+ - defaultthing10
75
+
76
+ rules_1: {}
77
+ rules_2: {}
78
+
79
+ nrt_partial_contacts:
80
+ details:
81
+ first_name: TestFirstName
82
+ last_name: TestLastName
83
+ email: test.contact.email@example.com
84
+ timezone: MST7MDT
85
+ notification_media: {}
86
+
87
+ notification_rules:
88
+ defaults:
89
+ warning_media:
90
+ - defaultthing11
91
+ - defaultthing12
92
+ unknown_media:
93
+ - defaultthing13
94
+ - defaultthing14
95
+
96
+ rules_1:
97
+ warning_media:
98
+ - contactthing1
99
+ - contactthing2
100
+ critical_media:
101
+ - contactthing3
102
+ - contactthing4
103
+
104
+ rules_2: {}
105
+
106
+ nrt_full_contacts:
107
+ details:
108
+ first_name: TestFirstName
109
+ last_name: TestLastName
110
+ email: test.contact.email@example.com
111
+ timezone: MST7MDT
112
+ notification_media: {}
113
+
114
+ notification_rules:
115
+ defaults:
116
+ warning_media:
117
+ - defaultthing15
118
+ - defaultthing16
119
+ unknown_media:
120
+ - defaultthing17
121
+ - defaultthing18
122
+
123
+ rules_1:
124
+ warning_media:
125
+ - contactthing5
126
+ - contactthing6
127
+ critical_media:
128
+ - contactthing7
129
+ - contactthing8
130
+ unknown_media:
131
+ - contactthing9
132
+ - contactthing10
133
+
134
+ rules_2:
135
+ warning_media:
136
+ - contactthing11
137
+ - contactthing12
138
+ critical_media:
139
+ - contactthing13
140
+ - contactthing14
141
+ unknown_media:
142
+ - contactthing15
143
+ - contactthing16
@@ -0,0 +1,106 @@
1
+ # This config file preps for removing things
2
+
3
+ contacts:
4
+ loaded_test:
5
+ details:
6
+ first_name: TestFirstName
7
+ last_name: TestLastName
8
+ email: test.contact.email@example.com
9
+ timezone: EST5EDT
10
+
11
+ notification_media:
12
+ email:
13
+ address: default.address@example.foo
14
+ interval: 100
15
+ rollup_threshold: 1
16
+
17
+ jabber:
18
+ address: default.room@jabber.example.foo
19
+ interval: 100
20
+ rollup_threshold: 1
21
+
22
+ pagerduty:
23
+ subdomain: PDSubdomain
24
+ token: PDToken
25
+ service_key: PDServiceKey
26
+ interval: 100
27
+ rollup_threshold: 10
28
+
29
+ notification_rules:
30
+ default:
31
+ critical_media:
32
+ - email
33
+
34
+ rule1:
35
+ warning_media:
36
+ - email
37
+ - jabber
38
+ - pagerduty
39
+ critical_media:
40
+ - email
41
+ - jabber
42
+ - pagerduty
43
+
44
+ rule2:
45
+ warning_media:
46
+ - email
47
+ - jabber
48
+ - pagerduty
49
+ critical_media:
50
+ - email
51
+ - jabber
52
+ - pagerduty
53
+
54
+ entities:
55
+ regex:
56
+ - '.*'
57
+
58
+ removal_test:
59
+ details:
60
+ first_name: TestFirstName
61
+ last_name: TestLastName
62
+ email: test.contact.email@example.com
63
+ timezone: EST5EDT
64
+
65
+ notification_media:
66
+ email:
67
+ address: default.address@example.foo
68
+ interval: 100
69
+ rollup_threshold: 1
70
+
71
+ jabber:
72
+ address: default.room@jabber.example.foo
73
+ interval: 100
74
+ rollup_threshold: 1
75
+
76
+ pagerduty:
77
+ subdomain: PDSubdomain
78
+ token: PDToken
79
+ service_key: PDServiceKey
80
+ interval: 100
81
+ rollup_threshold: 10
82
+
83
+ notification_rules:
84
+ rule1:
85
+ warning_media:
86
+ - email
87
+ - jabber
88
+ - pagerduty
89
+ critical_media:
90
+ - email
91
+ - jabber
92
+ - pagerduty
93
+
94
+ rule2:
95
+ warning_media:
96
+ - email
97
+ - jabber
98
+ - pagerduty
99
+ critical_media:
100
+ - email
101
+ - jabber
102
+ - pagerduty
103
+
104
+ entities:
105
+ regex:
106
+ - '.*'