Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct the paths that event target IDs are parsed from #195

Merged
merged 2 commits into from
Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,30 @@ def add_target(target_collection, association, ref)
end

def collect_compute_instance_references!(target_collection, ems_event)
instance_id = ems_event.full_data.fetch_path(:payload, 'instance_id')
instance_id = ems_event.full_data.fetch_path(:content, 'payload', 'instance_id')
add_target(target_collection, :vms, instance_id) if instance_id
end

def collect_image_references!(target_collection, ems_event)
resource_id = ems_event.full_data.fetch_path(:payload, 'resource_id')
resource_id = ems_event.full_data.fetch_path(:content, 'payload', 'resource_id')
add_target(target_collection, :images, resource_id) if resource_id
end

def collect_identity_tenant_references!(target_collection, ems_event)
tenant_id = ems_event.full_data.fetch_path(:payload, 'tenant_id') || ems_event.full_data.fetch_path(:payload, 'project_id') || ems_event.full_data.fetch_path(:payload, 'initiator', 'project_id')
tenant_id = ems_event.full_data.fetch_path(:content, 'payload', 'tenant_id') || ems_event.full_data.fetch_path(:content, 'payload', 'project_id') || ems_event.full_data.fetch_path(:content, 'payload', 'initiator', 'project_id')
add_target(target_collection, :cloud_tenants, tenant_id) if tenant_id
end

def collect_orchestration_stack_references!(target_collection, ems_event)
stack_id = ems_event.full_data.fetch_path(:payload, 'stack_id')
tenant_id = ems_event.full_data.fetch_path(:payload, 'tenant_id')
stack_id = ems_event.full_data.fetch_path(:content, 'payload', 'stack_id')
tenant_id = ems_event.full_data.fetch_path(:content, 'payload', 'tenant_id')
target_collection.add_target(:association => :orchestration_stacks, :manager_ref => {:ems_ref => stack_id}, :options => {:tenant_id => tenant_id})
end

def collect_host_aggregate_references!(target_collection, ems_event)
# aggregate events from ceilometer don't have an id field for the aggregate,
# but they do have a "service" field in the form of "aggregate.<id>"
aggregate_id = ems_event.full_data.fetch_path(:payload, 'service')
aggregate_id = ems_event.full_data.fetch_path(:content, 'payload', 'service')
aggregate_id&.sub!('aggregate.', '')
add_target(target_collection, :host_aggregates, aggregate_id) if aggregate_id
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def parse_ems_event_targets(ems_event)
:security_groups
end

resource_id = ems_event.full_data.fetch_path(:payload, 'resource_id')
resource_id = ems_event.full_data.fetch_path(:content, 'payload', 'resource_id')
add_target(target_collection, target_type, resource_id) if resource_id

target_collection.targets
end

def collect_identity_tenant_references!(target_collection, ems_event)
tenant_id = ems_event.full_data.fetch_path(:payload, 'tenant_id') || ems_event.full_data.fetch_path(:payload, 'project_id') || ems_event.full_data.fetch_path(:payload, 'initiator', 'project_id')
tenant_id = ems_event.full_data.fetch_path(:content, 'payload', 'tenant_id') || ems_event.full_data.fetch_path(:content, 'payload', 'project_id') || ems_event.full_data.fetch_path(:content, 'payload', 'initiator', 'project_id')
add_target(target_collection, :cloud_tenants, tenant_id) if tenant_id
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def create_ems_event(event_type, payload)
:message => payload,
:timestamp => "2016-03-13T16:59:01.760000",
:username => "",
:full_data => {:payload => payload },
:full_data => {:content => {'payload' => payload}},
:ems_id => @ems.id
}
EmsEvent.add(@ems.id, event_hash)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def create_ems_event(event_type, payload)
:message => payload,
:timestamp => "2016-03-13T16:59:01.760000",
:username => "",
:full_data => {:payload => payload },
:full_data => {:content => {'payload' => payload}},
:ems_id => @ems.network_manager.id
}
EmsEvent.add(@ems.network_manager.id, event_hash)
Expand Down