Skip to content

Commit

Permalink
Fixes #38109 - As a user, I want to install flatpaks on remote hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
sjha4 committed Jan 15, 2025
1 parent b316f4c commit 360cbe9
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/views/foreman/job_templates/flatpak_install.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<%#
kind: job_template
name: Install Flatpak application on host
job_category: Katello
description_format: 'Install Flatpak application %{Application name} on host'
provider_type: script
template_inputs:
- name: Flatpak remote name
description: Name of remote to use on host
input_type: user
required: false
- name: Application name
description: Name of the application to install
input_type: user
required: true
%>

<%
remote_name = input('Flatpak remote name')
app_name = input('Application name')
%>

sudo dbus-launch flatpak install <%= remote_name %> <%= app_name %> --assumeyes
30 changes: 30 additions & 0 deletions app/views/foreman/job_templates/flatpak_login_action.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<%#
kind: job_template
name: Login to flatpak registry via podman
job_category: Katello
description_format: 'Login to flatpak registry via podman'
provider_type: script
template_inputs:
- name: Flatpak registry URL
description: URL of server/capsule
input_type: user
required: true
- name: Username
description: Username for container registry login
input_type: user
required: true
- name: Password
description: Password/Access token for container registry login
input_type: user
required: true
hidden_value: true
%>

<%
server_url = input('Flatpak registry URL')
username = input('Username')
password = input('Password')
%>

sudo podman login <%= server_url %> --username <%= username %> --password <%= password %>
sudo cp /run/containers/0/auth.json /etc/flatpak/oci-auth.json
27 changes: 27 additions & 0 deletions app/views/foreman/job_templates/flatpak_setup.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<%#
kind: job_template
name: Set up Flatpak remote on host
job_category: Katello
description_format: 'Set up Flatpak remote on host'
provider_type: script
template_inputs:
- name: Remote Name
description: Remote name for Flatpak
input_type: user
required: true
- name: Flatpak registry URL
description: URL of server/capsule
input_type: user
required: true
foreign_input_sets:
- template: Login to flatpak registry via podman
exclude: Flatpak registry URL
%>

<%
remote_name = input('Remote Name')
registry_url = input('Flatpak registry URL')
%>

sudo flatpak remote-add --authenticator-name=org.flatpak.Authenticator.Oci <%= remote_name %> oci+<%= registry_url %>/
<%= render_template('Login to flatpak registry via podman', 'Flatpak registry URL': registry_url) %>

0 comments on commit 360cbe9

Please sign in to comment.