Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of content paths #225

Merged
merged 2 commits into from
Nov 22, 2022

Conversation

matejak
Copy link
Contributor

@matejak matejak commented Nov 15, 2022

Description:

Archives and ready-to-use content use paths differently.

Archives get unpacked into a directory, where they need to be unpacked, analyzed, and cross-checked with e.g. the supplied content path, whereas ready-to-use content can be used directly.

As the current codebase doesn't untangle all possible ways how to obtain existing content in a way of decomposing those into layers, this change just makes the current code working at the expense of making it worse to maintain.

Rationale:

Review Hints:

The PR makes use of the preinst_content_path that refers to absolute filepaths. content_path was supplied by users in case of archives, and represented the relative path to the content file in the context of the archive. In order to make it work, conversion of absolute filenames to relative filenames in the dictionary holding file labels has been dropped, and a subsequent "absolutization" of paths could be dropped too.
However, as the code assumes that the contents of content_path is always relative in case of archives and RPMs, this had to be moved to the method use_downloaded_content.

@matejak matejak added port-RHEL9 Port this PR to the rhel9-branch port-rawhide Port this PR to the master labels Nov 15, 2022
@matejak matejak force-pushed the rhel8_content_paths branch from df98de8 to fb77f55 Compare November 16, 2022 10:01
Archives and ready-to-use content use paths differently.

Archives get unpacked into a directory, where they need to be unpacked,
analyzed, and cross-checked with e.g. the supplied content path,
whereas ready-to-use content can be used directly.

As the current codebase doesn't untangle all possible ways how to obtain
existing content in a way of decomposing those into layers, this change
just makes the current code working at the expense of making it worse to
maintain.
@matejak matejak force-pushed the rhel8_content_paths branch from fb77f55 to 08d3da5 Compare November 16, 2022 12:23
not according their arbitrary string form
@scrutinizer-notifier
Copy link

The inspection completed: 4 new issues, 3 updated code elements

@jan-cerny jan-cerny self-assigned this Nov 21, 2022
@jan-cerny
Copy link
Member

I was testing this by creating an update image from the branch of this PR and using it on the top of the RHEL 8.7 installation. I was using kickstart installation.

  • content-type = scap-security-guide works ok in both text and graphical kickstart installation
  • content-type = rpm works OK in the text mode
  • but in graphical mode - content-type = rpm doesn't work, the OAA section shows "Error loading content" and if I open the OAA section I can see there error message in the red background at the bottom that the profile anssi_bp28_minimal isn't defined in the content . Unfortunately, I don't see any useful error message in the /tmp/anaconda.log of the installing system.

There is the kickstart below that I use:

# values saving a lot of clicks in the GUI
lang en_US.UTF-9
keyboard --xlayouts=us --vckeymap=us
timezone Europe/Prague
rootpw aaaaa
bootloader --location=mbr
clearpart --initlabel --all
autopart --type=plain
skipx

url --url=http://INSERT_URL_HERE/released/rhel-8/RHEL-8/8.7.0/BaseOS/x86_64/os/
repo --name appstream --baseurl=http://INSERT_URL_HERE/released/rhel-8/RHEL-8/8.7.0/AppStream/x86_64/os/

%packages
vim
%end

%addon org_fedora_oscap
  content-type = rpm
  content-url = "http://192.168.122.1:8000/scap-security-guide-0.1.63-4.el8.noarch.rpm"
  content-path = usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml
  profile = anssi_bp28_minimal
%end

The text variant that worked fine differed only by adding text on line before url.

@jan-cerny
Copy link
Member

@matejak has discovered that the problem is that the GUI mode doesn't support shortened profile IDs in the profile key in the org_fedora_ kickstart section. This isn't a problem of this PR, it seems to exist before, and I have reported it as issue in #226

@jan-cerny jan-cerny added this to the 1.3.0 milestone Nov 22, 2022
@jan-cerny
Copy link
Member

so when using a full profile ID in the profile key in the kickstart it works, and see the comment above for other scenarios that I tried

@jan-cerny jan-cerny merged commit 3bc4cf0 into OpenSCAP:rhel8-branch Nov 22, 2022
@matejak matejak mentioned this pull request Nov 22, 2022
@matejak matejak removed the port-RHEL9 Port this PR to the rhel9-branch label Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
port-rawhide Port this PR to the master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rhel-8 tests massively timeout on OSCAP spoke failure
3 participants