Skip to content

Commit

Permalink
Fixing bad parsing of class and PID
Browse files Browse the repository at this point in the history
Before the classes were in format e.g EmsCluster:8, so split(":")
would work. Now all classes are namespaced, so we can't do that.

Fixing by parsing with lookbehind and lookahead, that checks we
parse by single colon.

Fixes BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=1279380
  • Loading branch information
Ladas committed Nov 10, 2015
1 parent 63300b1 commit 7d0ed09
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/metric/ci_mixin/capture.rb
Expand Up @@ -190,7 +190,8 @@ def perf_capture_callback(task_ids, _status, _message, _result)
# Task is done, call the rollup on the parent
task.state, task.status, task.message = [MiqTask::STATE_FINISHED, MiqTask::STATUS_OK, "Performance collection complete, #{task.context_data[:complete].length} out of #{task.context_data[:targets].length} collections completed"]

pclass, pid = task.context_data[:parent].split(":")
# Splitting e.g. "ManageIQ::Providers::Openstack::InfraManager::EmsCluster:8" to class and id
pclass, _, pid = task.context_data[:parent].rpartition(":")
parent = pclass.constantize.find(pid)
msg = "Queueing [#{task.context_data[:interval]}] rollup to #{parent.class.name} id: [#{parent.id}] for time range: [#{task.context_data[:start]} - #{task.context_data[:end]}]"
_log.info "#{msg}..."
Expand Down

0 comments on commit 7d0ed09

Please sign in to comment.