Skip to content

Commit a20a694

Browse files
author
OpenShift Bot
authored
Merge pull request #1047 from spadgett/debug-terminal-ImagePullBackOff
Merged by openshift-bot
2 parents 32c3a25 + 27fb886 commit a20a694

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

app/scripts/controllers/pod.js

+21
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,27 @@ angular.module('openshiftConsole')
389389
return running;
390390
};
391391

392+
$scope.showDebugAction = function(containerStatus) {
393+
if (_.get($scope, 'pod.status.phase') === 'Completed') {
394+
return false;
395+
}
396+
397+
if (annotation($scope.pod, 'openshift.io/build.name')) {
398+
return false;
399+
}
400+
401+
if ($filter('isDebugPod')($scope.pod)) {
402+
return false;
403+
}
404+
405+
var waitingReason = _.get(containerStatus, 'state.waiting.reason');
406+
if (waitingReason === 'ImagePullBackOff' || waitingReason === 'ErrImagePull') {
407+
return false;
408+
}
409+
410+
return !_.get(containerStatus, 'state.running') || !containerStatus.ready;
411+
};
412+
392413
$scope.$on('$destroy', function(){
393414
DataService.unwatchAll(watches);
394415
cleanUpDebugPod();

app/views/browse/_pod-details.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h4>Container {{containerStatus.name}}</h4>
7070
<dd>{{containerStatus.ready}}</dd>
7171
<dt>Restart Count:</dt>
7272
<dd>{{containerStatus.restartCount}}</dd>
73-
<div ng-if="pod.status.phase !== 'Completed' && !(pod | annotation : 'openshift.io/build.name') && (!containerStatus.state.running || !containerStatus.ready) && !(pod | isDebugPod) && ('pods' | canI : 'create')" class="debug-pod-action">
73+
<div ng-if="showDebugAction(containerStatus) && ('pods' | canI : 'create')" class="debug-pod-action">
7474
<a href="" ng-click="debugTerminal(containerStatus.name)" role="button">Debug in Terminal</a>
7575
</div>
7676
</dl>

dist/scripts/scripts.js

+6
Original file line numberDiff line numberDiff line change
@@ -4426,6 +4426,12 @@ var b = 0;
44264426
return a && a.forEach(function(a) {
44274427
a.state && a.state.running && b++;
44284428
}), b;
4429+
}, a.showDebugAction = function(c) {
4430+
if ("Completed" === _.get(a, "pod.status.phase")) return !1;
4431+
if (z(a.pod, "openshift.io/build.name")) return !1;
4432+
if (b("isDebugPod")(a.pod)) return !1;
4433+
var d = _.get(c, "state.waiting.reason");
4434+
return "ImagePullBackOff" !== d && "ErrImagePull" !== d && (!_.get(c, "state.running") || !c.ready);
44294435
}, a.$on("$destroy", function() {
44304436
g.unwatchAll(l), n(), $(window).off("resize.terminalsize");
44314437
});

dist/scripts/templates.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
14651465
"<dd>{{containerStatus.ready}}</dd>\n" +
14661466
"<dt>Restart Count:</dt>\n" +
14671467
"<dd>{{containerStatus.restartCount}}</dd>\n" +
1468-
"<div ng-if=\"pod.status.phase !== 'Completed' && !(pod | annotation : 'openshift.io/build.name') && (!containerStatus.state.running || !containerStatus.ready) && !(pod | isDebugPod) && ('pods' | canI : 'create')\" class=\"debug-pod-action\">\n" +
1468+
"<div ng-if=\"showDebugAction(containerStatus) && ('pods' | canI : 'create')\" class=\"debug-pod-action\">\n" +
14691469
"<a href=\"\" ng-click=\"debugTerminal(containerStatus.name)\" role=\"button\">Debug in Terminal</a>\n" +
14701470
"</div>\n" +
14711471
"</dl>\n" +

0 commit comments

Comments
 (0)