Sha256: 978cbd9e03532f87b15d741b54e574bd5fc3eecd07fd718b140016f8e3573b04

Contents?: true

Size: 1.82 KB

Versions: 59

Compression:

Stored size: 1.82 KB

Contents

<%#
kind: job_template
name: Module Action - Script Default
model: JobTemplate
job_category: Modules
description_format: "Module %{action} %{module_spec}"
provider_type: script
template_inputs:
- name: pre_script
  description: A script to run prior to the module action
  input_type: user
  required: false
  advanced: true
- name: action
  description: 'The module action enable, install etc.'
  input_type: user
  required: true
  options: "\nlist\ninfo\nenable\ndisable\ninstall\nupdate\nremove\nprovides\nreset"
- name: module_spec
  description: The module specification. module:stream/profile
  input_type: user
  required: false
- name: options
  description: Other optional flags for the action
  input_type: user
  required: false
- name: post_script
  description: A script to run after the module action
  input_type: user
  required: false
  advanced: true
feature: katello_module_stream_action
%>

<%
  supported_families = ['Redhat']
  render_error(N_('Unsupported or no operating system found for this host.')) unless @host.operatingsystem && supported_families.include?(@host.operatingsystem.family)
-%>
#!/bin/bash

# Helper function that exits with a particular message and code.
#
# Usage:
#   exit_with_message "Could not do a thing" 2
#
function exit_with_message {
  echo "${1}, exiting..."
  exit $2
}

<% unless input("pre_script").blank? -%>
  # Pre Script
  <%= input("pre_script") %>
  RETVAL=$?
  [ $RETVAL -eq 0 ] || exit_with_message "Pre script failed" $RETVAL
<% end -%>

# Action
dnf -y module <%= input("action") %> <%= input("module_spec") %> <%= input("options") %>
RETVAL=$?
[ $RETVAL -eq 0 ] || exit_with_message " module action failed" $RETVAL

<% unless input("post_script").blank? -%>
  # Post Script
  <%= input("post_script") %>
  RETVAL=$?
  [ $RETVAL -eq 0 ] || exit_with_message "Post script failed" $RETVAL
<% end -%>

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
foreman_remote_execution-14.1.4 app/views/templates/script/module_action.erb
foreman_remote_execution-14.1.3 app/views/templates/script/module_action.erb
foreman_remote_execution-14.1.2 app/views/templates/script/module_action.erb
foreman_remote_execution-14.1.1 app/views/templates/script/module_action.erb
foreman_remote_execution-14.1.0 app/views/templates/script/module_action.erb
foreman_remote_execution-14.0.2 app/views/templates/script/module_action.erb
foreman_remote_execution-14.0.1 app/views/templates/script/module_action.erb
foreman_remote_execution-13.2.6 app/views/templates/script/module_action.erb
foreman_remote_execution-14.0.0 app/views/templates/script/module_action.erb
foreman_remote_execution-13.2.5 app/views/templates/script/module_action.erb
foreman_remote_execution-13.2.4 app/views/templates/script/module_action.erb
foreman_remote_execution-13.2.3 app/views/templates/script/module_action.erb
foreman_remote_execution-13.2.2 app/views/templates/script/module_action.erb
foreman_remote_execution-12.0.7 app/views/templates/script/module_action.erb
foreman_remote_execution-13.2.1 app/views/templates/script/module_action.erb
foreman_remote_execution-13.2.0 app/views/templates/script/module_action.erb
foreman_remote_execution-10.1.3 app/views/templates/script/module_action.erb
foreman_remote_execution-13.0.0 app/views/templates/script/module_action.erb
foreman_remote_execution-12.0.5 app/views/templates/script/module_action.erb
foreman_remote_execution-12.0.4 app/views/templates/script/module_action.erb