Skip to content

Commit

Permalink
Fix warnings raised by URI 1.0.1
Browse files Browse the repository at this point in the history
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
ManageIQ/manageiq#23260
  • Loading branch information
jrafanie committed Nov 8, 2024
1 parent 7df03e1 commit c4e98ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions spec/miq_ae_engine_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c4e98ef

Please sign in to comment.