Display error if TFTP post fails
Display an error if the DownloadViaTFTP returns an
error code. This code replaces some unused code.
Resolves openbmc/openbmc#3029
Tested: Verified I see this error if the DownloadViaTFTP call
returns an error code.
Change-Id: I1547689059f45953b29aedda75c0599aec30079d
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index c20b2ca..f73a584 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -841,29 +841,19 @@
return deferred.promise;
},
downloadImage: function(host, filename){
- var deferred = $q.defer();
- $http({
+ return $http({
method: 'POST',
url: DataService.getHost() + "/xyz/openbmc_project/software/action/DownloadViaTFTP",
headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
},
withCredentials: true,
data: JSON.stringify({"data": [filename, host]}),
responseType: 'arraybuffer'
- }).then(function(response, status, headers){
- deferred.resolve({
- data: response,
- status: status,
- headers: headers
- });
- }, function(error){
- console.log(error);
- deferred.reject(error);
+ }).then(function(response){
+ return response.data;
});
-
- return deferred.promise;
},
getBMCEthernetInfo: function(){
var deferred = $q.defer();