flapjack 1.1.0 → 1.2.0rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +12 -7
- data/CHANGELOG.md +12 -0
- data/Gemfile +6 -2
- data/Gemfile-ruby1.9 +29 -0
- data/Gemfile-ruby1.9.lock +251 -0
- data/README.md +2 -2
- data/Rakefile +1 -0
- data/etc/flapjack_config.yaml.example +2 -2
- data/features/steps/events_steps.rb +2 -2
- data/features/steps/flapjack-netsaint-parser_steps.rb +1 -1
- data/features/support/env.rb +1 -6
- data/lib/flapjack/cli/import.rb +2 -5
- data/lib/flapjack/cli/purge.rb +4 -4
- data/lib/flapjack/cli/receiver.rb +122 -54
- data/lib/flapjack/cli/server.rb +0 -5
- data/lib/flapjack/coordinator.rb +6 -0
- data/lib/flapjack/data/contact.rb +10 -62
- data/lib/flapjack/data/entity.rb +36 -52
- data/lib/flapjack/data/entity_check.rb +90 -21
- data/lib/flapjack/data/event.rb +4 -5
- data/lib/flapjack/data/notification.rb +8 -10
- data/lib/flapjack/data/notification_rule.rb +32 -35
- data/lib/flapjack/data/tagged.rb +48 -0
- data/lib/flapjack/gateways/jabber.rb +4 -5
- data/lib/flapjack/gateways/jsonapi/check_methods.rb +45 -7
- data/lib/flapjack/gateways/jsonapi/check_presenter.rb +1 -1
- data/lib/flapjack/gateways/jsonapi/contact_methods.rb +8 -2
- data/lib/flapjack/gateways/jsonapi/entity_methods.rb +26 -8
- data/lib/flapjack/gateways/jsonapi/medium_methods.rb +13 -9
- data/lib/flapjack/gateways/jsonapi/metrics_methods.rb +2 -2
- data/lib/flapjack/gateways/jsonapi/notification_rule_methods.rb +1 -1
- data/lib/flapjack/gateways/jsonapi/pagerduty_credential_methods.rb +24 -17
- data/lib/flapjack/gateways/jsonapi/rack/json_params_parser.rb +1 -1
- data/lib/flapjack/gateways/jsonapi/report_methods.rb +4 -4
- data/lib/flapjack/gateways/jsonapi.rb +52 -31
- data/lib/flapjack/gateways/oobetet.rb +2 -3
- data/lib/flapjack/gateways/pagerduty.rb +9 -8
- data/lib/flapjack/gateways/web/public/js/backbone.jsonapi.js +19 -0
- data/lib/flapjack/gateways/web/public/js/flapjack.js +6 -2
- data/lib/flapjack/gateways/web/public/js/modules/contact.js +9 -14
- data/lib/flapjack/gateways/web/public/js/modules/medium.js +1 -0
- data/lib/flapjack/gateways/web/public/js/self_stats.js +1 -1
- data/lib/flapjack/gateways/web/views/edit_contacts.html.erb +3 -3
- data/lib/flapjack/gateways/web.rb +8 -7
- data/lib/flapjack/notifier.rb +2 -4
- data/lib/flapjack/processor.rb +2 -2
- data/lib/flapjack/version.rb +1 -1
- data/lib/flapjack.rb +10 -0
- data/spec/lib/flapjack/coordinator_spec.rb +18 -0
- data/spec/lib/flapjack/data/contact_spec.rb +4 -12
- data/spec/lib/flapjack/data/entity_check_spec.rb +56 -3
- data/spec/lib/flapjack/data/entity_spec.rb +79 -67
- data/spec/lib/flapjack/data/event_spec.rb +78 -78
- data/spec/lib/flapjack/data/notification_rule_spec.rb +4 -2
- data/spec/lib/flapjack/gateways/jsonapi/check_methods_spec.rb +94 -11
- data/spec/lib/flapjack/gateways/jsonapi/entity_methods_spec.rb +84 -0
- data/spec/lib/flapjack/gateways/pagerduty_spec.rb +5 -3
- data/spec/lib/flapjack/gateways/web_spec.rb +3 -3
- data/spec/service_consumers/pact_helper.rb +74 -0
- data/spec/service_consumers/pacts/flapjack-diner_v1.0.json +4522 -0
- data/spec/service_consumers/provider_states_for_flapjack-diner.rb +356 -0
- data/spec/spec_helper.rb +0 -8
- data/spec/support/jsonapi_helper.rb +1 -1
- data/tasks/benchmarks.rake +6 -3
- data/tasks/profile.rake +1 -1
- data/tmp/acknowledge.rb +0 -3
- data/tmp/create_event_ok.rb +0 -3
- data/tmp/create_event_unknown.rb +0 -3
- data/tmp/create_events_failure.rb +0 -3
- data/tmp/create_events_ok.rb +0 -3
- data/tmp/create_events_ok_fail_ack_ok.rb +0 -3
- data/tmp/create_events_ok_failure.rb +2 -5
- data/tmp/create_events_ok_failure_ack.rb +0 -3
- data/tmp/test_json_post.rb +4 -3
- data/tmp/test_notification_rules_api.rb +2 -3
- metadata +13 -8
- data/lib/flapjack/data/tag.rb +0 -61
- data/lib/flapjack/data/tag_set.rb +0 -16
- data/spec/lib/flapjack/data/tag_spec.rb +0 -36
data/lib/flapjack/data/tag.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'set'
|
4
|
-
require 'redis'
|
5
|
-
|
6
|
-
module Flapjack
|
7
|
-
module Data
|
8
|
-
|
9
|
-
class Tag < ::Set
|
10
|
-
|
11
|
-
attr_accessor :name
|
12
|
-
|
13
|
-
def initialize(opts = {})
|
14
|
-
raise "Redis connection not set" unless @redis = opts[:redis]
|
15
|
-
|
16
|
-
@name = opts[:name]
|
17
|
-
preset = @redis.smembers(@name)
|
18
|
-
enum = opts[:create] || []
|
19
|
-
@redis.sadd(@name, enum) unless enum.empty?
|
20
|
-
super(enum | preset)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.find(name, opts)
|
24
|
-
self.new(:name => name,
|
25
|
-
:redis => opts[:redis])
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.find_intersection(tags, opts)
|
29
|
-
@redis = opts[:redis]
|
30
|
-
@redis.sinter(tags)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.create(name, enum = [], opts)
|
34
|
-
self.new(:name => name,
|
35
|
-
:create => enum,
|
36
|
-
:redis => opts[:redis])
|
37
|
-
end
|
38
|
-
|
39
|
-
def add(o)
|
40
|
-
@redis.sadd(@name, o) unless o.empty?
|
41
|
-
super(o)
|
42
|
-
end
|
43
|
-
|
44
|
-
def delete(o)
|
45
|
-
@redis.srem(@name, o)
|
46
|
-
super(o)
|
47
|
-
end
|
48
|
-
|
49
|
-
def merge(o)
|
50
|
-
@redis.sadd(@name, o) unless o.empty?
|
51
|
-
super(o)
|
52
|
-
end
|
53
|
-
|
54
|
-
def to_json(*a)
|
55
|
-
self.to_a.to_json(*a)
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'flapjack/data/tag'
|
3
|
-
|
4
|
-
describe Flapjack::Data::Tag, :redis => true do
|
5
|
-
|
6
|
-
it "adds references to tags" do
|
7
|
-
tags = Flapjack::Data::Tag.create('special', ['apple', 'button', 'carbon'], :redis => @redis)
|
8
|
-
|
9
|
-
expect(tags).to include('carbon')
|
10
|
-
expect(tags).not_to include('chocolate')
|
11
|
-
|
12
|
-
tags.add('chocolate')
|
13
|
-
expect(tags).to include('chocolate')
|
14
|
-
end
|
15
|
-
|
16
|
-
it "deletes references from tags" do
|
17
|
-
tags = Flapjack::Data::Tag.create('special', ['apple', 'button', 'carbon'], :redis => @redis)
|
18
|
-
|
19
|
-
expect(tags).to include('apple')
|
20
|
-
expect(tags).to include('button')
|
21
|
-
|
22
|
-
tags.delete('button')
|
23
|
-
expect(tags).to include('apple')
|
24
|
-
expect(tags).not_to include('button')
|
25
|
-
end
|
26
|
-
|
27
|
-
it "lists references contained in a tag" do
|
28
|
-
t1 = Flapjack::Data::Tag.create('special', ['apple', 'button', 'carbon'], :redis => @redis)
|
29
|
-
|
30
|
-
t2 = Flapjack::Data::Tag.find('special', :redis => @redis)
|
31
|
-
expect(t2).to include('apple')
|
32
|
-
expect(t2).to include('carbon')
|
33
|
-
expect(t2).not_to include('chocolate')
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|