From dd4fd41c4425e73107b9fed4e16775747b1bf827 Mon Sep 17 00:00:00 2001
From: Rudolf J Streif <rudolf.streif@linux.com>
Date: Fri, 29 Mar 2013 09:23:07 -0700
Subject: [PATCH] jira-311: Added ScriptFileDeployment class

---
 libcloud/compute/deployment.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git libcloud/compute/deployment.py libcloud/compute/deployment.py
index 6f24a06..16d995c 100644
--- libcloud/compute/deployment.py
+++ libcloud/compute/deployment.py
@@ -167,6 +167,30 @@ class ScriptDeployment(Deployment):
         return node
 
 
+class ScriptFileDeployment(ScriptDeployment):
+    """
+    Runs an arbitrary Shell Script task from a file.
+    """
+
+    def __init__(self, script_file, name=None, delete=False):
+        """
+        @type script_file: C{str}
+        @keyword script_file: File containing the script to run
+
+        @type name: C{str}
+        @keyword name: Name of the script to upload it as, if not specified, a random name will be choosen.
+
+        @type delete: C{bool}
+        @keyword delete: Whether to delete the script on completion.
+        """
+        with open(script_file, 'rb') as fp:
+            content = fp.read()
+        
+        super(ScriptFileDeployment, self).__init__(script=content,
+                                               name=name,
+                                               delete=delete)
+
+
 class MultiStepDeployment(Deployment):
     """
     Runs a chain of Deployment steps.
-- 
1.8.1.4

