Commit 2a801f51a61d77f51ce34f1f93b43d2707a1b5ce
1 parent
5836ec07
Test de lancement d'Ansible depuis le site
Showing
1 changed file
with
17 additions
and
19 deletions
Show diff stats
site/reception.php
@@ -46,30 +46,28 @@ if(isset($_POST['sensor'])) | @@ -46,30 +46,28 @@ if(isset($_POST['sensor'])) | ||
46 | 46 | ||
47 | if(!$err) | 47 | if(!$err) |
48 | { | 48 | { |
49 | - if(file_put_contents('upload/inventaire.ini', $ini)!=NULL) | ||
50 | - { | ||
51 | - $upload = load($_FILES['fichier']['tmp_name'], $_FILES['fichier']['name']); | ||
52 | - if($upload) | 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 | + $cmd = "ansible-playbook ../Ansible/taskPing.yml -i upload/inventaire.ini"; | ||
56 | + /*if(shell_exec($cmd)==NULL) | ||
53 | { | 57 | { |
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 | - }*/ | 58 | + // gestion de l'erreur |
59 | + $message = $message." Ansible est lancé !"; | ||
67 | } | 60 | } |
68 | else | 61 | else |
69 | { | 62 | { |
70 | - $message = "Erreur lors du transfert du fichier..."; | 63 | + $message = $message." Echec du lancement d'Ansible !"; |
71 | $color = "alert-danger"; | 64 | $color = "alert-danger"; |
72 | - } | 65 | + }*/ |
66 | + } | ||
67 | + else | ||
68 | + { | ||
69 | + $message = "Erreur lors du transfert du fichier..."; | ||
70 | + $color = "alert-danger"; | ||
73 | } | 71 | } |
74 | } | 72 | } |
75 | else | 73 | else |