Description of problem: Embedded ansible worker stops with below error [----] E, [2018-09-24T03:44:15.962201 #22140:b1a37d0] ERROR -- : [URI::InvalidComponentError]: bad component(expected host component): Method:[block in method_missing] Version-Release number of selected component (if applicable): 5.9.4.7 How reproducible: Everytime at Cu environment Steps to Reproduce: 1. 2. 3. Actual results: Embedded ansible worker tries to reactivate itself, Cu follows https://access.redhat.com/solutions/3080891 Then only embedded ansible becomes usable again Expected results: Embedded ansible worker shouldn't stop and should keep running Additional info:
From the backtrace, it's failing in the vmdb/util.rb, trying to build a URI with a bad host component: https://github.com/ManageIQ/manageiq/blob/master/lib/vmdb/util.rb#L18 From there, it's grabbing the http proxy from Settings.yml, advanced settings: proxy = ::Settings.http_proxy[proxy_config].to_hash It tries the http_proxy -> embedded_ansible section from advanced settings/settings.yml first and if blank, uses the default section. If you look at their default section from the logs/configs, there '' values are tripping up this code: :http_proxy: ... :default: :host: '' :password: '' :port: '' :user: '' :scheme: ... :embedded_ansible: :host: :password: :port: :user: :scheme: I am making a code change to ignore these blank values but there is a workaround. vmdb bin/rails console puts SettingsChange.where(:resource_type => "MiqServer").where(:key => "/http_proxy/default").where(:value => "''") If that looks right, you can remove those rows: SettingsChange.where(:resource_type => "MiqServer").where(:key => "/http_proxy/default").where(:value => "''").destroy_all
Note, it looks like the user had previously set a default http proxy in the settings but then wanted to remove it and couldn't, so they set the values to ''. While this works, it caused this bug. A better way to "remove" previously configured values such a http proxy was implemented in 5.10.0.3 in https://bugzilla.redhat.com/show_bug.cgi?id=1576984.
Hello Joe, Thanks for your help on this. Cu tried the rails commands, but it didn't help, he tried few steps on his own which fixed the issue. I have given the details below ================================================ irb(main):001:0> puts SettingsChange.where(:resource_type => "MiqServer").where(:key => "/http_proxy/default").where(:value => "''") PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0 => nil (I was not sure what is exptected so I fired the destoy method) irb(main):002:0> SettingsChange.where(:resource_type => "MiqServer").where(:key => "/http_proxy/default").where(:value => "''").destroy_all => [] Result: nothing changed. But I was able to check this part in our configuration. The quotes are something like a workaround, because it was not possible to remove values from the fields in the advanced settings of manual configuration, so we decided to insert "blanks" in the proxytab to avoid the use of our proxyserver for default requests. We used this from here: https://bugzilla.redhat.com/show_bug.cgi?id=1358433 After saving blank vars, the configuration does not change and the settings are still present, even if we remove them out of our configuration. It would be fine if the developers will fix this as well, because then there is no need of empty quotes. But at least I think I found a way to remove the quotes from the configuration. I will show you what I did: The config part was like this: :default: :host: '' :password: '' :port: '' :user: '' :scheme: I changed it to the following and hit the save button: :default: :host:"" :password:"" :port:"" :user:"" :scheme:"" After a reload the config looks like this :default: :host:"" :password:"" :port:"" :user:"" :scheme:"" Then I just removed the double quotes and set it back to a normal layout: :default: :host: :password: :port: :user: :scheme: It worked! Now Ansible is working as expected again and we are able to go ahead with our development. ================================ I have also informed Cu about the RFE which has been implemented in 5.10.0.3 I think this BZ can be closed now
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/5f55f94f6b887e585220d70c2dd6405c8e39955e commit 5f55f94f6b887e585220d70c2dd6405c8e39955e Author: Joe Rafaniello <jrafanie> AuthorDate: Tue Oct 9 16:08:08 2018 -0400 Commit: Joe Rafaniello <jrafanie> CommitDate: Tue Oct 9 16:08:08 2018 -0400 Handle a blank value for the http_proxy host https://bugzilla.redhat.com/show_bug.cgi?id=1637092 We have no way (in the UI) to remove a previously configured http_proxy host in Settings.yml/advanced settings, so people were forced to save a '' value. This code was only checking for nil values and should really check for blank values. It doesn't make sense to reimplement the regex used by the URI class to parse host values for validity but handling some obvious blank values make sense here. lib/vmdb/util.rb | 2 +- spec/lib/vmdb/util_spec.rb | 6 + 2 files changed, 7 insertions(+), 1 deletion(-)
Thanks for the information Niladri. I'm glad you were able to workaround the issue. That workaround is pretty unfortunate but I'm glad they were able to get it to work. The RFE in 5.10.0.3 should make this much easier. I'll keep this BZ in post because I did change code to not only check for a nil http_proxy host value but also an empty string '' or "" value since it's possible others will have tried to use the empty string trick to "remove" a setting.
New commit detected on ManageIQ/manageiq/hammer: https://github.com/ManageIQ/manageiq/commit/edcd4ffbb84fc0db15c0ac4f3322da0ba75d0b02 commit edcd4ffbb84fc0db15c0ac4f3322da0ba75d0b02 Author: Brandon Dunne <brandondunne> AuthorDate: Wed Oct 10 10:05:50 2018 -0400 Commit: Brandon Dunne <brandondunne> CommitDate: Wed Oct 10 10:05:50 2018 -0400 Merge pull request #18073 from jrafanie/handle_blank_http_proxy_host Handle a blank value for the http_proxy host (cherry picked from commit a17d07e26daeeb1c06e5dd888ee535ae823cbbe9) https://bugzilla.redhat.com/show_bug.cgi?id=1637092 lib/vmdb/util.rb | 2 +- spec/lib/vmdb/util_spec.rb | 6 + 2 files changed, 7 insertions(+), 1 deletion(-)
Followed Steps for Verification: 1. Added Proxy server 2. Enabled Embedded Ansible Server role. 3. Ordered Ansible Playbook via service 4. Removed Proxy server entries with "<<reset>>" keyword in place of previous values. 5. Again ordered same service In both the scenario successfully playbook execution without any error. Verified Version: 5.10.0.24.20181113213923_03b81fd