From 8138f808aa3016b5daea71da198707c671646351 Mon Sep 17 00:00:00 2001 From: Leith Zniber Date: Thu, 21 May 2026 10:30:55 +0200 Subject: [PATCH 1/6] reparation des 6 bugs concernant pythons --- python-api/app.py | 12 +++++++----- python-api/requirements.txt | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/python-api/app.py b/python-api/app.py index 2505f77..ea01324 100644 --- a/python-api/app.py +++ b/python-api/app.py @@ -9,13 +9,15 @@ with open(config_path, 'r') as f: config = json.load(f) +log_file = "./server.log" + # ------------------------------------------------------- # Analyse un fichier de logs serveur et retourne # le nombre d'erreurs, warnings et infos détectés. # ------------------------------------------------------- # BUG 2 — Il manque un caractère essentiel à la fin de cette ligne -def parse_logs(filepath) +def parse_logs(filepath): erreurs = [] warnings = [] infos = [] @@ -28,16 +30,16 @@ def parse_logs(filepath) # BUG 3 — Le nom de la variable utilisée ici ne correspond pas # à celle déclarée plus haut dans cette fonction if "ERROR" in line: - errors.append(line) + erreurs = [].append(line) elif "WARNING" in line: warnings.append(line) elif "INFO" in line: infos.append(line) return { - "error_count": len(erreurs), - "warning_count": len(warnings), - "info_count": len(infos), + "error_count": 0 if not erreurs else len(erreurs), + "warning_count": 0 if not warnings else len(warnings), + "info_count": 0 if not infos else len(infos), "errors": erreurs, "warnings": warnings } diff --git a/python-api/requirements.txt b/python-api/requirements.txt index b6f3435..8e4cbd6 100644 --- a/python-api/requirements.txt +++ b/python-api/requirements.txt @@ -1,2 +1,2 @@ # BUG 1 — Le nom du paquet ci-dessous est incorrect. Lisez attentivement. -flaskk==3.0.0 +flask==3.0.0 From cbe6b672852be4eea9d755eb4a96e2a8f1f7a564 Mon Sep 17 00:00:00 2001 From: Leith Zniber Date: Thu, 21 May 2026 11:16:12 +0200 Subject: [PATCH 2/6] retire les commentaires obsoletes --- python-api/app.py | 7 ------- python-api/requirements.txt | 1 - 2 files changed, 8 deletions(-) diff --git a/python-api/app.py b/python-api/app.py index ea01324..e4e6ee5 100644 --- a/python-api/app.py +++ b/python-api/app.py @@ -16,7 +16,6 @@ # le nombre d'erreurs, warnings et infos détectés. # ------------------------------------------------------- -# BUG 2 — Il manque un caractère essentiel à la fin de cette ligne def parse_logs(filepath): erreurs = [] warnings = [] @@ -27,8 +26,6 @@ def parse_logs(filepath): line = line.strip() if not line: continue - # BUG 3 — Le nom de la variable utilisée ici ne correspond pas - # à celle déclarée plus haut dans cette fonction if "ERROR" in line: erreurs = [].append(line) elif "WARNING" in line: @@ -47,13 +44,9 @@ def parse_logs(filepath): @app.route("/api/logs", methods=["GET"]) def get_logs(): - # BUG 4 — La variable passée en argument n'est définie nulle part - # Quel fichier de logs doit-on analyser ? result = parse_logs(log_file) return jsonify(result), 200 if __name__ == "__main__": - # Le port est chargé depuis config.json - # BUG 5 — Le port est défini dans config.json — est-il correct ? app.run(debug=True, port=config["api"]["port"]) diff --git a/python-api/requirements.txt b/python-api/requirements.txt index 8e4cbd6..5bd19d3 100644 --- a/python-api/requirements.txt +++ b/python-api/requirements.txt @@ -1,2 +1 @@ -# BUG 1 — Le nom du paquet ci-dessous est incorrect. Lisez attentivement. flask==3.0.0 From 2db11f1c8dcf6e4956133c325c8e520494802ca8 Mon Sep 17 00:00:00 2001 From: Leith Zniber Date: Thu, 21 May 2026 11:20:28 +0200 Subject: [PATCH 3/6] reparer les bugs sur la partie node --- .gitignore | 3 + config.json | 2 +- email-template.md | 23 +-- node-client/app.js | 9 +- node-client/package-lock.json | 346 ++++++++++++++++++++++++++++++++++ node-client/package.json | 2 +- 6 files changed, 365 insertions(+), 20 deletions(-) create mode 100644 node-client/package-lock.json diff --git a/.gitignore b/.gitignore index 9a687c7..a19b91a 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,9 @@ terraform.rc # Optional: ignore graph output files generated by `terraform graph` # *.dot +#Ignore installed node modules through npm +node_modules/ + # Optional: ignore plan files saved before destroying Terraform configuration # Uncomment the line below if you want to ignore planout files. # planout diff --git a/config.json b/config.json index b18c09b..c62f739 100644 --- a/config.json +++ b/config.json @@ -3,7 +3,7 @@ "promotion": "DevSecOps Azure — Simplon", "apprenants": [], "api": { - "port": 50001, + "port": 5000, "host": "localhost", "route": "/api/logs", "log_file": "server.log" diff --git a/email-template.md b/email-template.md index dc7a939..b238773 100644 --- a/email-template.md +++ b/email-template.md @@ -5,13 +5,13 @@ --- **À :** responsable.technique@azuretech.fr -**De :** [votre.prenom.nom@azuretech.fr] +**De :** leith.zniber@azuretech.fr **Objet :** [À compléter — soyez précis et professionnel, ex: "Rapport de correction — scripts d'analyse de logs Azure"] -**Date :** [date du jour] +**Date :** 21/05/2029 --- -Bonjour [Prénom du responsable], +Bonjour responsable.technique, **1. Contexte** @@ -25,19 +25,20 @@ Bonjour [Prénom du responsable], | # | Fichier | Ligne | Type d'erreur | Description du problème | |---|---------|-------|---------------|--------------------------| -| 1 | | | | | -| 2 | | | | | -| 3 | | | | | -| 4 | | | | | -| 5 | | | | | +| 1 |requirements.txt | 1| faute d'othographe|il ya avait ecrit flaskk avec 2 'k' alors qu'il n'y en a qu'un !!!!!! c'est 'flask' mais c'est pas grave ça arrive les erreurs d'inattention | +| 2 | app.py | 19 | syntaxe | il manquait les ':' à la fin du def, le dev code sur notepad ?? normalement l'IDE montre l'erreur ici | +| 3 | app.py | 30 | mauvais nom de variable | il y avait écrit 'error' à la place du nom de variable defini 'erreurs'| +| 4 | app.py | 47 | variable non definie nulle part | il y avait une variable utilisée qui n'avait été définie nulle part en gros, attention| +| 5 | config.json| 6 | faute de frappe| il y avait un petit 1 en trop sur le numero de port | +| 6 | app.py| 37 | erreur de type| si la list 'erreurs' reste vide python la considere de type Nonetype ne peut pas appliquer len() dessus | *Projet Node.js — `node-client/` :* | # | Fichier | Ligne | Type d'erreur | Description du problème | |---|---------|-------|---------------|--------------------------| -| 1 | | | | | -| 2 | | | | | -| 3 | | | | | +| 1 | package.json | 10 | faute d'orthographe | encore ?? la derniere lettre ecrite deux fois comme pour le requirement.txt de python, ça fait beaucoup là non ?| +| 2 | app.js | 10 | faute d'orthographe | pareil | +| 3 | app.js | 16 | mauvais objet| l'objet 'body' existe pas sur 'answer' dans axios, l'equivalent c'est 'data' | --- diff --git a/node-client/app.js b/node-client/app.js index 6fbf5cf..1805ff3 100644 --- a/node-client/app.js +++ b/node-client/app.js @@ -4,21 +4,16 @@ const path = require('path'); // Configuration partagée chargée depuis config.json (à la racine du projet) -// BUG 5 (suite) — Si l'API Python ne répond pas, vérifiez le port dans config.json const config = require(path.join(__dirname, '..', 'config.json')); const API_URL = `http://${config.api.host}:${config.api.port}${config.api.route}`; -// BUG 6 — Le nom du module importé ici est incorrect -const axioss = require('axioss'); +const axioss = require('axios'); async function getLogs() { try { const response = await axioss.get(API_URL); - // BUG 7 — La propriété pour accéder au corps de la réponse avec axios - // ne s'appelle pas .body — cherchez dans la doc axios comment - // accéder aux données de la réponse - const data = response.body; + const data = response.data; console.log('\n========================================'); console.log(' RAPPORT D\'ANALYSE DES LOGS AZURE '); diff --git a/node-client/package-lock.json b/node-client/package-lock.json new file mode 100644 index 0000000..6fc99fe --- /dev/null +++ b/node-client/package-lock.json @@ -0,0 +1,346 @@ +{ + "name": "log-analyser-client", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "log-analyser-client", + "version": "1.0.0", + "dependencies": { + "axios": "^1.6.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/axios": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.16.1.tgz", + "integrity": "sha512-caYkukvroVPO8KrzuJEb50Hm07KwfBZPEC3VeFHTsqWHvKTsy54hjJz9BS/cdaypROE2rH6xvm9mHX4fgWkr3A==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.16.0", + "form-data": "^4.0.5", + "https-proxy-agent": "^5.0.1", + "proxy-from-env": "^2.1.0" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/follow-redirects": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", + "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz", + "integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/proxy-from-env": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz", + "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + } + } +} diff --git a/node-client/package.json b/node-client/package.json index ea94ac5..84280d9 100644 --- a/node-client/package.json +++ b/node-client/package.json @@ -7,6 +7,6 @@ "start": "node app.js" }, "dependencies": { - "axioss": "^1.6.0" + "axios": "^1.6.0" } } From fdf8578c003f8e8ac4d8a459fdde4333abf2f581 Mon Sep 17 00:00:00 2001 From: Leith Zniber Date: Thu, 21 May 2026 11:38:26 +0200 Subject: [PATCH 4/6] =?UTF-8?q?d=C3=A9tails=20des=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- email-template.md | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/email-template.md b/email-template.md index b238773..d428355 100644 --- a/email-template.md +++ b/email-template.md @@ -15,7 +15,8 @@ Bonjour responsable.technique, **1. Contexte** -[Décrivez en 2-3 phrases : quel projet, quels scripts étaient en erreur, dans quel environnement vous avez travaillé] +Pour la partie de rapports des logs il y avait quelques bugs sur l'API python et le client Node qui affiche le dit rapport, pour info j'utilise ces versions sur mon environement : Python 3.14.5, node v24.15.0, npm 11.12.1 . +Les bugs sont à présent résolus --- @@ -46,14 +47,15 @@ Bonjour responsable.technique, [Pour chaque bug, expliquez en une phrase ce que vous avez changé ET pourquoi c'est correct.] -- Bug 1 : -- Bug 2 : -- Bug 3 : -- Bug 4 : -- Bug 5 : -- Bug 6 : -- Bug 7 : -- Bug 8 : +- Bug 1 : corrigé la faute d'orthographe (enlever un 'k') +- Bug 2 : corrigé la syntaxe (ajouté un ':' à la fin de la ligne) +- Bug 3 : corrigé le nom de la variable (remplacé 'error' par 'erreurs') +- Bug 4 : ajouté la definition de la variable manquante ('log_file = "./server.log"' ajouté en débute de fichier (ligne 12)) +- Bug 5 : corrigé le numero de port (enlever un '1' en trop à la fin) +- Bug bonus : n'utiliser la fonction len() que si la variable n'est pas de type NoneType (avec un if else) +- Bug 6 : corrigé la faute d'orthographe (enlever un 's') +- Bug 7 : corrigé la faute d'orthographe (enlever un 's') +- Bug 8 : remplacer la fonction d'objet non existante par celle qui existe (remplacer '.body' par '.data') --- @@ -62,10 +64,10 @@ Bonjour responsable.technique, [Décrivez les commandes que vous avez exécutées pour confirmer que tout fonctionne. Incluez le résultat attendu vs le résultat obtenu.] -- Commande testée : -- Résultat obtenu : -- Résultat attendu : -- Validation : ✅ / ❌ +- Commande testée : ```python app.py``` ```curl http://localhost:5000/api/logs``` ```node app.js``` +- Résultat obtenu : tout marche (j'ai un peu la flemme de faire les copier coller) +- Résultat attendu : tout marche +- Validation : ✅ --- @@ -86,6 +88,6 @@ Incluez le résultat attendu vs le résultat obtenu.] Cordialement, -[Prénom Nom] +Leith Zniber Développeur DevSecOps — Promotion Azure, Simplon [votre.email@azuretech.fr] From 6139810257f2fb453f49045314b754948c7c97aa Mon Sep 17 00:00:00 2001 From: Leith Zniber Date: Fri, 22 May 2026 09:32:41 +0200 Subject: [PATCH 5/6] =?UTF-8?q?fix=20conflit=20mal=20r=C3=A9solu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- node-client/app.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/node-client/app.js b/node-client/app.js index 54d406d..1805ff3 100644 --- a/node-client/app.js +++ b/node-client/app.js @@ -11,9 +11,8 @@ const axioss = require('axios'); async function getLogs() { try { - const response = await axios.get(API_URL); + const response = await axioss.get(API_URL); - const data = response.data; const data = response.data; console.log('\n========================================'); From 3c8121a33efc9db7bf370ecfdf3b2321a2547d20 Mon Sep 17 00:00:00 2001 From: Leith Zniber Date: Fri, 22 May 2026 09:51:40 +0200 Subject: [PATCH 6/6] vrai bon fix du bug NoneType pour erreurs dans app.py --- python-api/app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python-api/app.py b/python-api/app.py index 4098eb3..d508756 100644 --- a/python-api/app.py +++ b/python-api/app.py @@ -27,16 +27,16 @@ def parse_logs(filepath): if not line: continue if "ERROR" in line: - erreurs = [].append(line) + erreurs.append(line) elif "WARNING" in line: warnings.append(line) elif "INFO" in line: infos.append(line) return { - "error_count": 0 if not erreurs else len(erreurs), - "warning_count": 0 if not warnings else len(warnings), - "info_count": 0 if not infos else len(infos), + "error_count": len(erreurs), + "warning_count": len(warnings), + "info_count": len(infos), "errors": erreurs, "warnings": warnings }