Bug 1634223

Summary: /usr/bin/smart-proxy-openscap-send script is broken and never run.
Product: Red Hat Satellite Reporter: Hao Chang Yu <hyu>
Component: SCAP PluginAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3.3CC: mhulan, oprazak
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-02 08:16:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hao Chang Yu 2018-09-29 05:10:05 UTC
Description of problem:

Run "/usr/bin/smart-proxy-openscap-send" manually and it will exit immediately without doing anything.

The log file is empty and last update since Feb.
# ls -lrt /var/log/foreman-proxy/openscap-send.log
-rw-r--r--. 1 foreman-proxy foreman-proxy 0 Feb 16  2017 /var/log/foreman-proxy/openscap-send.log

When debugging the script, I found that the plugin settings are not loaded.

1) Edit "/usr/bin/smart-proxy-openscap-send"

puts "Plugin settings: #{Proxy::OpenSCAP::Plugin.settings.to_h}" <==== add this line

# Don't run if OpenSCAP plugin is disabled.
exit unless Proxy::OpenSCAP::Plugin.settings.enabled == true  <===== Script will exit here if enabled is not true

2) Run it again

# /usr/bin/smart-proxy-openscap-send
Plugin settings: {}          <=========== Setting is empty

Tested in Satellite 6.2.15 too and it works.

I found that in Satellite 6.2, the module will autoload the settings if not loaded, but in Satellite 6.3 it will just assign an empty OpenStruct object.

3) Edit /usr/share/foreman-proxy/lib/proxy/pluggable.rb file.

  attr_writer :settings
  def settings
    @settings ||= Proxy::Settings.load_plugin_settings(plugin_default_settings, settings_file)   <=== Add this line that I copy from Satellite 6.2.15
    #@settings ||= OpenStruct.new   <==== Comment out this line
  end

4) Run it again. The plugin settings are loaded now

/usr/bin/smart-proxy-openscap-send
Plugin settings: {:enabled=>true, :spooldir=>"/var/spool/foreman-proxy/openscap", :openscap_send_log_file=>"/var/log/foreman-proxy/openscap-send-22222222.log", :contentdir=>"/var/lib/foreman-proxy/openscap/content", :reportsdir=>"/var/lib/foreman-proxy/openscap/reports", :failed_dir=>"/var/lib/foreman-proxy/openscap/failed", :tailoring_dir=>"/usr/share/foreman-proxy/lib/../openscap/tailoring", :corrupted_dir=>"/var/lib/foreman-proxy/openscap/corrupted"}

Comment 1 Ondřej Pražák 2018-10-02 08:16:59 UTC
Thank you for reporting this bug, it is already tracked as #1542023 and fixed in 6.4, therefore I will close as a duplicate. Feel free to reopen if I misunderstood or if the problem persists in 6.4.

*** This bug has been marked as a duplicate of bug 1542023 ***