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 #36837 - Template for convert2rhel analyze #840

Merged
merged 4 commits into from
Oct 23, 2023
Merged
Changes from all 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
48 changes: 48 additions & 0 deletions app/views/templates/script/convert2rhel_analyze.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<%#
name: Convert2RHEL analyze
snippet: false
template_inputs:
- name: Data telemetry
required: false
input_type: user
options: "yes\r\nno"
advanced: false
value_type: plain
default: 'yes'
hidden_value: false
model: JobTemplate
job_category: Convert 2 RHEL
provider_type: script
kind: job_template
%>
<% if @host.operatingsystem.family == 'Redhat' -%>
if ! [ $(id -u) -eq 0 ]; then
echo "You must run convert2rhel as a root user."
exit 1
fi

if ! rpm -q convert2rhel &> /dev/null; then
yum install -y convert2rhel
fi

<% if input('Data telemetry') != "yes" -%>
export CONVERT2RHEL_DISABLE_TELEMETRY=1
<% end -%>

/usr/bin/convert2rhel analyze -y

if ! grep -q ERROR /var/log/convert2rhel/convert2rhel-pre-conversion.json; then
echo "Error: Some error(s) have been found."
echo "Exiting ..."
exit 1
fi

if ! grep -q SKIP /var/log/convert2rhel/convert2rhel-pre-conversion.json; then
echo "Warning: Some check(s) have been skipped."
echo "Exiting ..."
exit 1
fi
<% else %>
echo 'Unsupported OS, it must be from the Red Hat family.'
exit 1
<% end -%>