Skip to content

Commit

Permalink
Fixes #37654 - Use custom snippets to apply errata
Browse files Browse the repository at this point in the history
Refs 2064ec7457b3d41b72c2d48b7df9371f8b09d053 in katello

Closes #3157
  • Loading branch information
maximiliankolb committed Jul 29, 2024
1 parent 7385280 commit 852a5f2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions guides/common/assembly_managing-errata.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ include::modules/ref_parameters-available-for-errata-search.adoc[leveloffset=+1]

include::modules/proc_applying-installable-errata.adoc[leveloffset=+1]

include::modules/proc_running-custom-code-while-applying-errata.adoc[leveloffset=+1]

include::modules/con_subscribing-to-errata-notifications.adoc[leveloffset=+1]

:package-manager: dnf
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[id="running-custom-code-while-applying-errata_{context}"]
= Running custom code while applying errata

You can use custom snippets to run code before and/or after applying errata on hosts.

.Prerequisites
* Check your provisioning template to ensure that it supports the custom snippets you want to use.
+
You can view all job templates that are in use under *Administer* > *Remote Execution Features*.

.Procedure
. In the {ProjectWebUI}, navigate to *Hosts* > *Templates* > *Job Templates*.
. Click *Create Template*.
. In the *Name* field, enter a name for your custom snippet.
The name must start with the name of a template that supports custom snippets:
** Append `custom pre` to the name of a template to run code before applying errata on hosts.
** Append `custom post` to the name of a template to run code after applying errata on hosts.

+
If your template is called `Install Errata - Katello Ansible Default`, name your template `Install Errata - Katello Ansible Default custom pre` or `Install Errata - Katello Ansible Default custom post`.
. On the *Type* tab, select *Snippet*.
. Click *Submit* to create your custom snippet.

[id="cli-running-custom-code-while-applying-errata_{context}"]
.CLI procedure
. Create a plain text file that contains your custom snippet.
. Create the template using `hammer`:
+
[options="nowrap" subs="+quotes"]
----
# hammer template create \
--file "~/_My_Snippet_" \
--locations "_My_Location_" \
--name "_My_Template_Name_custom_pre" \
--organizations "_My_Organization_" \
--type snippet
----

0 comments on commit 852a5f2

Please sign in to comment.