From 7d0ed09773801afa98c87eb2b6cc21f96122b36f Mon Sep 17 00:00:00 2001 From: Ladislav Smola Date: Mon, 9 Nov 2015 15:06:33 +0100 Subject: [PATCH] Fixing bad parsing of class and PID 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 --- app/models/metric/ci_mixin/capture.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/metric/ci_mixin/capture.rb b/app/models/metric/ci_mixin/capture.rb index fcef5d1dc79..ee95de7b232 100644 --- a/app/models/metric/ci_mixin/capture.rb +++ b/app/models/metric/ci_mixin/capture.rb @@ -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}..."