[autotest] Automate the deploy process

automated_deploy.py is a script to automate the deploy process. Current
deploy process is:
1. Manually push the prod branch to the lastest tested ToT for both
autotest and chromite.
2. Kick off deploy_server.py script to update all lab server.

This script will automate the whole process. When developers want to
deploy to production, all they need is to run
./site_utils/automated_deploy.py

BUG=None
TEST=unittest and Test on test server.

Change-Id: Ic53278df306c5721c7174b56dc4ff093a5df03a4
Reviewed-on: https://chromium-review.googlesource.com/411533
Reviewed-by: Xixuan Wu <xixuan@chromium.org>
Tested-by: Shuqian Zhao <shuqianz@chromium.org>
Commit-Queue: Shuqian Zhao <shuqianz@chromium.org>
diff --git a/site_utils/lib/infra.py b/site_utils/lib/infra.py
index 84a04c0..4c6fb69 100644
--- a/site_utils/lib/infra.py
+++ b/site_utils/lib/infra.py
@@ -45,9 +45,13 @@
     """
     if not stream_output:
         return subprocess.check_output(cmd, shell=True)
-    proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+
+    proc = subprocess.Popen(
+        cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     while proc.poll() is None:
         print proc.stdout.readline().rstrip('\n')
+    if proc.returncode !=0:
+        raise subprocess.CalledProcessError(proc.returncode, cmd)
 
 
 _host_objects = {}