summaryrefslogtreecommitdiff
path: root/tests/data/ext/sample_ext
diff options
context:
space:
mode:
Diffstat (limited to 'tests/data/ext/sample_ext')
-rw-r--r--tests/data/ext/sample_ext/HandlerManifest.json14
-rwxr-xr-xtests/data/ext/sample_ext/sample.py33
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/data/ext/sample_ext/HandlerManifest.json b/tests/data/ext/sample_ext/HandlerManifest.json
new file mode 100644
index 0000000..9890d0c
--- /dev/null
+++ b/tests/data/ext/sample_ext/HandlerManifest.json
@@ -0,0 +1,14 @@
+[{
+ "name": "ExampleHandlerLinux",
+ "version": 1.0,
+ "handlerManifest": {
+ "installCommand": "sample.py -install",
+ "uninstallCommand": "sample.py -uninstall",
+ "updateCommand": "sample.py -update",
+ "enableCommand": "sample.py -enable",
+ "disableCommand": "sample.py -disable",
+ "rebootAfterInstall": false,
+ "reportHeartbeat": false
+ }
+}]
+
diff --git a/tests/data/ext/sample_ext/sample.py b/tests/data/ext/sample_ext/sample.py
new file mode 100755
index 0000000..7107ac2
--- /dev/null
+++ b/tests/data/ext/sample_ext/sample.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+import os
+
+def get_seq():
+ latest_seq = -1;
+ config_dir = os.path.join(os.getcwd(), "config")
+ if os.path.isdir(config_dir):
+ for item in os.listdir(config_dir):
+ item_path = os.path.join(config_dir, item)
+ if os.path.isfile(item_path):
+ seperator = item.rfind(".")
+ if seperator > 0 and item[seperator + 1:] == "settings":
+ seq = int(item[0: seperator])
+ if seq > latest_seq:
+ latest_seq = seq
+ return latest_seq
+
+
+succeed_status = """
+[{
+ "status": {
+ "status": "success"
+ }
+}]
+"""
+
+if __name__ == "__main__":
+ seq = get_seq()
+ if seq >= 0:
+ status_file = os.path.join(os.getcwd(), "status", "{0}.status".format(seq))
+ with open(status_file, "w+") as status:
+ status.write(succeed_status)