Release Automation

 View Only
Expand all | Collapse all

How to User SCP command to copy Files from one server to another server using CA RA Tool

  • 1.  How to User SCP command to copy Files from one server to another server using CA RA Tool

    Posted Jun 13, 2016 05:48 PM

    Hi I need a help to use the SCP command  or Copy filese from one server to another server on linux/unix environment by using CA Release Automation Tool.

     

    Please any one is having sample docs or information post me.



  • 2.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Broadcom Employee
    Posted Jun 13, 2016 06:01 PM

    Hello,

     

    If you are required to use the scp command then you can try passing the exact command that you want through the "Run Command Line" action and then parameterize it to your liking. But there are other actions like "Put File (SSH)", "Get File (SSH)", "Get File Or Folder From Remote Agent", "Put File Or Folder in Remote Agent", etc.. that you can possibly use to achieve the same thing.

     

    Regards,

    Gregg



  • 3.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Posted Jun 13, 2016 08:06 PM

    Hi Gregg,

     

    I am trying to use run command line action but getting below error message,

     

    Description:Run Command Line action has finished successfully.
    Return value: 1
    Std out:
    Std err: Host key verification failed. 
    Command line executed: /bin/sh -c scp capio@cappoc.snt.bst.bls.com:/opt/app/add-on/production_staging/R116/production_0416/PricerD/Pricing.war /opt/app/capio/release/PricerD_wbl_release/deploy_20160613


  • 4.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Posted Jun 13, 2016 08:09 PM

    Hi Gregg,

     

    Also when use SSH actions that time i am getting below error message,

     

    Description:No password and no keystore file is given - unable to proceed with authentication

     

    I am not aware what is Keystore files. also I instaaled the agent with user as Capio. as mentioned in earlier scp command.



  • 5.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Broadcom Employee
    Posted Jun 13, 2016 08:43 PM

    Hello,

     

    I think the key for getting this to work will be to:

    a. Understand that when executed via Release Auto you will not be able to provide a password to the password prompt. It must be completely unattended.

    b. Get it to work (under the guidelines of #1) manually on the agent machine using the login ID that owns the nolioagent process (or another user - but that will require other RA settings like setting up the action and agent process owner to use sudo)

     

    based on this stackoverflow q&a it looks like you cannot pass the users password via an scp argument. And now I remember a similar situation that I tried to accommodate by using an expect script. The alternative to an expect script is to use ssh keys for the scp command. If you want to use this option the have a look at the section named

    SSH and SCP Without Passwords"

     

    available here:

    How To Remotely Copy Files Over SSH Without Entering Your Password



  • 6.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Posted Jun 14, 2016 04:24 PM

    Hi Gregg,

     

    Thanks for your response and help. it helped me a lot. Now I able to connect my source server to get a file on the target server by using Get File (SSH) action, but this action is not able to copy a single file from source (/opt/app/add-on/production_staging/R116/abc.war) to target if I specify the name of file in a path. and if i remove the file name (/opt/app/add-on/production_staging/R116/) it works and copy all files from source to target.

    My requirement is to copy a single file from source to target.

     

    any idea how this Get file (ssh) action works internally.



  • 7.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Broadcom Employee
    Posted Jun 14, 2016 05:38 PM

    Ahh, glad to hear you are making progress. Regarding the situation you're in now, what do you use in the "Full Target File Path" field when the "Full Source File Path" field is pointing to a file? I believe the "Full Target File Path" field should also point to a final filename.

     

    Example:

    Full Source File Path: /opt/app/add-on/production_staging/R116/abc.war

    Full Target File Path: /opt/app/add-on/production_staging/R116/abc.war

    or maybe

    Full Target File Path: /opt/app/add-on/production_staging/R116/somethingDifferent.war

     

    Cheers,
    Gregg

     

    - Did this answer your question? If it did please mark it as answered.



  • 8.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Posted Jun 14, 2016 05:46 PM

    Hi Gregg,

     

    If I mention full source path (with filename) as /opt/app/add-on/production_staging/R116/abc.war, the action gets failed and if i mentioned full source path as "/opt/app/add-on/production_staging/R116/" i.e. without file name its successful and copy all files from source to target.



  • 9.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Posted Jun 14, 2016 05:50 PM

    Here are the action test logs for your reference,

     

    Failes Scenario:

    Description:Failed to retrieve file from [zltv3227.vci.att.com: /opt/app/add-on/production_staging/R116/production_0416/PricerD/Pricing.war] to [local: /opt/app/capio/release/PricerD_wbl_release/deploy_20160613], Target is existing directory (/opt/app/capio/release/PricerD_wbl_release/deploy_20160613) but source is not a directory (/opt/app/add-on/production_staging/R116/production_0416/PricerD/Pricing.war)

     

    Success Scenario:

    Agent:cappoc.snt.bst.bls.com
    Description:Successfully retrieved file from [zltv3227.vci.att.com: /opt/app/add-on/production_staging/R116/production_0416/PricerD/] to [local: /opt/app/capio/release/PricerD_wbl_release/deploy_20160613].


  • 10.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Broadcom Employee
    Posted Jun 14, 2016 06:14 PM

    It looks like it fails because you're still not providing a filename in the full target field. It looks like you're just giving a directory name and so its effectively trying to replace a folder with a filE which can't be done.

     

    Regards,

    gregg



  • 11.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Posted Jun 14, 2016 06:56 PM

    Hi Gregg,

     

    In this path /opt/app/add-on/production_staging/R116/production_0416/PricerD/Pricing.war

     

    Pricing.war is my file name on source server and its mentioned in a full source path and it fails when I mention filename in a source path.



  • 12.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool
    Best Answer

    Broadcom Employee
    Posted Jun 14, 2016 07:03 PM

    Right. What I'm saying is that you should include Pricing.war at the end of your target path. Right now it looks like it only has a directory. It needs a filename at the end.

     

    Regards,

    gregg



  • 13.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Posted Jun 14, 2016 07:25 PM

    Thank you so much Gregg. This worked perfectly. I was thinking in a normal way as a=like copy action for target path.

     

    KB here is : To use Get File(ssh) action we should specify the file names to be copied in both source and target path.



  • 14.  Re: How to User SCP command to copy Files from one server to another server using CA RA Tool

    Broadcom Employee
    Posted Jun 14, 2016 07:29 PM

    Great. Good idea for a KB, thanks! I'll work on getting that prepared tomorrow.

     

    Cheers,

    gregg