Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3715945
D1872.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D1872.diff
View Options
diff --git a/roles/paas-docker/wrappers/files/pad-delete.py b/roles/paas-docker/wrappers/files/pad-delete.py
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/wrappers/files/pad-delete.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python2
+# Note: Python 3 isn't installed by default on CentOS 7.
+
+# -------------------------------------------------------------
+# PaaS Docker
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2018-10-10
+# License: Trivial work, not eligible to copyright
+# Source file: roles/paas-docker/wrappers/files/pad-delete.py
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+from six.moves.urllib.request import urlopen
+import json
+import sys
+
+API_KEY_FILE = "/srv/pad/APIKEY.txt"
+PAD_HOST = "pad.nasqueron.org"
+
+# Read API key
+with open(API_KEY_FILE) as api_file:
+ key=api_file.read().strip()
+
+# Fire request
+url = "https://" + PAD_HOST + "/api/1/deletePad?apikey=" + key + "&padID=" + pad
+contents = urlopen(url).read()
+
+# Report result
+result = json.loads(contents)
+print(result["message"])
+
+sys.exit(result["code"])
diff --git a/roles/paas-docker/wrappers/init.sls b/roles/paas-docker/wrappers/init.sls
--- a/roles/paas-docker/wrappers/init.sls
+++ b/roles/paas-docker/wrappers/init.sls
@@ -18,3 +18,10 @@
- source: salt://roles/paas-docker/wrappers/files/{{ command }}.sh
- mode: 755
{% endfor %}
+
+{% for command in ['pad-delete'] %}
+{{ dirs.bin }}/{{ command }}:
+ file.managed:
+ - source: salt://roles/paas-docker/wrappers/files/{{ command }}.py
+ - mode: 755
+{% endfor %}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 11:34 (21 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2231701
Default Alt Text
D1872.diff (1 KB)
Attached To
Mode
D1872: Provide a script to delete a pad
Attached
Detach File
Event Timeline
Log In to Comment