You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@libcloud.apache.org by "Tomaz Muraus (JIRA)" <ji...@apache.org> on 2013/03/29 18:07:15 UTC
[dev] [jira] [Resolved] (LIBCLOUD-311) Add ScriptFileDeployment Class
[ https://issues.apache.org/jira/browse/LIBCLOUD-311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tomaz Muraus resolved LIBCLOUD-311.
-----------------------------------
Resolution: Fixed
Assignee: Tomaz Muraus
Added a very basic test case and merged it into trunk and 0.12.x.
Thanks.
> Add ScriptFileDeployment Class
> ------------------------------
>
> Key: LIBCLOUD-311
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-311
> Project: Libcloud
> Issue Type: Improvement
> Components: Compute
> Affects Versions: 0.12.3
> Reporter: Rudolf J Streif
> Assignee: Tomaz Muraus
> Priority: Minor
> Attachments: 0001-ScriptFileDeployment.patch
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> The ScriptDeployment class easily lets you deploy and execute a series of commands provided as a string with the script parameter. That works fine if you only have a few commands.
> Sometimes it would be useful to write a script file and then execute it on a node. For that reason I am proposing the following patch:
> diff --git a/libcloud/compute/deployment.py b/libcloud/compute/deployment.py
> index 6f24a06..f04ff49 100644
> --- a/libcloud/compute/deployment.py
> +++ b/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, scriptfile, name=None, delete=False):
> + """
> + @type scriptfile: C{str}
> + @keyword scriptfile: 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(scriptfile, '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.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira