Build Plan race condition modifying kickstart file (199 Views)
Occasional Contributor
Posts: 11
Registered: ‎07-09-2013
Message 1 of 1 (199 Views)

Build Plan race condition modifying kickstart file

There is an apparent race condition somehow related to build plans where, if an in-place manipulation of the kickstart file is done immediately before an out-of-place manipulation (file append), it munges the kickstart file pretty horribly.  Adding a sleep for 5 seconds or more resolves the issue.  Running the scripts outside of HP-SA works as intended.


Scenario: We need to supply a kickstart parameter "unsupported_hardware" for our Red Hat 6.4 and 6.5 builds, but the parameter is not available in 6.3 and older OS's.  I wrote a very simple OGFS script that pre-pends the parameter right before the %packages line in the kickstart file that we use on our 6.4 and 6.5 build plans:




if ! [ -d `dirname "${FILE}"` ] ; then
   echo "Directory `dirname ${FILE}` is not there. Is your target server in the state you expect?"
   exit 2 

sed -i "s/%packages/\n${ksoption}\n\n%packages/" ${FILE}


This seems to do the right thing, until the next build plan step is run (appends packages), which then munges the kickstart file.


from this:




into this:






Hope this helps someone else avoid the same rabbit hole of confusion!





The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.