Disable debug logs in superuser panel when under multiple instances
They don't work anyway (since logs will be loaded from random instances), so we just disable them
This commit is contained in:
parent
c55c233f1f
commit
9518f1d045
3 changed files with 41 additions and 18 deletions
|
@ -3,6 +3,7 @@
|
|||
import logging
|
||||
import os
|
||||
import string
|
||||
import socket
|
||||
|
||||
import pathvalidate
|
||||
|
||||
|
@ -72,6 +73,7 @@ class SuperUserGetLogsForService(ApiResource):
|
|||
abort(400)
|
||||
|
||||
return {
|
||||
'instance': socket.gethostname(),
|
||||
'logs': '\n'.join(logs)
|
||||
}
|
||||
|
||||
|
@ -91,6 +93,7 @@ class SuperUserSystemLogServices(ApiResource):
|
|||
""" List the system logs for the current system. """
|
||||
if SuperUserPermission().can():
|
||||
return {
|
||||
'instance': socket.gethostname(),
|
||||
'services': list(get_services())
|
||||
}
|
||||
|
||||
|
@ -900,7 +903,7 @@ class SuperUserCustomCertificate(ApiResource):
|
|||
abort(400)
|
||||
|
||||
logger.debug('Saving custom certificate %s', certpath)
|
||||
cert_full_path = config_provider.get_volume_path(EXTRA_CA_DIRECTORY, certpath)
|
||||
cert_full_path = config_provider.get_volume_path(EXTRA_CA_DIRECTORY, certpath)
|
||||
config_provider.save_volume_file(cert_full_path, uploaded_file)
|
||||
logger.debug('Saved custom certificate %s', certpath)
|
||||
|
||||
|
|
|
@ -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