If you try to deploy a new temBoard Agent (Version temboard-agent-7.4-1.el7.noarch) on RHEL/CentOS 7, you might end up with the following error:
1 2 3 4 5 6 7 8 | $ sudo /usr/share/temboard-agent/auto_configure.sh https://host.example.ch:8888 Using hostname host.example.ch. Configuring for PostgreSQL user postgres. Configuring for cluster on port 55031. Configuring for cluster at /app/lib/postgres/pgdata/12/P01A. Configuring temboard-agent in /etc/temboard-agent/12/pg55031/temboard-agent.conf . Saving auto-configuration in /etc/temboard-agent/12/pg55031/temboard-agent.conf.d/auto.conf Failure. See /var/log/temboard-agent-auto-configure.log for details. |
In the log you will find the following error which point to an unbound variable.
1 2 3 4 5 6 | +++ ss -ln4t '( sport >= 2345 and sport <= 3000 )' +++ grep -Po ':\K\d+' /usr/share/temboard-agent/auto_configure.sh: line 54: used_a[*]: unbound variable + port= + catchall + '[' 1 -gt 0 ']' |
A workaround, which worked for me, is to replace the upper port of 3000 with 300000.
Simply change the file /usr/share/temboard-agent/auto_configure.sh and replace sport <= 3000 with sport <= 300000.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | From mapfile -t used_a < <(ss -ln4t '( sport >= 2345 and sport <= 3000 )' | grep -Po ':\K\d+') To mapfile -t used_a < <(ss -ln4t '( sport >= 2345 and sport <= 300000 )' | grep -Po ':\K\d+') find_next_free_port() { local port local used_a local used mapfile -t used_a < <(ss -ln4t '( sport >= 2345 and sport <= 300000 )' | grep -Po ':\K\d+') # To mock ss output, use seq: # mapfile -t used_a < <(seq 2345 3000) used="${used_a[*]}" for port in {2345..3000} ; do if [[ " $used " =~ \ $port\ ]] ; then continue ; fi echo $port; return done log "No free TCP port found between 2345 and 3000. Force with env TEMBOARD_PORT." return 1 } |
Another workaround that you can use, is to replace the line
1 | used="${used_a[*]}" |
with
1 | used="${used_a[*]:-}" |
Now the deployment of the new temBoard agent worked.
Conclusion
In case you need to deploy a 7.4 temBoard agent quickly, you might want to use these workarounds. The other possibility is to wait for temBoard agent 7.5 until the following bug is fixed. https://github.com/dalibo/temboard-agent/issues/507