Bug 684102 - When kickstart is rendered, an runtime execution error occurs when running insmod /lib/ext4.o
When kickstart is rendered, an runtime execution error occurs when running in...
Status: CLOSED DUPLICATE of bug 664724
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Provisioning (Show other bugs)
540
All All
medium Severity medium
: ---
: ---
Assigned To: Tomas Lestach
Red Hat Satellite QA List
:
Depends On:
Blocks: sat54-errata
  Show dependency treegraph
 
Reported: 2011-03-11 00:45 EST by Marcelo Moreira de Mello
Modified: 2011-03-11 03:40 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 684103 (view as bug list)
Environment:
Last Closed: 2011-03-11 03:40:15 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Marcelo Moreira de Mello 2011-03-11 00:45:04 EST
Description of problem:

When kickstart is rendered, an runtime execution error is found when running insmod /lib/ext4.o. Kickstart script is missing the syntax 'then'

Kickstart is rendered as below: 


%pre
echo "Saving RHN keys..." > /dev/ttyS0
SYSTEM_ID=/etc/sysconfig/rhn/systemid
rhn_keys_found=no

insmod /lib/jbd.o
insmod /lib/ext3.o

if [ -f /lib/ext4.o ];
    insmod /lib/ext4.o
fi

Version-Release number of selected component (if applicable):
Red Hat Satellite 5.4

How reproducible:
100%


Steps to Reproduce:
1. Create a kickstart
  
Actual results:

Kickstart is rendered with a error in syntax for Bash script: 

insmod /lib/jbd.o
insmod /lib/ext3.o

if [ -f /lib/ext4.o ];
    insmod /lib/ext4.o
fi


Expected results:

Kickstart executes with no errors: 

if [ -f /lib/ext4.o ]; then
    insmod /lib/ext4.o
fi


# if [ -f /lib/ext4.o ];then    insmod /lib/ext4.o; fi

Additional info:


=== Not Working

[root@server]# if [ -f /lib/ext4.o ];     insmod /lib/ext4.o; fi
bash: syntax error near unexpected token `fi'
[root@server]# echo $?
2

=== Working
[root@server]# if [ -f /lib/ext4.o ];then    insmod /lib/ext4.o; fi
[root@server]# echo $?
0
Comment 1 Marcelo Moreira de Mello 2011-03-11 00:57:13 EST
Hello, 

Investigating the issue, we found the RCA: 

[root@sat-server]# ls -la /var/lib/rhn/kickstarts/snippets/keep_system_id 
-rw-r--r-- 1 tomcat tomcat 1799 Feb 17 09:05 /var/lib/rhn/kickstarts/snippets/keep_system_id

[root@sat-server]# rpm -qf /var/lib/rhn/kickstarts/snippets/keep_system_id
spacewalk-java-1.2.39-35.1.el5sat

[root@sat-server]# grep ext4 -B 2 -A 2  /var/lib/rhn/kickstarts/snippets/keep_system_id

insmod /lib/ext3.o

if [ -f /lib/ext4.o ];
    insmod /lib/ext4.o
fi

[root@sat-server]# rhn-schema-version 
5.4.0.9-1.el5sat


Kind Regards, 
Marcelo Moreira de Mello
Comment 2 Marcelo Moreira de Mello 2011-03-11 01:15:40 EST
Hello, 

This bug already were fixed in Satellite54 code

mmello $> git show 7549871d887d1b821f9efea0d78de03c68ee2d9d
commit 7549871d887d1b821f9efea0d78de03c68ee2d9d
Author: Justin Sherrill <jsherril@redhat.com>
Date:   Tue Oct 26 08:31:36 2010 -0400

    fixing broken if statement in snippet
    (cherry picked from commit bb3183abcf9d69bba1092d8104c456b2e3e996f7)

diff --git a/java/conf/cobbler/snippets/keep_system_id b/java/conf/cobbler/snippets/keep_system_id
index 0f31f37..fdf0213 100644
--- a/java/conf/cobbler/snippets/keep_system_id
+++ b/java/conf/cobbler/snippets/keep_system_id
@@ -7,7 +7,7 @@ rhn_keys_found=no
 insmod /lib/jbd.o
 insmod /lib/ext3.o
 
-if [ -f /lib/ext4.o ];
+if [ -f /lib/ext4.o ]; then
     insmod /lib/ext4.o
 fi
Comment 3 Tomas Lestach 2011-03-11 03:40:15 EST

*** This bug has been marked as a duplicate of bug 664724 ***

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