OpenSCAP / scaptimony

SCAPtimony is SCAP database and storage server
GNU General Public License v3.0
13 stars 13 forks source link

Arf report in db #12

Closed isimluk closed 9 years ago

isimluk commented 9 years ago

This will finally put the remaining piece to the PostgreSQL database.

I have chosen to create separate table (ArfReportRaw) to hold the ARF bzip. There are two reasons behind this decision: (1) it will help us encapsulate rubygem-openscap usage to separate class (2) performance -- many queries fetch ArfReport, but they never really need to work with bzip file. Fetching many blob unnecessarily would be overhead for rails machinery.

shlomizadok commented 9 years ago

Getting (constantly) the following error:

Start tag expected, '<' not found [oscap_source.c:166]
Unable to parse XML from user memory buffer [oscap_source.c:167]
Could not create Result DataStream session: File is not Result DataStream. [ds_rds_session.c:54]
 (OpenSCAP::OpenSCAPError)
/home/szadok/.rvm/gems/ruby-2.0.0-p481/gems/openscap-0.4.2/lib/openscap/openscap.rb:34:in `raise!'
/home/szadok/.rvm/gems/ruby-2.0.0-p481/gems/openscap-0.4.2/lib/openscap/ds/arf.rb:30:in `initialize'
/home/szadok/dev/repos/scaptimony/app/models/scaptimony/arf_report_raw.rb:48:in `new'
/home/szadok/dev/repos/scaptimony/app/models/scaptimony/arf_report_raw.rb:48:in `build_arf'
/home/szadok/dev/repos/scaptimony/app/models/scaptimony/arf_report_raw.rb:26:in `save_dependent_entities'
shlomizadok commented 9 years ago

One issue regarding the in-success to save the file: The report is created anyhow, and it shouldn't. We should couple (transaction?) the creation of a report to the creation of raw_report (e.g., if the raw_report has failed to save, the the report should fail too)

isimluk commented 9 years ago

Regarding:

Start tag expected, '<' not found [oscap_source.c:166]

You need update openscap to version 1.2.1 and rubygem-openscap to 0.4.1 (as advised in c0fdb5574bbf6345f64c151c4ce0c7960436d917 and https://github.com/OpenSCAP/foreman_openscap/issues/12#issuecomment-69171548). I am sorry, I forget to put it to this PR.

shlomizadok commented 9 years ago

ok, my mistake was to update openscap on the clients and puppetmaster and not on the foreman instance... now it works well. My biggest concern is the size saved on the db. the split to raw report was essential - so it may be ok.

isimluk commented 9 years ago

Can I merge it now and create a new issue for transaction handling?

shlomizadok commented 9 years ago

yeah, lgtm

2015-01-19 20:41 GMT+02:00 Šimon Lukašík notifications@github.com:

Can I merge it now and create a new issue for transaction handling?

— Reply to this email directly or view it on GitHub https://github.com/OpenSCAP/scaptimony/pull/12#issuecomment-70540735.

isimluk commented 9 years ago

Merged, thanks!

Filed OpenSCAP/foreman_openscap#58.