Skip to content

Commit bbb1902

Browse files
author
Christopher M. Neill
committed
Jinja2 keyword escape
1 parent 9ac9c19 commit bbb1902

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ansible/roles/bash_aliases/templates/dot_bash_aliases.sh.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ lograw() {
2525
loglast() {
2626
local app_name="$1"
2727
local tailopts=""
28-
# trusting YOU, the user, not to fsck this up
29-
if [ 2 -eq ${#} ] ; then
28+
# do not check contents of $2, just if exists, escape jinja2 keyword.
29+
if [ 2 -eq "{{ '${#}' }}" ] ; then
3030
tailopts="-${2}"
3131
fi
3232
tail ${tailopts} $(logpath ${app_name}) | bunyan
@@ -37,8 +37,8 @@ loglast() {
3737
greplog() {
3838
local app_name="$1"
3939
local regexp=""
40-
# trusting YOU, the user, not to fsck this up
41-
if [ 2 -eq ${#} ] ; then
40+
# again, not checking arg2, just making sure it exists, and espace jinja2 keyword.
41+
if [ 2 -eq "{{ '${#}' }}" ] ; then
4242
regexp="${2}"
4343
fi
4444
tail -f $(logpath ${app_name}) | grep ${regexp} | bunyan

0 commit comments

Comments
 (0)