You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jamal (JIRA)" <ji...@codehaus.org> on 2011/07/31 19:42:42 UTC

[jira] Created: (WAGON-343) wagon-scp should remove target area prior to uploading/unzipping new content

wagon-scp should remove target area prior to uploading/unzipping new content
----------------------------------------------------------------------------

                 Key: WAGON-343
                 URL: https://jira.codehaus.org/browse/WAGON-343
             Project: Maven Wagon
          Issue Type: Bug
          Components: wagon-ssh-external
    Affects Versions: 1.0
         Environment: Maven 3.0.3
maven-site-plugin:3.0-beta-3
            Reporter: Jamal
            Priority: Minor
         Attachments: ScpHelper.java

Similiar to the request captured in this issue (https://jira.codehaus.org/browse/MSITE-250), my problem is that our target area gets out of sync when we upload our site generated content frequently using CI.  When files are moved/deleted, our site deployment target area becomes a hassle to keep correct because when noticed, we have to manually delete either old files, or the entire folder (because it's easier :)) prior to deploying the site.  I'd like it if the wagon-scp code could remove the files/subfolders in the target area prior to uploading.  

I looked at the code, and a easy fix, which I tested, is to update the ScpHelper.putDirectory() method (in wagon-ssh-common) to remove the contents of the folder prior to uploading/unzipping the new files:  

...
 try
        {
            executor.executeCommand( "cd " + path + "; rm -rf * ");
            
            wagon.put( zipFile, getPath( destDir, zipFile.getName() ) );
            
            executor.executeCommand( "cd " + path + "; unzip -q -o " + zipFile.getName() + "; rm -f " + zipFile.getName() );

            zipFile.delete();
...

I have attached the version of the file which I updated and tested, and below is what the output looks like with my simple test project.

Password for dev@localhost: XXXXXX
scp://localhost/tmp/site-deploy - Session: Opened  
Executing command: mkdir -p /tmp/site-deploy/.
Executing command: cd /tmp/site-deploy/.; rm -rf * 
Executing command: mkdir -p /tmp/site-deploy/.
Executing command: scp -t "/tmp/site-deploy/./wagon3163598898345372687.zip"
Uploading: ./wagon3163598898345372687.zip to scp://localhost/tmp/site-deploy


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WAGON-343) wagon-scp should remove target area prior to uploading/unzipping new content

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/WAGON-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=280619#comment-280619 ] 

Brett Porter commented on WAGON-343:
------------------------------------

here, it would just be a new API - but something like the wagon-maven-plugin could call it

> wagon-scp should remove target area prior to uploading/unzipping new content
> ----------------------------------------------------------------------------
>
>                 Key: WAGON-343
>                 URL: https://jira.codehaus.org/browse/WAGON-343
>             Project: Maven Wagon
>          Issue Type: Bug
>          Components: wagon-ssh-external
>    Affects Versions: 1.0
>         Environment: Maven 3.0.3
> maven-site-plugin:3.0-beta-3
>            Reporter: Jamal
>            Priority: Minor
>         Attachments: ScpHelper.java
>
>
> Similiar to the request captured in this issue (https://jira.codehaus.org/browse/MSITE-250), my problem is that our target area gets out of sync when we upload our site generated content frequently using CI.  When files are moved/deleted, our site deployment target area becomes a hassle to keep correct because when noticed, we have to manually delete either old files, or the entire folder (because it's easier :)) prior to deploying the site.  I'd like it if the wagon-scp code could remove the files/subfolders in the target area prior to uploading.  
> I looked at the code, and a easy fix, which I tested, is to update the ScpHelper.putDirectory() method (in wagon-ssh-common) to remove the contents of the folder prior to uploading/unzipping the new files:  
> ...
>  try
>         {
>             executor.executeCommand( "cd " + path + "; rm -rf * ");
>             
>             wagon.put( zipFile, getPath( destDir, zipFile.getName() ) );
>             
>             executor.executeCommand( "cd " + path + "; unzip -q -o " + zipFile.getName() + "; rm -f " + zipFile.getName() );
>             zipFile.delete();
> ...
> I have attached the version of the file which I updated and tested, and below is what the output looks like with my simple test project.
> Password for dev@localhost: XXXXXX
> scp://localhost/tmp/site-deploy - Session: Opened  
> Executing command: mkdir -p /tmp/site-deploy/.
> Executing command: cd /tmp/site-deploy/.; rm -rf * 
> Executing command: mkdir -p /tmp/site-deploy/.
> Executing command: scp -t "/tmp/site-deploy/./wagon3163598898345372687.zip"
> Uploading: ./wagon3163598898345372687.zip to scp://localhost/tmp/site-deploy

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WAGON-343) wagon-scp should remove target area prior to uploading/unzipping new content

Posted by "Jamal (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/WAGON-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=280648#comment-280648 ] 

Jamal commented on WAGON-343:
-----------------------------

That sounds reasonable.

> wagon-scp should remove target area prior to uploading/unzipping new content
> ----------------------------------------------------------------------------
>
>                 Key: WAGON-343
>                 URL: https://jira.codehaus.org/browse/WAGON-343
>             Project: Maven Wagon
>          Issue Type: Bug
>          Components: wagon-ssh-external
>    Affects Versions: 1.0
>         Environment: Maven 3.0.3
> maven-site-plugin:3.0-beta-3
>            Reporter: Jamal
>            Priority: Minor
>         Attachments: ScpHelper.java
>
>
> Similiar to the request captured in this issue (https://jira.codehaus.org/browse/MSITE-250), my problem is that our target area gets out of sync when we upload our site generated content frequently using CI.  When files are moved/deleted, our site deployment target area becomes a hassle to keep correct because when noticed, we have to manually delete either old files, or the entire folder (because it's easier :)) prior to deploying the site.  I'd like it if the wagon-scp code could remove the files/subfolders in the target area prior to uploading.  
> I looked at the code, and a easy fix, which I tested, is to update the ScpHelper.putDirectory() method (in wagon-ssh-common) to remove the contents of the folder prior to uploading/unzipping the new files:  
> ...
>  try
>         {
>             executor.executeCommand( "cd " + path + "; rm -rf * ");
>             
>             wagon.put( zipFile, getPath( destDir, zipFile.getName() ) );
>             
>             executor.executeCommand( "cd " + path + "; unzip -q -o " + zipFile.getName() + "; rm -f " + zipFile.getName() );
>             zipFile.delete();
> ...
> I have attached the version of the file which I updated and tested, and below is what the output looks like with my simple test project.
> Password for dev@localhost: XXXXXX
> scp://localhost/tmp/site-deploy - Session: Opened  
> Executing command: mkdir -p /tmp/site-deploy/.
> Executing command: cd /tmp/site-deploy/.; rm -rf * 
> Executing command: mkdir -p /tmp/site-deploy/.
> Executing command: scp -t "/tmp/site-deploy/./wagon3163598898345372687.zip"
> Uploading: ./wagon3163598898345372687.zip to scp://localhost/tmp/site-deploy

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WAGON-343) wagon-scp should remove target area prior to uploading/unzipping new content

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/WAGON-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=279717#comment-279717 ] 

Brett Porter commented on WAGON-343:
------------------------------------

This is incredibly dangerous, and harder to support on other providers. I'd think if you need this, it needs to at least require some configuration rather than being the default.

Would it make more sense to have a wagon.deleteDirectory command that can be used by plugins and clients that need it?

> wagon-scp should remove target area prior to uploading/unzipping new content
> ----------------------------------------------------------------------------
>
>                 Key: WAGON-343
>                 URL: https://jira.codehaus.org/browse/WAGON-343
>             Project: Maven Wagon
>          Issue Type: Bug
>          Components: wagon-ssh-external
>    Affects Versions: 1.0
>         Environment: Maven 3.0.3
> maven-site-plugin:3.0-beta-3
>            Reporter: Jamal
>            Priority: Minor
>         Attachments: ScpHelper.java
>
>
> Similiar to the request captured in this issue (https://jira.codehaus.org/browse/MSITE-250), my problem is that our target area gets out of sync when we upload our site generated content frequently using CI.  When files are moved/deleted, our site deployment target area becomes a hassle to keep correct because when noticed, we have to manually delete either old files, or the entire folder (because it's easier :)) prior to deploying the site.  I'd like it if the wagon-scp code could remove the files/subfolders in the target area prior to uploading.  
> I looked at the code, and a easy fix, which I tested, is to update the ScpHelper.putDirectory() method (in wagon-ssh-common) to remove the contents of the folder prior to uploading/unzipping the new files:  
> ...
>  try
>         {
>             executor.executeCommand( "cd " + path + "; rm -rf * ");
>             
>             wagon.put( zipFile, getPath( destDir, zipFile.getName() ) );
>             
>             executor.executeCommand( "cd " + path + "; unzip -q -o " + zipFile.getName() + "; rm -f " + zipFile.getName() );
>             zipFile.delete();
> ...
> I have attached the version of the file which I updated and tested, and below is what the output looks like with my simple test project.
> Password for dev@localhost: XXXXXX
> scp://localhost/tmp/site-deploy - Session: Opened  
> Executing command: mkdir -p /tmp/site-deploy/.
> Executing command: cd /tmp/site-deploy/.; rm -rf * 
> Executing command: mkdir -p /tmp/site-deploy/.
> Executing command: scp -t "/tmp/site-deploy/./wagon3163598898345372687.zip"
> Uploading: ./wagon3163598898345372687.zip to scp://localhost/tmp/site-deploy

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WAGON-343) wagon-scp should remove target area prior to uploading/unzipping new content

Posted by "Jamal (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/WAGON-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=280618#comment-280618 ] 

Jamal commented on WAGON-343:
-----------------------------

It sounds ok.  Are you thinking that this new command is a plugin goal that can be configured to be used when needed?

> wagon-scp should remove target area prior to uploading/unzipping new content
> ----------------------------------------------------------------------------
>
>                 Key: WAGON-343
>                 URL: https://jira.codehaus.org/browse/WAGON-343
>             Project: Maven Wagon
>          Issue Type: Bug
>          Components: wagon-ssh-external
>    Affects Versions: 1.0
>         Environment: Maven 3.0.3
> maven-site-plugin:3.0-beta-3
>            Reporter: Jamal
>            Priority: Minor
>         Attachments: ScpHelper.java
>
>
> Similiar to the request captured in this issue (https://jira.codehaus.org/browse/MSITE-250), my problem is that our target area gets out of sync when we upload our site generated content frequently using CI.  When files are moved/deleted, our site deployment target area becomes a hassle to keep correct because when noticed, we have to manually delete either old files, or the entire folder (because it's easier :)) prior to deploying the site.  I'd like it if the wagon-scp code could remove the files/subfolders in the target area prior to uploading.  
> I looked at the code, and a easy fix, which I tested, is to update the ScpHelper.putDirectory() method (in wagon-ssh-common) to remove the contents of the folder prior to uploading/unzipping the new files:  
> ...
>  try
>         {
>             executor.executeCommand( "cd " + path + "; rm -rf * ");
>             
>             wagon.put( zipFile, getPath( destDir, zipFile.getName() ) );
>             
>             executor.executeCommand( "cd " + path + "; unzip -q -o " + zipFile.getName() + "; rm -f " + zipFile.getName() );
>             zipFile.delete();
> ...
> I have attached the version of the file which I updated and tested, and below is what the output looks like with my simple test project.
> Password for dev@localhost: XXXXXX
> scp://localhost/tmp/site-deploy - Session: Opened  
> Executing command: mkdir -p /tmp/site-deploy/.
> Executing command: cd /tmp/site-deploy/.; rm -rf * 
> Executing command: mkdir -p /tmp/site-deploy/.
> Executing command: scp -t "/tmp/site-deploy/./wagon3163598898345372687.zip"
> Uploading: ./wagon3163598898345372687.zip to scp://localhost/tmp/site-deploy

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira