Issue Details (XML | Word | Printable)

Key: RIO-106
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Dennis Reedy
Reporter: Dennis Reedy
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Rio

Allow declaration for the Download and Data elements to declare a target file name

Created: 11/Sep/08 03:56 AM   Updated: 17/Feb/10 05:15 PM
Component/s: Deployment
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified


 Description  « Hide
In the case where the source filename may not be the name of the target file name, an option should be provided to declare this.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dennis Reedy added a comment - 11/Sep/08 03:59 AM
This may create an issue with the current declaration of the Data element, Example follows:

<Data RemoveOnDestroy="yes" Overwrite="yes" Perms="ugo+rwx">
<FileName>foo.xml</FileName>
<Source>http://10.0.1.6:9010/</Source>
<Target>/tmp/bar</Target>
</Data>

This declaration will result in the copying of http://10.0.1.6:9010/foo.xml to /tmp/bar/foo.xml

The nested Target element declares the targeted directory (If the directory name does not begin with a '/', the installRoot directory is a
relative directory, and will be appended to the directory determined by the downloading entity).

One thought is to add an element called TargetFileName that is implicit and defaults to FileName if not provided.


Dennis Reedy added a comment - 11/Sep/08 04:02 AM
There also needs to be some consistency with the Download element. The Download element is a nested (child) element of the SoftwareLoad element. The Download element differs in that it provides attributes (as opposed to nested elements) that declare the item to be downloaded.

Adding another implicit attribute called TargetFileName may also meet the needs here as well


Jerome Bernard added a comment - 11/Sep/08 07:25 AM
Your suggestions are probably the right ones.

An alternative would have been to put the current FileName content into the end of the Source value and instead use FileName as a TargetFileName, so something like this:
<Data RemoveOnDestroy="yes" Overwrite="yes" Perms="ugo+rwx">
<FileName>foo.xml</FileName>
<Source>http://10.0.1.6:9010/foo.xml?whatever</Source>
<Target>/tmp/bar</Target>
</Data>

The problem with that solution is that it breaks backwards compatibility though.


Dennis Reedy added a comment - 11/Sep/08 12:14 PM
Yes, thats exactly the issue, backwards compatibility

Dennis Reedy added a comment - 11/Sep/08 03:09 PM
The problem here seems to be with the DSL. Here is a declaration from tomcat.groovy

data source: 'https://elastic-grid.s3.amazonaws.com/tomcat/sample.war',
target: '${RIO_HOME}/system/external/tomcat/apache-tomcat-6.0.16/webapps'


When this is parsed there is currently no concept of a source file name, just the source location + file name. What I am thinking of doing is not use TargetFileName for the Data element, but instead parse the Target element to determine if the target includes the name of the targeted file. With this approach the snippet above would allow sample.war to be copied from https://elastic-grid.s3.amazonaws.com/tomcat to ${RIO_HOME}/system/external/tomcat/apache-tomcat-6.0.16/webapps/FOO.war

data source: 'https://elastic-grid.s3.amazonaws.com/tomcat/sample.war',
target: '${RIO_HOME}/system/external/tomcat/apache-tomcat-6.0.16/webapps/FOO.WAR'

The XML variant would look like:

Data RemoveOnDestroy="yes" Overwrite="yes" Perms="ugo+rwx">
<FileName>sample.war</FileName>
<Source>https://elastic-grid.s3.amazonaws.com/tomcat</Source>
<Target>${RIO_HOME}/system/external/tomcat/apache-tomcat-6.0.16/webapps/FOO.WAR</Target>
</Data>

The target parsing would need to follow these rules:

If the target ends with a '/' then the target is considered to be a directory otherwise, the target is considered to be the filename. Would this suit your needs?


Dennis Reedy added a comment - 25/Nov/08 07:57 PM
Moved to M3

Dennis Reedy added a comment - 17/Feb/10 05:15 PM
Unscheduled