Updated slack and twist commands to include properly escaped data.

development
Shawn Davis 2 years ago
parent 29f8670d61
commit 85f7d8f792
  1. 2
      PEP440.txt
  2. 2
      VERSION.txt
  3. 5
      scripttease/lib/commands/base.py
  4. 4
      scripttease/lib/commands/messages.py
  5. 6
      scripttease/version.py

@ -1 +1 @@
6.8.30 6.8.33

@ -1 +1 @@
6.8.30 6.8.33

@ -608,10 +608,11 @@ class Template(object):
first_line = _content.pop(0) first_line = _content.pop(0)
command = '%s echo "%s" > %s' % (self.sudo, first_line, self.target) command = '%s echo "%s" > %s' % (self.sudo, first_line, self.target)
lines.append(command.lstrip()) 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(command.lstrip())
lines.append("\n".join(_content)) lines.append("\n".join(_content))
lines.append("EOF") lines.append("FOE")
else: else:
command = "%s cat > %s << EOF" % (self.sudo, self.target) command = "%s cat > %s << EOF" % (self.sudo, self.target)
lines.append(command.lstrip()) lines.append(command.lstrip())

@ -30,7 +30,7 @@ def slack(message, url=None, **kwargs):
statement = list() statement = list()
statement.append("curl -X POST -H 'Content-type: application/json' --data") statement.append("curl -X POST -H 'Content-type: application/json' --data")
statement.append('{"text": "%s"}' % message) statement.append('\'{"text": "%s"}\'' % message)
statement.append(url) statement.append(url)
return Command(statement, **kwargs) return Command(statement, **kwargs)
@ -42,7 +42,7 @@ def twist(message, title="Notice", url=None, **kwargs):
statement = list() statement = list()
statement.append("curl -X POST -H 'Content-type: application/json' --data") 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) statement.append(url)
return Command(" ".join(statement), **kwargs) return Command(" ".join(statement), **kwargs)

@ -1,5 +1,5 @@
DATE = "2022-06-14" DATE = "2022-09-24"
VERSION = "6.8.15" VERSION = "6.8.33"
MAJOR = 6 MAJOR = 6
MINOR = 8 MINOR = 8
PATCH = 15 PATCH = 33

Loading…
Cancel
Save