Bug 678519 - RFE: possibility to override default /etc/motd when kickstarting a system
Summary: RFE: possibility to override default /etc/motd when kickstarting a system
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Provisioning
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
Assignee: Tomas Lestach
QA Contact: Šimon Lukašík
URL:
Whiteboard:
: 663771 (view as bug list)
Depends On:
Blocks: sat54-blockers
TreeView+ depends on / blocked
 
Reported: 2011-02-18 10:51 UTC by Mario Heininger
Modified: 2018-11-14 16:05 UTC (History)
7 users (show)

Fixed In Version: spacewalk-java-1.2.39-101
Doc Type: Bug Fix
Doc Text:
Cause: At the end of a kickstart /etc/motd was set without any possibility to override it. Result: Now custom /etc/motd content may be set either by a custom kickstart snippet or by deploying a configuration file.
Clone Of:
Environment:
Last Closed: 2011-10-20 08:21:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch agains Satellite 5.4 (1.21 KB, patch)
2011-02-18 10:51 UTC, Mario Heininger
no flags Details | Diff
Patch with Code removed from Sourcecode and added as an snipplet (702 bytes, application/x-gzip)
2011-02-18 13:39 UTC, Mario Heininger
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1388 0 normal SHIPPED_LIVE Red Hat Network Satellite server spacewalk-java bug fix and enhancement update 2011-10-20 08:21:14 UTC

Description Mario Heininger 2011-02-18 10:51:34 UTC
Created attachment 479481 [details]
Patch agains Satellite 5.4

Description of problem:
There is an hardcoded last action in the Satellite Kickstartformatter which will add changes to the /etc/motd. Resulting in Destroying the /etc/motd from Config channels.

Version-Release number of selected component (if applicable):
Doesn't work since Satellite 4.1

How reproducible:


Steps to Reproduce:
1. generate an kickstart
2. attach an Activation key
3. put an own /etc/motd file in an Config channel, attachted to the activiation key
4. Install the Machine
  
Actual results:
The /etc/motd is not the /etc/motd from the Config channel, because of hard coded change of the /etc/motd in the Satellite Code


Expected results:
/etc/motd like this one in my config channel


Additional info:

I have created and tested an patch against Satellite-5.4 , it is removing the hrad coded /etc/motd changes. Customers who will have this changes, can include the lines to there Kickstart post.

Comment 1 Mario Heininger 2011-02-18 13:39:55 UTC
Created attachment 479504 [details]
Patch with Code removed from Sourcecode and added as an snipplet

Comment 2 Mario Heininger 2011-02-18 13:41:05 UTC
The fist patch is removing the static code.

The second patch is moving the static code to an snipplet.

Comment 3 Clifford Perry 2011-03-12 18:11:49 UTC
Extracting the .tgz to see content:

Proposed snippet 'append_motd' contents:

echo >> /etc/motd
echo "kickstarted on \\$(date +'%Y-%m-%d')\" >> /etc/motd
echo >> /etc/motd

Proposed diff to remove code and instead call snippet:

--- a/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java	
2011-02-18 10:51:45.000000000 +0100
+++ b/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java	2011-02-18 10:52:07.000000000 +0100
@@ -78,11 +78,6 @@
         Config.get().getString("web.product_name") + " Config Management" +
         NEWLINE;
     private static final String COMMENT = "#" + NEWLINE;
-    private static final String MOTD_FOOTER = "# MOTD" + NEWLINE + "echo >> /etc/motd" +
-        NEWLINE + "echo \"" + Config.get().getString("web.product_name") +
-        " kickstart on \\$(date +'%Y-%m-%d')\" >> /etc/motd" +
-        NEWLINE + "echo >> /etc/motd" + NEWLINE + NEWLINE +
-        "# end of generated kickstart file";
     private static final String BEGINRHN = "%post --logfile " +
        "/root/ks-rhn-post.log" + NEWLINE +
        "# --Begin " + Config.get().getString("web.product_name") +
@@ -245,7 +240,7 @@
         buf.append("%post"); //new %post for last kernel stuff
         addCobblerSnippet(buf, "post_install_kernel_options");
         addCobblerSnippet(buf, "koan_environment");
-        buf.append(MOTD_FOOTER);
+        addCobblerSnippet(buf, "append_motd");
         buf.append(NEWLINE);
         buf.append("$kickstart_done");
         buf.append(NEWLINE);

Comment 4 Tomas Lestach 2011-05-10 12:41:27 UTC
I've changed the proposed patch a bit and added missing stuff.

Current behavior:
- default_motd snippet will be automatically added to the kickstart and used if not overridden
A user has a possibility to override motd:
- by a post kickstart script
- by deploying a configuration file

drawback: /etc/motd doesn't contain product name any more

Anyway, thank you for the patch!

spacewalk.git: f47ed24770fe7e2d8dc5fd3393b6c7faddc269c9

Comment 5 Brian Collins 2011-05-26 14:17:40 UTC
We would be happy to see this patch reach production.  As for the product name not being in /etc/motd, we're fine because it's still in /etc/issue.

Comment 10 Tomas Lestach 2011-09-27 15:40:39 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause:
At the end of a kickstart /etc/motd was set without any possibility to override it.
Result:
Now custom /etc/motd content may be set either by a custom kickstart snippet or by deploying a configuration file.

Comment 11 Šimon Lukašík 2011-10-07 06:34:52 UTC
Moving to Verified:

Testing procedure:
 - formerly created kickstarts set motd as before
 - newly created kickstarts set motd w/out mentioning product
 - with newly created kickstarts, users are able to customize motd
   in a %post script
 - all free variants successfully kickstarts system

Verified against:
spacewalk-java-1.2.39-101

Comment 12 errata-xmlrpc 2011-10-20 08:21:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1388.html

Comment 13 Chris Williams 2012-05-30 16:19:27 UTC
*** Bug 663771 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.