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 #37342 - Update foreman docs and fix specify matcher documentation #711

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

girijaasoni
Copy link
Contributor

Foreman documentation was outdated and using theforeman.org. This PR updates the doc links according to 'https://docs.theforeman.org/nightly/Managing_Configurations_Ansible/index-foreman-el.html'

It also fixes the misdirected redirect for SpecifyMatchers as reported in https://issues.redhat.com/browse/SAT-24111

Note: This Pr is blocked by RedHatSatellite/foreman_theme_satellite#45

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Please use the proper APIs. Since theforeman/foreman@b566ea8 it's no longer needed to override the root URL isn't because it's creating broken links.

You should be able to use type: 'docs' and get the right base URL (including version) and filename.

major_version = ::ForemanAnsible::VERSION.split('.')[0]
'https://theforeman.org/plugins/foreman_ansible/'\
"#{major_version}.x/index.html"
'https://docs.theforeman.org/nightly/Managing_Configurations_Ansible/index-foreman-el.html'
Copy link
Member

Choose a reason for hiding this comment

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

Never hardcode versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack

Copy link
Member

@ShimShtein ShimShtein left a comment

Choose a reason for hiding this comment

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

You can use documentation_button and documentation_url helpers directly, or wrap them with ansible-specific wrapper to make the code a bit more DRY.

The documentation_url helper calls the links_controller under the hood. In our case we want the docs type of link with its relevant parameters. This will also enable proper branding down the line.

@@ -1,7 +1,8 @@
<% title _("Ansible Roles") %>

<% title_actions ansible_proxy_import(hash_for_import_ansible_roles_path),
documentation_button('#4.1ImportingRoles', :root_url => ansible_doc_url) %>
documentation_button('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_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.

Suggested change
documentation_button('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url) %>
documentation_button(type: 'docs', 'Managing_Configurations_Ansible', chapter: 'Importing_Ansible_Roles_and_Variables_ansible') %>

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure you can pass a position argument in the middle. It's probably

Suggested change
documentation_button('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url) %>
documentation_button('Managing_Configurations_Ansible', type: 'docs', chapter: 'Importing_Ansible_Roles_and_Variables_ansible') %>

Copy link
Member

Choose a reason for hiding this comment

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

Yup, makes sense. Hope it wasn't too confusing

@@ -7,7 +7,7 @@
<p><%= _('No Ansible Roles were found in Foreman. If you want to assign roles to your hosts,
you have to import them first.').html_safe %>
</p>
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('#4.1ImportingRoles', :root_url => ansible_doc_url), target: '_blank') %></p>
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url), target: '_blank') %></p>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url), target: '_blank') %></p>
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url(type: 'docs', 'Managing_Configurations_Ansible', chapter: 'Importing_Ansible_Roles_and_Variables_ansible'), target: '_blank') %></p>

@@ -65,7 +65,7 @@
</fieldset>
</br>
<fieldset>
<h2><%= _("Specify Matchers") %> <%= documentation_button('4.2.6SmartMatchers') %></h2>
<h2><%= _("Specify Matchers") %> <%= documentation_button('#Overriding_Ansible_Variables_in_foreman_ansible', :root_url => ansible_doc_url) %></h2>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<h2><%= _("Specify Matchers") %> <%= documentation_button('#Overriding_Ansible_Variables_in_foreman_ansible', :root_url => ansible_doc_url) %></h2>
<h2><%= _("Specify Matchers") %> <%= documentation_button(type: 'docs', 'Managing_Configurations_Ansible', chapter: 'Overriding_Ansible_Variables_in_foreman_ansible') %></h2>

@@ -2,7 +2,7 @@
<%= stylesheet 'foreman_ansible/foreman-ansible' %>

<%= title_actions display_link_if_authorized(_('New Ansible Variable'), hash_for_new_ansible_variable_path, :class => "btn btn-default no-float"),
documentation_button('#4.3Variables', :root_url => ansible_doc_url)
documentation_button('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_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.

Suggested change
documentation_button('#Importing_Ansible_Roles_and_Variables_ansible', :root_url => ansible_doc_url)
documentation_button(type: 'docs', 'Managing_Configurations_Ansible', chapter: 'Importing_Ansible_Roles_and_Variables_ansible')

@ekohl
Copy link
Member

ekohl commented Jul 22, 2024

@girijaasoni any update on this?

@girijaasoni
Copy link
Contributor Author

girijaasoni commented Jul 26, 2024

@girijaasoni any update on this?

almost done, confused about this comment , should I update it in accordance with 6.15? It will fail for the other versions

ekohl
ekohl previously requested changes Jul 26, 2024
@@ -65,7 +65,7 @@
</fieldset>
</br>
<fieldset>
<h2><%= _("Specify Matchers") %> <%= documentation_button('4.2.6SmartMatchers') %></h2>
<h2><%= _("Specify Matchers") %> <%= documentation_button('Managing_Configurations_Ansible', type: 'docs', chapter: 'Overriding_Ansible_Variables_in_foreman_ansible') %></h2>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<h2><%= _("Specify Matchers") %> <%= documentation_button('Managing_Configurations_Ansible', type: 'docs', chapter: 'Overriding_Ansible_Variables_in_foreman_ansible') %></h2>
<h2><%= _("Specify Matchers") %> <%= documentation_button('Managing_Configurations_Ansible', type: 'docs', chapter: 'Overriding_Ansible_Variables_in_foreman_ansible') %></h2>

@@ -7,7 +7,7 @@
<p><%= _('No Ansible Roles were found in Foreman. If you want to assign roles to your hosts,
you have to import them first.').html_safe %>
</p>
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('#4.1ImportingRoles', :root_url => ansible_doc_url), target: '_blank') %></p>
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('Managing_Configurations_Ansible', type: 'docs', chapter: 'Importing_Ansible_Roles_and_Variables_ansible'), target: '_blank') %></p>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('Managing_Configurations_Ansible', type: 'docs', chapter: 'Importing_Ansible_Roles_and_Variables_ansible'), target: '_blank') %></p>
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('Managing_Configurations_Ansible', type: 'docs', chapter: 'Importing_Ansible_Roles_and_Variables_ansible'), target: '_blank') %></p>

@stejskalleos stejskalleos dismissed ekohl’s stale review July 31, 2024 13:41

requested changes have been applied

@stejskalleos
Copy link
Contributor

LGTM Works as expected.

@stejskalleos stejskalleos merged commit 05f76d2 into theforeman:master Jul 31, 2024
25 of 28 checks passed
@stejskalleos
Copy link
Contributor

Thanks @girijaasoni @ekohl

@Odilhao
Copy link
Member

Odilhao commented Jul 31, 2024

@stejskalleos can we get this cherrypick 13.0.z?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants