[PATCH] * Added module to execute arbitrary Python code.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 func/minion/modules/push.py |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 func/minion/modules/push.py

diff --git a/func/minion/modules/push.py b/func/minion/modules/push.py
new file mode 100644
index 0000000..df9d4c6
--- /dev/null
+++ b/func/minion/modules/push.py
@@ -0,0 +1,34 @@
+# Copyright 2008 Silas Sewell
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you
+# may not use this file except in compliance with the License.  You
+# may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
+
+import codes
+import func_module
+
+class Push(func_module.FuncModule):
+    """
+    Push arbitrary Python code and return the results.
+    """
+    version = '0.0.1'
+    api_version = '0.0.2'
+    description = 'Push arbitrary Python code.'
+
+    def code(self, source):
+        """
+        Execute Python code and return the results.
+        """
+        exec(source)
+        try:
+            return main()
+        except NameError:
+            raise codes.FuncException('Please define a "main()" method.')
-- 
1.5.6.5

_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux