deployment.py: stdout not consumed when deploying changes 27/13627/1
authorJosep Puigdemont <josep.puigdemont@enea.com>
Tue, 3 May 2016 10:44:07 +0000 (12:44 +0200)
committerJosep Puigdemont <josep.puigdemont@enea.com>
Tue, 3 May 2016 11:11:01 +0000 (13:11 +0200)
commitda4623dd38ed8c44a2a21d330a95d40f675de3e8
tree68c7876ee6ea2f1abe36d323501585cda1a102ea
parent54e25063595435b7b3c5c2e093f42cbff7b21dc7
deployment.py: stdout not consumed when deploying changes

During the automatic deployment, when the environment is ready to be
deployed, the deploy.py script will spawn a shell process that will
perform the command "fuel deploy-changes". The standard output of this
process is then piped to a "tee" process, which redirects the output
to the standard output of the shell process, and to a file named
cloud.log. The file is monitored by the deploy script to find out the
status of the deployment, and print it to the log file of the automatic
deployment script, including percentages for each node being
provisioned. However, the deploy script never consumes the standard
output of the shell process. If the shell process produces enough
output, its standard output buffer will fill up, thus making the tee
process block trying to write to its standard output, and the cloud.log
file will not be updated. At this point, the deploy process, which is
monitoring cloud.log, will not detect any progress in the deployment,
and eventually it will time out and assume the deployment failed,
although it might have finished fine after that.

The solution here is to remove the "tee" process from the shell command,
and instead redirect standard output to the cloud.log file.
Another solution would be to actually parse the standard output of the
shell command from the deploy script itself, but that would require a
bit more work, as reading a line at a time might block the script.

Finally, with this patch the cloud.log file won't be deleted unless the
shell process has already finished.

Change-Id: I03a77be42d220b1606e48fc4ca35e22d73a6e583
Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
deploy/cloud/deployment.py