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 #28082 - allow listing packages in safemode #8389

Merged
merged 1 commit into from
Oct 18, 2019

Conversation

ares
Copy link
Contributor

@ares ares commented Oct 17, 2019

This is all that is needed for naive host diff report implementation such as

<%#
name: Content host diff
snippet: false
template_inputs:
- name: Host 1
  required: false
  input_type: user
  description: FQDN of the first host to compare
  advanced: false
  value_type: plain
  resource_type: AnsibleRole
- name: Host 2
  required: false
  input_type: user
  description: FQDN of the second host to compare
  advanced: false
  value_type: plain
  resource_type: AnsibleRole
model: ReportTemplate
%>
<%- host1 = Host.find_by_name(input("Host 1")) -%>
<%- host2 = Host.find_by_name(input("Host 2")) -%>
<%- set1 = host1.installed_packages.group_by { |p| p.name } -%>
<%- set2 = host2.installed_packages.group_by { |p| p.name } -%>
<%- (set1.keys | set2.keys).uniq.each do |package_name| -%>
<%-   data = { 'Package' => package_name } -%>
<%-   data[host1.fqdn] = set1[package_name].try(:first).try(:nvra) || '-' -%>
<%-   data[host2.fqdn] = set2[package_name].try(:first).try(:nvra) || '-' -%>
<%-   report_row data -%>
<%- end -%>
<%= report_render -%>

of course the report template needs a bit more enhancements to be fully useful, but this can be used for testing

@theforeman-bot
Copy link

Issues: #28082

Copy link
Member

@jlsherrill jlsherrill left a comment

Choose a reason for hiding this comment

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

Thanks @ares !! Seems very useful !

@jlsherrill
Copy link
Member

ignore test failures for now, i'm not exactly sure why a change in the pulp gems affected master tests but it seems to have now, this will be fixed today

@jturel
Copy link
Member

jturel commented Oct 17, 2019

[test katello]

2 similar comments
@jlsherrill
Copy link
Member

[test katello]

@jlsherrill
Copy link
Member

[test katello]

@jlsherrill jlsherrill merged commit c98fdc1 into Katello:master Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants