Commit 9f966063275074e8d5082d3de1650d699532a50f
Merge branch 'master' of https://archives.plil.fr/grouille/IMA3_P10
Showing
1 changed file
with
24 additions
and
11 deletions
Show diff stats
site/reception.php
@@ -46,17 +46,30 @@ if(isset($_POST['sensor'])) | @@ -46,17 +46,30 @@ if(isset($_POST['sensor'])) | ||
46 | 46 | ||
47 | if(!$err) | 47 | if(!$err) |
48 | { | 48 | { |
49 | - file_put_contents('upload/inventaire.ini', $ini); | ||
50 | - $upload = load($_FILES['fichier']['tmp_name'], $_FILES['fichier']['name']); | ||
51 | - if($upload) | ||
52 | - { | ||
53 | - $message = "Upload du fichier réussi !"; | ||
54 | - $color = "alert-success"; | ||
55 | - } | ||
56 | - else | ||
57 | - { | ||
58 | - $message = "Erreur lors du transfert du fichier..."; | ||
59 | - $color = "alert-danger"; | 49 | + if(file_put_contents('upload/inventaire.ini', $ini)!=NULL) |
50 | + { | ||
51 | + $upload = load($_FILES['fichier']['tmp_name'], $_FILES['fichier']['name']); | ||
52 | + if($upload) | ||
53 | + { | ||
54 | + $message = "Upload du fichier réussi !"; | ||
55 | + $color = "alert-success"; | ||
56 | + $cmd = "ansible-playbook ../Ansible/taskPing.yml -i upload/inventaire.ini"; | ||
57 | + /*if(shell_exec($cmd)==NULL) | ||
58 | + { | ||
59 | + // gestion de l'erreur | ||
60 | + $message = $message." Ansible est lancé !"; | ||
61 | + } | ||
62 | + else | ||
63 | + { | ||
64 | + $message = $message." Echec du lancement d'Ansible !"; | ||
65 | + $color = "alert-danger"; | ||
66 | + }*/ | ||
67 | + } | ||
68 | + else | ||
69 | + { | ||
70 | + $message = "Erreur lors du transfert du fichier..."; | ||
71 | + $color = "alert-danger"; | ||
72 | + } | ||
60 | } | 73 | } |
61 | } | 74 | } |
62 | else | 75 | else |