From 85f7d8f792965cbabc85ff96c94d4cfa30c4e3c3 Mon Sep 17 00:00:00 2001 From: Shawn Davis Date: Sun, 25 Sep 2022 19:25:38 -0500 Subject: [PATCH] Updated slack and twist commands to include properly escaped data. --- PEP440.txt | 2 +- VERSION.txt | 2 +- scripttease/lib/commands/base.py | 5 +++-- scripttease/lib/commands/messages.py | 4 ++-- scripttease/version.py | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/PEP440.txt b/PEP440.txt index c3fdfc0..74030cb 100644 --- a/PEP440.txt +++ b/PEP440.txt @@ -1 +1 @@ -6.8.30 \ No newline at end of file +6.8.33 \ No newline at end of file diff --git a/VERSION.txt b/VERSION.txt index c3fdfc0..74030cb 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -6.8.30 \ No newline at end of file +6.8.33 \ No newline at end of file diff --git a/scripttease/lib/commands/base.py b/scripttease/lib/commands/base.py index 49c4626..b593b2b 100644 --- a/scripttease/lib/commands/base.py +++ b/scripttease/lib/commands/base.py @@ -608,10 +608,11 @@ class Template(object): first_line = _content.pop(0) command = '%s echo "%s" > %s' % (self.sudo, first_line, self.target) lines.append(command.lstrip()) - command = "%s cat > %s << EOF" % (self.sudo, self.target) + # https://stackoverflow.com/a/25903579 + command = "%s cat << FOE >> %s" % (self.sudo, self.target) lines.append(command.lstrip()) lines.append("\n".join(_content)) - lines.append("EOF") + lines.append("FOE") else: command = "%s cat > %s << EOF" % (self.sudo, self.target) lines.append(command.lstrip()) diff --git a/scripttease/lib/commands/messages.py b/scripttease/lib/commands/messages.py index 97afd03..73b045f 100644 --- a/scripttease/lib/commands/messages.py +++ b/scripttease/lib/commands/messages.py @@ -30,7 +30,7 @@ def slack(message, url=None, **kwargs): statement = list() statement.append("curl -X POST -H 'Content-type: application/json' --data") - statement.append('{"text": "%s"}' % message) + statement.append('\'{"text": "%s"}\'' % message) statement.append(url) return Command(statement, **kwargs) @@ -42,7 +42,7 @@ def twist(message, title="Notice", url=None, **kwargs): statement = list() statement.append("curl -X POST -H 'Content-type: application/json' --data") - statement.append('{"content": "%s", "title": "%s"' % (message, title)) + statement.append('\'{"content": "%s", "title": "%s"}\'' % (message, title)) statement.append(url) return Command(" ".join(statement), **kwargs) diff --git a/scripttease/version.py b/scripttease/version.py index feafa52..4044acd 100644 --- a/scripttease/version.py +++ b/scripttease/version.py @@ -1,5 +1,5 @@ -DATE = "2022-06-14" -VERSION = "6.8.15" +DATE = "2022-09-24" +VERSION = "6.8.33" MAJOR = 6 MINOR = 8 -PATCH = 15 +PATCH = 33