From c4e98eff59d00aa6037d1c99f71ce55933d9a6a2 Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Fri, 8 Nov 2024 12:03:29 -0500 Subject: [PATCH] Fix warnings raised by URI 1.0.1 Correct error message validation to be less brittle to underlying changes in URI's message format. Related to: https://www.github.com/ruby/uri/issues/125 https://github.com/ManageIQ/manageiq/pull/23260 --- .../engine/miq_ae_engine/miq_ae_object.rb | 2 +- spec/miq_ae_engine_spec.rb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_object.rb b/lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_object.rb index 18ba5c26..dcb41893 100644 --- a/lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_object.rb +++ b/lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_object.rb @@ -20,7 +20,7 @@ class MiqAeObject BASE_CLASS = 'object'.freeze BASE_OBJECT = [BASE_NAMESPACE, BASE_CLASS].join(PATH_SEPARATOR) RE_METHOD_CALL = /^[\s]*([\.\/\w]+)[\s]*(?:\((.*)\))?[\s]*$/.freeze - RE_URI_ESCAPE = Regexp.new("[^#{URI::PATTERN::UNRESERVED}]") + RE_URI_ESCAPE = Regexp.new("[^#{URI::RFC2396_Parser::PATTERN::UNRESERVED}]") RE_SUBST = /\$\{([^}]+)\}/.freeze RE_COLLECT_ARRAY = /^[\s]*(?:([\.\/\w]+)[\s]*=[\s]*)?\[(.*)\](?:\.([^.]+))?/.freeze RE_COLLECT_HASH = /^[\s]*(?:([\.\/\w]+)[\s]*=[\s]*)?\{(.*)\}(?:\.([^.]*))*/.freeze diff --git a/spec/miq_ae_engine_spec.rb b/spec/miq_ae_engine_spec.rb index 93f2e5c2..5b69f6e2 100644 --- a/spec/miq_ae_engine_spec.rb +++ b/spec/miq_ae_engine_spec.rb @@ -859,8 +859,7 @@ def before_ae_starts(_options) expect(test_class_name).to receive(:constantize).and_return(test_class) expect(test_class).to receive(:find_by!).with(any_args).and_return(test_class_instance) allow(MiqAeEngine).to receive(:create_automation_attribute_key) - expect($log).to receive(:error) - .with("Error delivering {\"User::user\"=>#{user.id}, nil=>nil} for object \[TestClass.\] with state \[\] to Automate: bad URI(is not URI?): \"_ wrong_uri _\"") + expect($log).to receive(:error).with(/Error delivering.+_ wrong_uri _/) MiqAeEngine.deliver(options) end