Bob Lantz
Committed by Bob Lantz

unpackONOS: check for failure when extracting tar archive

Change-Id: Iad44ac863449afdbf21d8766479af569f9ba9b6e
(cherry picked from commit a2ccaa56)
...@@ -135,9 +135,13 @@ def unpackONOS( destDir='/tmp', run=quietRun ): ...@@ -135,9 +135,13 @@ def unpackONOS( destDir='/tmp', run=quietRun ):
135 raise Exception( 'Missing ONOS tarball %s - run buck build onos?' 135 raise Exception( 'Missing ONOS tarball %s - run buck build onos?'
136 % tarPath ) 136 % tarPath )
137 info( '(unpacking %s)' % destDir) 137 info( '(unpacking %s)' % destDir)
138 - cmds = ( 'mkdir -p "%s" && cd "%s" && tar xzf "%s"' 138 + success = '*** SUCCESS ***'
139 - % ( destDir, destDir, tarPath) ) 139 + cmds = ( 'mkdir -p "%s" && cd "%s" && tar xzf "%s" && echo "%s"'
140 - run( cmds, shell=True, verbose=True ) 140 + % ( destDir, destDir, tarPath, success ) )
141 + result = run( cmds, shell=True, verbose=True )
142 + if success not in result:
143 + raise Exception( 'Failed to unpack ONOS archive %s in %s:\n%s\n' %
144 + ( tarPath, destDir, result ) )
141 # We can use quietRun for this usually 145 # We can use quietRun for this usually
142 tarOutput = quietRun( 'tar tzf "%s" | head -1' % tarPath, shell=True) 146 tarOutput = quietRun( 'tar tzf "%s" | head -1' % tarPath, shell=True)
143 tarOutput = tarOutput.split()[ 0 ].strip() 147 tarOutput = tarOutput.split()[ 0 ].strip()
......