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

Fixes #36838 - Make doc links point to the new docs #547

Merged
merged 6 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions app/helpers/foreman_openscap_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ def scap_doc_url(section = '')
documentation_url(section, root_url: scap_root_url)
end

def doc_flavor
ForemanOpenscap.with_katello? ? 'katello' : 'foreman-el'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My biggest concern is that the OpenSCAP guide is not published in stable branches as foreman-el:

https://github.com/theforeman/foreman-documentation/blob/5a811af4a30310b96a15e3bec708079e04256c31/guides/doc-Managing_Security_Compliance/master.adoc#L14-L18

This results in linking to https://docs.theforeman.org/3.8/Managing_Security_Compliance/index-foreman-el.html (for Foreman 3.8).

This is because it hasn't been properly reviewed. You can see examples such as https://docs.theforeman.org/nightly/Managing_Security_Compliance/index-foreman-el.html#Deploying_a_Policy_in_a_Host_Group_Using_Ansible_security-compliance

You have enabled and synced the operating system repositories to Foreman, and enabled them on the hosts:

Content syncing is not available without Foreman, so that needs to be addressed.

We do publish the nightly docs, just so you can at least review some of it, even if it's broken.

end

def scap_root_url
@scap_root_url ||= begin
version = ForemanOpenscap::VERSION.split('.')[0..-2].join('.')
"https://theforeman.org/plugins/foreman_openscap/#{version}/index.html"
version = SETTINGS[:version]
version = version.tag == 'develop' ? 'nightly' : version.short
"https://docs.theforeman.org/#{version}/Managing_Security_Compliance/index-#{doc_flavor}.html#"
end
end
end
2 changes: 1 addition & 1 deletion app/views/arf_reports/welcome.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<%= _("You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy.") %></br>
</p>
<div class="blank-slate-pf-main-action">
<%= link_to _('Documentation'), documentation_url("4.4ARFReports", :root_url => "https://www.theforeman.org/plugins/foreman_openscap/0.8/index.html#"), :rel => 'external', :class => 'btn btn-primary btn-lg' %>
<%= link_to _('Documentation'), documentation_url("Monitoring_Compliance_security-compliance", :root_url => scap_doc_url), :rel => 'external', :class => 'btn btn-primary btn-lg' %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this use scap_doc_url?

Suggested change
<%= link_to _('Documentation'), documentation_url("Monitoring_Compliance_security-compliance", :root_url => scap_doc_url), :rel => 'external', :class => 'btn btn-primary btn-lg' %>
<%= link_to _('Documentation'), scap_doc_url("Monitoring_Compliance_security-compliance"), :rel => 'external', :class => 'btn btn-primary btn-lg' %>

For a moment I thought about using scap_doc_link but that looks to be not flexible enough.

</div>
</div>
2 changes: 1 addition & 1 deletion app/views/policies/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<% title_actions(
display_link_if_authorized(_("New Compliance Policy"), hash_for_new_policy_path, :class => "btn btn-primary"),
documentation_button('#4.2Creatingpolicywizard', :root_url => scap_doc_url)
documentation_button('Managing_Compliance_Policies_security-compliance', :root_url => scap_doc_url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to create scap_documentation_button for now?

) %>

<%= render :partial => 'list' %>
2 changes: 1 addition & 1 deletion app/views/scap_contents/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% title _("SCAP Contents") %>

<% title_actions(display_link_if_authorized(_("Upload New SCAP Content"), hash_for_new_scap_content_path, :class => 'btn btn-primary'),
documentation_button('#4.1CreatingSCAPcontent', :root_url => scap_doc_url)) %>
documentation_button('Configuring_SCAP_Contents_security-compliance', :root_url => scap_doc_url)) %>

<%= render :partial => 'list' %>
2 changes: 1 addition & 1 deletion app/views/tailoring_files/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% title _("Tailoring Files") %>
<% title_actions(display_link_if_authorized(_("Upload New Tailoring file"), hash_for_new_tailoring_file_path, :class => 'btn btn-primary'),
documentation_button('#4.5Tailoringfiles(foreman_openscap>=0.6.5)', :root_url => scap_doc_url)) %>
documentation_button('tailoring-xccdf-profiles_security-compliance', :root_url => scap_doc_url)) %>
<%= render :partial => 'list' %>
Loading