Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions data/templates/centos-ks
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ selinux --permissive
bootloader --location=mbr --driveorder=<%=installDisk%> --boot-drive=<%=installDisk%> --append="crashkernel=auth rhgb"
<% } %>
services --enabled=NetworkManager,sshd
network --device=<%=macaddress%> --noipv6 --activate
#network --device=<%=macaddress%> --noipv6 --activate

# enable syslog
<% if (typeof remoteLogging !== 'undefined' && remoteLogging) { %>
Expand Down Expand Up @@ -113,8 +113,10 @@ net-tools
(
#notify the current progress
<% if( typeof progressMilestones !== 'undefined' && progressMilestones.postConfigUri ) { %>
echo "RackHD POST script started - curl notify post progress"
# the url may contain query, the symbol '&' will mess the command line logic, so the whole url need be wrapped in quotation marks
/usr/bin/curl -X POST -H 'Content-Type:application/json' "http://<%=server%>:<%=port%><%-progressMilestones.postConfigUri%>" || true
echo "RackHD POST script started - curl notify post progress after"
<% } %>

# PLACE YOUR POST DIRECTIVES HERE
Expand Down Expand Up @@ -229,13 +231,26 @@ export PATH
<% } %>

# Download the service to callback to RackHD after OS installation/reboot completion
echo "RackHD POST script wget started"
/usr/bin/wget http://<%=server%>:<%=port%>/api/current/templates/<%=rackhdCallbackScript%>?nodeId=<%=nodeId%> -O /etc/rc.d/init.d/<%=rackhdCallbackScript%>
echo "RackHD POST script chmod callback script"
chmod +x /etc/rc.d/init.d/<%=rackhdCallbackScript%>
# Enable the above service, it should auto-disable after running once
chkconfig <%=rackhdCallbackScript%> on
echo "RackHD POST script chkconfig callback script complete"

#signify ORA the installation completed
/usr/bin/curl -X POST -H 'Content-Type:application/json' http://<%=server%>:<%=port%>/api/current/notification?nodeId=<%=nodeId%>
for retry in $(seq 1 5);
do
/usr/bin/curl -X POST -H 'Content-Type:application/json' http://<%=server%>:<%=port%>/api/current/notification?nodeId=<%=nodeId%>
if [ $? -eq 0 ]; then
echo "Post Notification succeeded"
break
else
echo "Post Notification failed"
sleep 1
fi
done;

) 2>&1 >>/root/install-post-sh.log
EOF
Expand Down
18 changes: 16 additions & 2 deletions data/templates/esx-ks
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,21 @@ esxcli system shutdown reboot -d 10 -r "Rebooting after first boot host configur
%post --interpreter=busybox

#notify the current progress
#retry is to protect against intermittent post script hangs in os-install
<% if( typeof progressMilestones !== 'undefined' && progressMilestones.postConfigUri ) { %>
# the url may contain query, the symbol '&' will mess the command line logic, so the whole url need be wrapped in quotation marks
wget "http://<%=server%>:<%=port%><%-progressMilestones.postConfigUri%>" || true
echo "RackHD POST script started" >> /vmfs/volumes/datastore1/rackhd-post.log
for retry in $(seq 1 5);
do
# the url may contain query, the symbol '&' will mess the command line logic, so the whole url need be wrapped in quotation marks
wget "http://<%=server%>:<%=port%><%-progressMilestones.postConfigUri%>"
if [ $? -eq 0 ]; then
echo "RackHD wget progress posted" >> /vmfs/volumes/datastore1/rackhd-post.log
break
else
echo "RackHD wget progress post failed" >> /vmfs/volumes/datastore1/rackhd-post.log
sleep 1
fi
done;
<% } %>

#disable firewall
Expand All @@ -279,4 +291,6 @@ BODY="{"
BODY=$BODY"\"nodeId\": \"<%=nodeId%>\""
BODY=$BODY"}"
BODYLEN=$(echo -n ${BODY} | wc -c)
echo "RackHD workflow POST success notification started" >> /vmfs/volumes/datastore1/rackhd-post.log
echo -ne "POST /api/current/notification HTTP/1.0\r\nHost: <%=server%>\r\nContent-Type: application/json\r\nContent-Length: ${BODYLEN}\r\n\r\n${BODY}" | nc -i 3 <%=server%> <%=port%>
echo "RackHD post script completed" >> /vmfs/volumes/datastore1/rackhd-post.log
25 changes: 22 additions & 3 deletions data/templates/suse-autoinst.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,17 @@
<% if( typeof progressMilestones !== 'undefined' && progressMilestones.chrootUri ) { %>
curl -X POST -H 'Content-Type:application/json' "http://<%=server%>:<%=port%><%-progressMilestones.chrootUri%>" || true
<% } %>

curl -X POST -H 'Content-Type:application/json' http://<%=server%>:<%=port%>/api/current/notification?nodeId=<%=nodeId%>
for retry in $(seq 1 5);
do
curl -X POST -H 'Content-Type:application/json' http://<%=server%>:<%=port%>/api/current/notification?nodeId=<%=nodeId%>
if [ $? -eq 0 ]; then
echo "Post Notification succeeded" >> /root/rackhd-post.log
break
else
echo "Post Notification failed" >> /root/rackhd-post.log
sleep 1
fi
done;
]]>
</source>
</script>
Expand Down Expand Up @@ -223,7 +232,17 @@
<% }) %>
<% } %>

curl -X POST -H 'Content-Type:application/json' http://<%=server%>:<%=port%>/api/current/notification?nodeId=<%=nodeId%>
for retry in $(seq 1 5);
do
curl -X POST -H 'Content-Type:application/json' http://<%=server%>:<%=port%>/api/current/notification?nodeId=<%=nodeId%>
if [ $? -eq 0 ]; then
echo "Post Notification succeeded" >> /root/rackhd-post.log
break
else
echo "Post Notification failed" >> /root/rackhd-post.log
sleep 1
fi
done;
]]>
</source>
</script>
Expand Down