Module: Scooter::HttpDispatchers::Activity

Includes:
V1, Utilities
Included in:
ConsoleDispatcher
Defined in:
lib/scooter/httpdispatchers/activity.rb,
lib/scooter/httpdispatchers/activity/v1/v1.rb

Defined Under Namespace

Modules: V1

Instance Method Summary collapse

Methods included from V1

#get_classifier_events, #get_rbac_events

Instance Method Details

#activity_database_matches_self?(replica_host) ⇒ Boolean

Used to compare replica activity to master. Raises exception if it does not match.

Parameters:

  • host_name (String)

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/scooter/httpdispatchers/activity.rb', line 18

def activity_database_matches_self?(replica_host)
  # Save a beaker host_hash[:vmhostname], set it to the supplied host_name param,
  # and then set it back to the original at the end of the ensure. The :vmhostname
  #overrides the host.hostname, and nothing should win out over it.
  original_host_name = host.host_hash[:vmhostname]
  begin
    host.host_hash[:vmhostname] = replica_host.hostname

    other_rbac_events       = get_rbac_events.env.body
    other_classifier_events = get_classifier_events.env.body
  ensure
    host.host_hash[:vmhostname] = original_host_name
  end

  self_rbac_events       = get_rbac_events.env.body
  self_classifier_events = get_classifier_events.env.body

  rbac_events_match       = other_rbac_events == self_rbac_events
  classifier_events_match = other_classifier_events == self_classifier_events

  errors = ''
  errors << "Rbac events do not match\r\n" unless rbac_events_match
  errors << "Classifier events do not match\r\n" unless classifier_events_match

  host.logger.warn(errors.chomp) unless errors.empty?
  errors.empty?
end

#set_activity_service_path(connection = self.connection) ⇒ Object



11
12
13
14
# File 'lib/scooter/httpdispatchers/activity.rb', line 11

def set_activity_service_path(connection=self.connection)
  set_url_prefix
  connection.url_prefix.path = '/activity-api'
end