Embarrassingly I found that I had made a mistake and hadn't put a double newline at the end of my banner text:
# Join list into one big string
set var myBanner [ join $lineList "\n" ]
# prefix with newline and suffix with two
set var myBanner "\n$myBanner\n\n"
# Issue command
configure banner after-login $myBannerThat worked a treat. Just needed to step away from the problem. Pasted script here in case anybody cares to look at it. Maybe there are some helpful tcl examples for total novices:
#@MetaDataStart
#@DetailDescriptionStart
#############################################################################
# Extreme Networks(R) CLI Scripting Library
#
# Script : Logbook URL Insertion - After Banner
# Revision : 1.0
# Last Updated : Nov 1 2017
#
# When work is performed on a switch that relates to some unique circumstance
# on that switch, it is important to be able to keep a record of that work
# and for that work to be accessible to other technicians. The process is to
# establish a google sites page for a whole location or possibly a single switch
# and to include a shortened URL in the after login banner for the switch
# ( there is a limit of 80 characters on banner lines so full URLs get tricky )
#
# The workflow is as follows:
# - issue arises on a device that warrants some custom action ( port turned down, trap suppressed )
# - establish a Sites page under the URL
https://sites.google.com/a/*****/extremenetworking/home/devicehistories
# for the specific location ( e.g. CrystalLakesES )
# - document the issue and action taken against the device ( see example at
https://sites.google.com/a/*****/extremenetworking/home/devicehistories/devices254 )
# - shortent the URL for the new page using the Google service
https://goo.gl/
# - Insert the short URL at the bottom of the login banner with this script.
#
#####################################################################
#@DetailDescriptionEnd
#############################################################################################
# Define identity management configuration parameters in this section.
#############################################################################################
#
@SectionStart (description = Script configuration properties)
#
@VariableFieldLabel (description = "Stop on error?"
# type = String,
# scope = global,
# required = yes,
# validValues=[yes,no])
set var abort_when_error yes
#
@VariableFieldLabel ( description = "tinyURL",
# type = String,
# scope = global,
# required = yes,
# readonly = no
#)
set var tinyURL
https://itssotiny
#
@VariableFieldLabel ( description = "urlSeparator",
# type = String,
# scope = global,
# required = yes,
# readonly = no
#)
set var urlSeparator =LBU==========================================================================
#
@VariableFieldLabel ( description = "urlBody",
# type = String,
# scope = global,
# required = yes,
# readonly = no
#)
set var urlBody "Logbook URL:"
#
@SectionEnd
#
@MetaDataEnd
##################################################################
# TCL Procedure for Changing MIB View
##################################################################
proc addURL {
tinyURL
urlSeparator
urlBody
} {
set var urlText "$urlSeparator$urlBody$tinyURL$urlSeparator"
set var CLI.OUT 0
show banner after-login
set var lineList [ split ${CLI.OUT} "\n" ]
# The last value in the list is the switch login prompt so it needs
# to be chopped off
set var lineList [ lreplace $lineList end end ]
delete var CLI.OUT
set var bannerLen [ llength $lineList ]
# Now need to filter out any lines of output that are not really part of the banner
# First split the lines into a list
set var newBannerList [ list ]
set var startCopying 0
foreach line $lineList {
IF ( $TCL(regexp {After-Login} $line isFound) ) THEN
set var startCopying 1
continue
ENDIF
IF ( $startCopying == 1 ) THEN
# start copy lines into the new location
lappend newBannerList $line
ENDIF
}
# Now we don't know if we have a URL section in the banner or not
# We need to remove any existing URL section
# Write the remaining lines back into lineList
set var lineList $newBannerList
set var newBannerList [ list ]
set var urlStartIndex 0
set var urlEndIndex 0
set var listIndex 0
foreach line $lineList {
IF ( $urlStartIndex == 0 ) THEN
IF ( [ regexp {^=LBU} $line isFound ] ) THEN
set var urlStartIndex $listIndex
ENDIF
ELSE
IF ( $urlEndIndex == 0 ) THEN
IF ( [ regexp {^=LBU} $line isFound ] ) THEN
set var urlEndIndex $listIndex
ENDIF
ENDIF
ENDIF
set var listIndex [ expr $listIndex + 1 ]
}
# Replace current URL entry in banner
IF ( $urlStartIndex != 0 && $urlEndIndex != 0 ) THEN
set var lineList [ lreplace $lineList $urlStartIndex $urlEndIndex $urlSeparator $urlBody $tinyURL $urlSeparator ]
ELSE
# Assume there was no previous URL block in the banner so insert before blank line at list end
set var lineList [ linsert $lineList end-1 $urlSeparator $urlBody $tinyURL $urlSeparator ]
ENDIF
# Join list into one big string
set var myBanner [ join $lineList "\n" ]
# prefix with newline and suffix with two
set var myBanner "\n$myBanner\n\n"
# Issue command
configure banner after-login $myBanner
saveToPrimary "Logbook URL:"
return
}
#############################################################################
# TCL Procedure for CLI Script Execution Mode setting
############################################################################
proc setCliErrorHandling {inAbortStatus} {
global abort_when_error
if {![string compare $inAbortStatus "yes"]} {
configure cli mode scripting abort-on-error
} else {
configure cli mode scripting ignore-error
}
}
############################################################################
# TCL Procedure for CLI Script Execution Mode setting
############################################################################
proc saveToPrimary { logSource } {
create log entry "$logSource Saving configuration to primary"
save configuration primary
# handle prompt: Do you want to save configuration to secondary.cfg and overwrite it?
# CLI.OUT system variable has response of the previous CLI command (SAVe config secondary)
# use regex to check if it is prompt, supply response if found
set var CLI.OUT 0
regexp {.*overwrite it?.*} ${CLI.OUT} foundit
IF ([info exists foundit]) THEN
CLI y
ENDIF
delete var CLI.OUT
create log entry "$logSource Saved configuration to primary"
}
############################################################################
enable cli scripting
# enable cli scripting output
setCliErrorHandling $abort_when_error
addURL $tinyURL $urlSeparator $urlBody
disable cli scripting