|
@@ -70,21 +70,22 @@ $row = $sth->fetch();
|
|
|
$sth->closeCursor();
|
|
|
|
|
|
// Only handle re-ZTP for now.
|
|
|
-if ($row['should_re_ztp'] == 1) {
|
|
|
- header('Content-type: text/plain');
|
|
|
- echo "! RE-ZTP\r\n";
|
|
|
- $logger->info("Sending RE-ZTP message for switch {$sn}");
|
|
|
-
|
|
|
+if ($row['should_re_ztp'] == 2) {
|
|
|
+ // This hack is needed to support IOS trying to copy the file twice.
|
|
|
$sql = 'UPDATE DEVICE_MAP SET should_re_ztp=? WHERE serial_number=?';
|
|
|
+ $logger->info("Saw 'taste' copy from switch ${sn}");
|
|
|
try {
|
|
|
$sth = $dbh->prepare($sql);
|
|
|
- $res = $sth->execute(array(2, $sn));
|
|
|
+ $res = $sth->execute(array(1, $sn));
|
|
|
} catch (PDOException $e) {
|
|
|
$logger->crit("Failed to reset re-ZTP bit for {$sn}: {$e->getMessage()}");
|
|
|
}
|
|
|
exit(0);
|
|
|
-} elseif ($row['should_re_ztp'] == 2) {
|
|
|
- // This hack is needed to support IOS trying to copy the file twice.
|
|
|
+} elseif ($row['should_re_ztp'] == 1) {
|
|
|
+ header('Content-type: text/plain');
|
|
|
+ echo "! RE-ZTP\r\n";
|
|
|
+ $logger->info("Sending RE-ZTP message for switch {$sn}");
|
|
|
+
|
|
|
$sql = 'UPDATE DEVICE_MAP SET should_re_ztp=? WHERE serial_number=?';
|
|
|
try {
|
|
|
$sth = $dbh->prepare($sql);
|