Pārlūkot izejas kodu

Correct some spacing issues and make sure we do more for all switch types.

Joe Clarke 8 gadi atpakaļ
vecāks
revīzija
19b0a1efcd
1 mainītis faili ar 51 papildinājumiem un 51 dzēšanām
  1. 51 51
      eem/tm_sw_autoconf.tcl

+ 51 - 51
eem/tm_sw_autoconf.tcl

@@ -20,10 +20,10 @@ proc init {} {
     variable map
     variable alphanumeric a-zA-Z0-9
     for {set i 0} {$i <= 256} {incr i} {
-	set c [format %c $i]
-	if { ! [string match \[$alphanumeric\] $c] } {
-	    set map($c) %[format %.2x $i]
-	}
+        set c [format %c $i]
+        if { ! [string match \[$alphanumeric\] $c] } {
+            set map($c) %[format %.2x $i]
+        }
     }
     array set map { " " + \n %0d%0a }
 }
@@ -79,7 +79,7 @@ if { [catch {cli_exec $cli(fd) "show ip int brie | include Ethernet"} result] }
 set intfs 0
 foreach line [split $result "\n"] {
     if { [regexp {Ethernet} $line] } {
-	incr intfs
+        incr intfs
     }
 }
 
@@ -97,10 +97,10 @@ set config {}
 
 foreach line [split [::http::data $tok] "\n"] {
     if { [regexp {^Image: (\S+)} $line -> res] } {
-	set image $res
+        set image $res
     }
     if { [regexp {^Config: (\S+)} $line -> res] } {
-	set config $res
+        set config $res
     }
 }
 
@@ -112,75 +112,75 @@ if { $image == {} && $config == {} } {
 
 if { $image != {} } {
     if { [catch {cli_exec $cli(fd) "del /force /recursive flash:c3*"} result] } {
-	error $result $errorInfo
+        error $result $errorInfo
     }
 
     if { [catch {cli_exec $cli(fd) "copy $TFTP_URL/$image flash:"} result] } {
-	error $result $errorInfo
+        error $result $errorInfo
     }
 }
 
 if { $config != {} } {
     if { [catch {cli_exec $cli(fd) "copy $TFTP_URL/device-configs/$config start"} result] } {
-	error $result $errorInfo
-    }
-
-    if { [catch {cli_exec $cli(fd) "config t"} result] } {
         error $result $errorInfo
     }
 
-    if { [catch {cli_exec $cli(fd) "sdm prefer vlan"} result] } {
-	puts "WARNING: Failed to change sdm prefer: '$result'"
-    }
+    if { [regexp {C3750X} $pid] } {
+        if { [catch {cli_exec $cli(fd) "config t"} result] } {
+            error $result $errorInfo
+        }
 
-    if { [catch {cli_exec $cli(fd) "end"} result] } {
-        error $result $errorInfo
-    }
+        if { [catch {cli_exec $cli(fd) "sdm prefer vlan"} result] } {
+            error $result $errorInfo
+        }
 
-    if { [regexp {C3750X} $pid] } {
-	if { [catch {cli_exec $cli(fd) "show switch | inc ^\\*"} result] } {
-	    error $result $errorInfo
-	}
-
-	if { [regexp {\*([2-9])} $result -> swn] } {
-	    if { [catch {cli_exec $cli(fd) "config t"} result] } {
-		error $result $errorInfo
-	    }
-
-	    if { [catch {cli_write $cli(fd) "switch $swn renumber 1"} result] } {
-		error $result $errorInfo
-	    }
-
-	    if { [catch {cli_read_pattern $cli(fd) "confirm"} result] } {
-		error $result $errorInfo
-	    }
-
-	    if { [catch {cli_exec $cli(fd) "\r"} result] } {
-		error $result $errorInfo
-	    }
-
-	    if { [catch {cli_exec $cli(fd) "end"} result] } {
-		error $result $errorInfo
-	    }
-	}
+        if { [catch {cli_exec $cli(fd) "end"} result] } {
+            error $result $errorInfo
+        }
+
+        if { [catch {cli_exec $cli(fd) "show switch | inc ^\\*"} result] } {
+            error $result $errorInfo
+        }
+
+        if { [regexp {\*([2-9])} $result -> swn] } {
+            if { [catch {cli_exec $cli(fd) "config t"} result] } {
+                error $result $errorInfo
+            }
+
+            if { [catch {cli_write $cli(fd) "switch $swn renumber 1"} result] } {
+                error $result $errorInfo
+            }
+
+            if { [catch {cli_read_pattern $cli(fd) "confirm"} result] } {
+                error $result $errorInfo
+            }
+
+            if { [catch {cli_exec $cli(fd) "\r"} result] } {
+                error $result $errorInfo
+            }
+
+            if { [catch {cli_exec $cli(fd) "end"} result] } {
+                error $result $errorInfo
+            }
+        }
     }
 
     if { [catch {cli_exec $cli(fd) "license right-to-use activate ipservices acceptEULA"} result] } {
-	puts "WARNING: Failed to change license: '$result'"
+        puts "WARNING: Failed to change license: '$result'"
     }
 }
 
 if { $image != {} } {
     if { [catch {cli_exec $cli(fd) "config t"} result] } {
-	error $result $errorInfo
+        error $result $errorInfo
     }
 
     if { [catch {cli_exec $cli(fd) "boot system flash:$image"} result] } {
-	error $result $errorInfo
+        error $result $errorInfo
     }
 
     if { [catch {cli_exec $cli(fd) "end"} result] } {
-	error $result $errorInfo
+        error $result $errorInfo
     }
 }
 
@@ -200,8 +200,8 @@ if { [::http::error $tok] != "" } {
 
 foreach line [split [::http::data $tok] "\n"] {
     if { [regexp {ERROR} $line] } {
-	action_syslog msg "AUTOCONF FAILED: Config verification failed"
-	exit 1
+        action_syslog msg "AUTOCONF FAILED: Config verification failed"
+        exit 1
     }
 }