From 4675fff26d6e03daf75b1e9b5e15d95544601950 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sun, 3 Jun 2018 16:25:49 +0200 Subject: [PATCH] Correct Probable insecure usage of temp file/directory #820 --- glances/main.py | 3 ++- .../js/components/plugin-docker/controller.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/glances/main.py b/glances/main.py index 52c5c121..b9c9e374 100644 --- a/glances/main.py +++ b/glances/main.py @@ -21,6 +21,7 @@ import argparse import sys +import tempfile from glances import __version__, psutil_version from glances.compat import input @@ -170,7 +171,7 @@ Examples of use: dest='export_json_file', help='file path for JSON exporter') parser.add_argument('--export-graph-path', - default='/tmp', + default=tempfile.gettempdir(), dest='export_graph_path', help='Folder for Graph exporter') # Client/Server option diff --git a/glances/outputs/static/js/components/plugin-docker/controller.js b/glances/outputs/static/js/components/plugin-docker/controller.js index 10d743dd..9a6392ae 100644 --- a/glances/outputs/static/js/components/plugin-docker/controller.js +++ b/glances/outputs/static/js/components/plugin-docker/controller.js @@ -4,14 +4,6 @@ export default function GlancesPluginDockerController($scope, GlancesStats) { vm.containers = []; vm.version = null; - vm.$onInit = function () { - loadData(GlancesStats.getData()); - }; - - $scope.$on('data_refreshed', function (event, data) { - loadData(data); - }); - var loadData = function (data) { var stats = data.stats['docker']; vm.containers = []; @@ -40,4 +32,12 @@ export default function GlancesPluginDockerController($scope, GlancesStats) { vm.version = stats['version']['Version']; } + + vm.$onInit = function () { + loadData(GlancesStats.getData()); + }; + + $scope.$on('data_refreshed', function (event, data) { + loadData(data); + }); }