Merge pull request #2663 from coreos-inc/multi-instance-su-panel
Disable debug logs in superuser panel when under multiple instances
This commit is contained in:
commit
b8e5a21736
3 changed files with 40 additions and 17 deletions
|
@ -3,6 +3,7 @@ import json
|
|||
import logging
|
||||
import os
|
||||
import string
|
||||
import socket
|
||||
|
||||
import pathvalidate
|
||||
|
||||
|
@ -101,6 +102,7 @@ class SuperUserGetLogsForService(ApiResource):
|
|||
abort(400)
|
||||
|
||||
return {
|
||||
'instance': socket.gethostname(),
|
||||
'logs': '\n'.join(logs)
|
||||
}
|
||||
|
||||
|
@ -121,6 +123,7 @@ class SuperUserSystemLogServices(ApiResource):
|
|||
""" List the system logs for the current system. """
|
||||
if SuperUserPermission().can():
|
||||
return {
|
||||
'instance': socket.gethostname(),
|
||||
'services': list(get_services())
|
||||
}
|
||||
|
||||
|
|
|
@ -18,10 +18,12 @@
|
|||
// Monitor any user changes and place the current user into the scope.
|
||||
UserService.updateUserIn($scope);
|
||||
|
||||
$scope.multipleInstances = false;
|
||||
$scope.configStatus = null;
|
||||
$scope.requiresRestart = null;
|
||||
$scope.logsCounter = 0;
|
||||
$scope.changeLog = null;
|
||||
$scope.logsInstance = null;
|
||||
$scope.debugServices = null;
|
||||
$scope.debugLogs = null;
|
||||
$scope.pollChannel = null;
|
||||
|
@ -83,6 +85,13 @@
|
|||
});
|
||||
|
||||
ApiService.getSystemLogs(null, params, /* background */true).then(function(resp) {
|
||||
if ($scope.logsInstance != null && $scope.logsInstance != resp['instance']) {
|
||||
$scope.multipleInstances = true;
|
||||
callback(false);
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.logsInstance = resp['instance'];
|
||||
$scope.debugLogs = resp['logs'];
|
||||
callback(true);
|
||||
}, errorHandler);
|
||||
|
@ -96,6 +105,13 @@
|
|||
$scope.debugService = null;
|
||||
|
||||
ApiService.listSystemLogServices().then(function(resp) {
|
||||
if ($scope.logsInstance != null && $scope.logsInstance != resp['instance']) {
|
||||
$scope.multipleInstances = true;
|
||||
callback(false);
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.logsInstance = resp['instance'];
|
||||
$scope.debugServices = resp['services'];
|
||||
}, ApiService.errorDisplay('Cannot load system logs. Please contact support.'))
|
||||
};
|
||||
|
|
|
@ -87,27 +87,31 @@
|
|||
|
||||
<!-- Debugging tab -->
|
||||
<cor-tab-pane id="debug">
|
||||
<div class="cor-loader" ng-show="!debugServices"></div>
|
||||
<div class="co-alert co-alert-warning" ng-show="multipleInstances">
|
||||
Debug logs cannot be displayed as <span class="registry-name"></span> is running under multiple containers. To retrieve logs, please use your implementation's custom configured logging solution.
|
||||
</div>
|
||||
<div ng-show="!multipleInstances">
|
||||
<div class="cor-loader" ng-show="!debugServices"></div>
|
||||
<div role="tabpanel" ng-show="debugServices">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" ng-repeat="service in debugServices"
|
||||
ng-class="debugService == service ? 'active' : ''">
|
||||
<a ng-click="viewSystemLogs(service)">{{ service }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div role="tabpanel" ng-show="debugServices">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" ng-repeat="service in debugServices"
|
||||
ng-class="debugService == service ? 'active' : ''">
|
||||
<a ng-click="viewSystemLogs(service)">{{ service }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="system-log-download-panel" ng-if="!debugService">
|
||||
Select a service above to view its local logs
|
||||
|
||||
<div class="system-log-download-panel" ng-if="!debugService">
|
||||
Select a service above to view its local logs
|
||||
|
||||
<div>
|
||||
<a class="btn btn-primary" href="/systemlogsarchive?_csrf_token={{ csrf_token }}" ng-safenewtab>
|
||||
<i class="fa fa-download fa-lg" style="margin-right: 4px;"></i> Download All Local Logs (.tar.gz)
|
||||
</a>
|
||||
<div>
|
||||
<a class="btn btn-primary" href="/systemlogsarchive?_csrf_token={{ csrf_token }}" ng-safenewtab>
|
||||
<i class="fa fa-download fa-lg" style="margin-right: 4px;"></i> Download All Local Logs (.tar.gz)
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cor-log-box" logs="debugLogs" ng-show="debugService"></div>
|
||||
</div>
|
||||
<div class="cor-log-box" logs="debugLogs" ng-show="debugService"></div>
|
||||
</div>
|
||||
</cor-tab-pane>
|
||||
|
||||
|
|
Reference in a new issue