Handling exit status different from 0
diff --git a/views/ngXosViews/truckroll/env/default.js b/views/ngXosViews/truckroll/env/default.js
index 3c2745d..65d9e93 100644
--- a/views/ngXosViews/truckroll/env/default.js
+++ b/views/ngXosViews/truckroll/env/default.js
@@ -8,6 +8,6 @@
module.exports = {
host: 'http://apt088.apt.emulab.net:9999/',
- xoscsrftoken: 'wkT4pFidds7J1GqGgDBnwgJladVDAmT2',
- xossessionid: 'n221mn1l6ncofsnx9zihjlssew2crom6'
+ xoscsrftoken: 'u5DXeMzOmHEQxrkhdJ1YuX3FefBv7Wtx',
+ xossessionid: 'z8wjipgmf90l23bqvij6kuj0nhcbwfpx'
};
diff --git a/views/ngXosViews/truckroll/src/js/main.js b/views/ngXosViews/truckroll/src/js/main.js
index af8e6cb..69c0c4f 100644
--- a/views/ngXosViews/truckroll/src/js/main.js
+++ b/views/ngXosViews/truckroll/src/js/main.js
@@ -42,6 +42,7 @@
// clean previous tests
delete this.truckroll.result;
+ delete this.truckroll.is_synced;
const test = new Truckroll(this.truckroll);
this.loader = true;
@@ -54,11 +55,19 @@
this.waitForTest = (id) => {
Truckroll.get({id: id}).$promise
.then((testResult) => {
- if(testResult.is_synced){
+ // if error
+ if(testResult.backend_status.indexOf('2') >= 0 || (testResult.result_code && testResult.result_code.indexOf('2') >= 0)){
+ this.truckroll = angular.copy(testResult);
+ this.loader = false;
+ // not deleting failed test for debugging
+ }
+ // if is synced
+ else if(testResult.is_synced){
this.truckroll = angular.copy(testResult);
Truckroll.delete({id: id});
this.loader = false;
}
+ // else keep polling
else{
$timeout(() => {
this.waitForTest(id);
diff --git a/views/ngXosViews/truckroll/src/templates/truckroll.tpl.html b/views/ngXosViews/truckroll/src/templates/truckroll.tpl.html
index 3454107..9bbdb4c 100644
--- a/views/ngXosViews/truckroll/src/templates/truckroll.tpl.html
+++ b/views/ngXosViews/truckroll/src/templates/truckroll.tpl.html
@@ -73,14 +73,24 @@
<div class="loader"></div>
</div>
</div>
- <div class="row" ng-hide="!vm.truckroll.result">
- <div class="col-xs-12">
- <label>
- Result:
- </label>
+ <section ng-hide="!vm.truckroll.is_synced">
+ <div class="row" style="margin-top: 20px">
+ <div class="col-xs-12" ng-hide="!vm.truckroll.result_code">
+ <label>Result Code</label>
+ </div>
+ <div class="col-xs-12">
+ <pre>{{vm.truckroll.result_code}}</pre>
+ </div>
</div>
- <div class="col-xs-12">
- <pre>{{vm.truckroll.result}}</pre>
+ <div class="row">
+ <div class="col-xs-12">
+ <label>
+ Result:
+ </label>
+ </div>
+ <div class="col-xs-12" ng-hide="!vm.truckroll.result">
+ <pre>{{vm.truckroll.result}}</pre>
+ </div>
</div>
- </div>
+ </section>
</form>
\ No newline at end of file
diff --git a/xos/core/xoslib/dashboards/xosTruckroll.html b/xos/core/xoslib/dashboards/xosTruckroll.html
index e8bb216..d5e2cbf 100644
--- a/xos/core/xoslib/dashboards/xosTruckroll.html
+++ b/xos/core/xoslib/dashboards/xosTruckroll.html
@@ -1,7 +1,8 @@
<!-- browserSync -->
<!-- inject:css -->
-<link rel="stylesheet" href="/static/css/xosTruckroll.css">
+<link rel="stylesheet" href="/css/dev.css">
+<link rel="stylesheet" href="/css/truckroll.css">
<!-- endinject -->
<div id="xosTruckroll">
diff --git a/xos/core/xoslib/static/js/xosTruckroll.js b/xos/core/xoslib/static/js/xosTruckroll.js
index 96d021d..3c5149e 100644
--- a/xos/core/xoslib/static/js/xosTruckroll.js
+++ b/xos/core/xoslib/static/js/xosTruckroll.js
@@ -1 +1 @@
-"use strict";angular.module("xos.truckroll",["ngResource","ngCookies","ngLodash","ui.router","xos.helpers"]).config(["$stateProvider",function(l){l.state("user-list",{url:"/",template:"<truckroll></truckroll>"})}]).config(["$httpProvider",function(l){l.interceptors.push("NoHyperlinks")}]).service("Subscribers",["$resource",function(l){return l("/xos/subscribers/:id")}]).service("Truckroll",["$resource",function(l){return l("/xoslib/truckroll/:id")}]).directive("truckroll",function(){return{restrict:"E",scope:{},bindToController:!0,controllerAs:"vm",templateUrl:"templates/truckroll.tpl.html",controller:["$timeout","Subscribers","Truckroll",function(l,n,t){var r=this;n.query().$promise.then(function(l){r.subscribers=l}),this.loader=!1,this.runTest=function(){delete r.truckroll.result;var l=new t(r.truckroll);r.loader=!0,l.$save().then(function(l){r.waitForTest(l.id)})},this.waitForTest=function(n){t.get({id:n}).$promise.then(function(s){s.is_synced?(r.truckroll=angular.copy(s),t["delete"]({id:n}),r.loader=!1):l(function(){r.waitForTest(n)},2e3)})}}]}}),angular.module("xos.truckroll").run(["$templateCache",function(l){l.put("templates/truckroll.tpl.html",'<div class="row">\n <h2>Virtual Truck Roll</h2>\n <p>Use this page to run test against your subscriber</p>\n</div>\n<form ng-submit="vm.runTest()">\n <div class="row">\n <div class="col-xs-12">\n <label>Target:</label>\n </div>\n <div class="col-xs-12">\n <select class="form-control" ng-model="vm.truckroll.target_id" ng-options="s.id as s.humanReadableName for s in vm.subscribers"></select>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Scope:</label>\n </div>\n <div class="col-xs-6">\n <a \n ng-click="vm.truckroll.scope = \'container\'"\n ng-class="{\'btn-default\': vm.truckroll.scope !== \'container\', \'btn-primary\': vm.truckroll.scope === \'container\'}"\n class="btn btn-block"\n >\n Container\n </a>\n </div>\n <div class="col-xs-6">\n <a \n ng-click="vm.truckroll.scope = \'vm\'"\n ng-class="{\'btn-default\': vm.truckroll.scope !== \'vm\', \'btn-primary\': vm.truckroll.scope === \'vm\'}"\n class="btn btn-block"\n >\n VM\n </a>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Test:</label>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'ping\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'ping\', \'btn-primary\': vm.truckroll.test === \'ping\'}"\n class="btn btn-block">Ping</a>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'traceroute\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'traceroute\', \'btn-primary\': vm.truckroll.test === \'traceroute\'}"\n class="btn btn-block">Traceroute</a>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'tcpdump\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'tcpdump\', \'btn-primary\': vm.truckroll.test === \'tcpdump\'}"\n class="btn btn-block">Tcp Dump</a>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Argument:</label>\n </div>\n <div class="col-xs-12">\n <input type="text" class="form-control" ng-model="vm.truckroll.argument"/>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12" ng-show="!vm.loader">\n <button class="btn btn-success btn-block">Run test</button>\n </div>\n <div class="col-xs-12" ng-show="vm.loader">\n <div class="loader"></div>\n </div>\n </div>\n <div class="row" ng-hide="!vm.truckroll.result">\n <div class="col-xs-12">\n <label>\n Result:\n </label>\n </div>\n <div class="col-xs-12">\n <pre>{{vm.truckroll.result}}</pre>\n </div>\n </div>\n</form>')}]),angular.module("xos.truckroll").run(["$location",function(l){l.path("/")}]),angular.bootstrap(angular.element("#xosTruckroll"),["xos.truckroll"]);
\ No newline at end of file
+"use strict";angular.module("xos.truckroll",["ngResource","ngCookies","ngLodash","ui.router","xos.helpers"]).config(["$stateProvider",function(l){l.state("user-list",{url:"/",template:"<truckroll></truckroll>"})}]).config(["$httpProvider",function(l){l.interceptors.push("NoHyperlinks")}]).service("Subscribers",["$resource",function(l){return l("/xos/subscribers/:id")}]).service("Truckroll",["$resource",function(l){return l("/xoslib/truckroll/:id")}]).directive("truckroll",function(){return{restrict:"E",scope:{},bindToController:!0,controllerAs:"vm",templateUrl:"templates/truckroll.tpl.html",controller:["$timeout","Subscribers","Truckroll",function(l,n,t){var r=this;n.query().$promise.then(function(l){r.subscribers=l}),this.loader=!1,this.runTest=function(){delete r.truckroll.result,delete r.truckroll.is_synced;var l=new t(r.truckroll);r.loader=!0,l.$save().then(function(l){r.waitForTest(l.id)})},this.waitForTest=function(n){t.get({id:n}).$promise.then(function(s){s.backend_status.indexOf("2")>=0||s.result_code&&s.result_code.indexOf("2")>=0?(r.truckroll=angular.copy(s),r.loader=!1):s.is_synced?(r.truckroll=angular.copy(s),t["delete"]({id:n}),r.loader=!1):l(function(){r.waitForTest(n)},2e3)})}}]}}),angular.module("xos.truckroll").run(["$templateCache",function(l){l.put("templates/truckroll.tpl.html",'<div class="row">\n <h2>Virtual Truck Roll</h2>\n <p>Use this page to run test against your subscriber</p>\n</div>\n<form ng-submit="vm.runTest()">\n <div class="row">\n <div class="col-xs-12">\n <label>Target:</label>\n </div>\n <div class="col-xs-12">\n <select class="form-control" ng-model="vm.truckroll.target_id" ng-options="s.id as s.humanReadableName for s in vm.subscribers"></select>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Scope:</label>\n </div>\n <div class="col-xs-6">\n <a \n ng-click="vm.truckroll.scope = \'container\'"\n ng-class="{\'btn-default\': vm.truckroll.scope !== \'container\', \'btn-primary\': vm.truckroll.scope === \'container\'}"\n class="btn btn-block"\n >\n Container\n </a>\n </div>\n <div class="col-xs-6">\n <a \n ng-click="vm.truckroll.scope = \'vm\'"\n ng-class="{\'btn-default\': vm.truckroll.scope !== \'vm\', \'btn-primary\': vm.truckroll.scope === \'vm\'}"\n class="btn btn-block"\n >\n VM\n </a>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Test:</label>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'ping\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'ping\', \'btn-primary\': vm.truckroll.test === \'ping\'}"\n class="btn btn-block">Ping</a>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'traceroute\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'traceroute\', \'btn-primary\': vm.truckroll.test === \'traceroute\'}"\n class="btn btn-block">Traceroute</a>\n </div>\n <div class="col-xs-4">\n <a \n ng-click="vm.truckroll.test = \'tcpdump\'"\n ng-class="{\'btn-default\': vm.truckroll.test !== \'tcpdump\', \'btn-primary\': vm.truckroll.test === \'tcpdump\'}"\n class="btn btn-block">Tcp Dump</a>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>Argument:</label>\n </div>\n <div class="col-xs-12">\n <input type="text" class="form-control" ng-model="vm.truckroll.argument"/>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12" ng-show="!vm.loader">\n <button class="btn btn-success btn-block">Run test</button>\n </div>\n <div class="col-xs-12" ng-show="vm.loader">\n <div class="loader"></div>\n </div>\n </div>\n <section ng-hide="!vm.truckroll.is_synced">\n <div class="row" style="margin-top: 20px">\n <div class="col-xs-12" ng-hide="!vm.truckroll.result_code">\n <label>Result Code</label>\n </div>\n <div class="col-xs-12">\n <pre>{{vm.truckroll.result_code}}</pre>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12">\n <label>\n Result:\n </label>\n </div>\n <div class="col-xs-12" ng-hide="!vm.truckroll.result">\n <pre>{{vm.truckroll.result}}</pre>\n </div>\n </div>\n </section>\n</form>')}]),angular.module("xos.truckroll").run(["$location",function(l){l.path("/")}]),angular.bootstrap(angular.element("#xosTruckroll"),["xos.truckroll"]);
\ No newline at end of file