Server Automation Practitioners Forum

Build Plan race condition modifying kickstart file

Regular Contributor.

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!