Bug 976227 - Remote Agent Install doens't work
Remote Agent Install doens't work
Status: ON_DEV
Product: RHQ Project
Classification: Other
Component: Agent (Show other bugs)
4.7
Unspecified Unspecified
unspecified Severity medium (vote)
: ---
: ---
Assigned To: John Mazzitelli
Mike Foley
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-20 03:28 EDT by C Salperwyck
Modified: 2013-07-05 04:20 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
printscreen of the server side (25.04 KB, image/png)
2013-07-02 11:47 EDT, C Salperwyck
no flags Details
printscreen of the agent side (44.14 KB, image/png)
2013-07-02 11:51 EDT, C Salperwyck
no flags Details

  None (edit)
Description C Salperwyck 2013-06-20 03:28:00 EDT
Description of problem:
Can't install remotly an agent from RHQ Server UI

Version-Release number of selected component (if applicable):
Server: Windows 8
Agent: Centos 6.3

How reproducible:
Try to install an agent from a Windows server to a Linux agent (perhaps it doesn't work on other case)

Actual results:
we can see that the file is downloaded in the good directory but its name is like "C:\Devel\rhq-server-4.7.0\modules\org\rhq\rhq-enterprise-server-startup-subsystem\main\deployments\rhq.ear\rhq-downloads\rhq-agent\rhq-enterprise-agent-4.7.0.jar"
instead of:
"rhq-enterprise-agent-4.7.0.jar"
and therefore it can't be installed after being downloaded

Expected results:
the downloaded file on this agent should be:
"rhq-enterprise-agent-4.7.0.jar"
Comment 1 John Mazzitelli 2013-06-29 17:24:12 EDT
i'll take a look at this Monday.
Comment 2 John Mazzitelli 2013-07-01 14:18:26 EDT
i'm having trouble getting my windows environment running. since the description of the issue didn't provide any details such as debug log messages from the server log, I don't even know where in the server this is happening.

Can I ask the reporter to rerun the RHQ server (start with a cleaned out logs/ directory) in debug mode and then post the server log once you get this error again?
Comment 3 C Salperwyck 2013-07-02 11:47:33 EDT
Created attachment 767811 [details]
printscreen of the server side
Comment 4 C Salperwyck 2013-07-02 11:51:50 EDT
Created attachment 767812 [details]
printscreen of the agent side
Comment 5 John Mazzitelli 2013-07-02 12:02:49 EDT
can you provide the server logs? See my previous comment:

> ... rerun the RHQ server (start with a cleaned out logs/ directory)
> in debug mode and then post the server log once you get this error again?

the debug logs will be able to help pinpoint some details in the server internals. screen snapshots does not provide this level of detail needed.
Comment 6 C Salperwyck 2013-07-02 12:05:14 EDT
17:36:13,483 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Running SSH command [Machine uname]
17:36:14,549 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:14,549 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:14,549 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Result of SSH command [Machine uname]: Linux localhost.localdomain 2.6.32-279.19.1.el6.x86_64 #1 SMP Wed Dec 19 07:05:20 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
17:36:14,550 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Running SSH command [Java Version Check]
17:36:15,612 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:15,612 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:15,612 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Result of SSH command [Java Version Check]: java version "1.6.0_24"
17:36:15,612 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Running SSH command [Create Agent Install Directory]
17:36:16,674 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:16,674 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:16,674 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Result of SSH command [Create Agent Install Directory]: 
17:36:16,674 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Copying agent binary update distribution file to [10.22.1.30]...
17:36:17,704 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Agent binary update distribution file copied
17:36:17,704 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Running SSH command [Change to install directory]
17:36:17,765 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:17,765 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:17,765 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Result of SSH command [Change to install directory]: 
17:36:17,765 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Running SSH command [Install Agent]
17:36:17,827 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=1
17:36:17,828 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=1
17:36:17,828 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Result of SSH command [Install Agent]: null
17:36:17,828 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Will start new agent @ [10.22.1.30] pointing to server @ [CSALPERWYCK-DT.akio.fr]
17:36:17,828 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Running SSH command [Start New Agent]
17:36:18,890 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:18,890 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:18,890 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Result of SSH command [Start New Agent]: 
17:36:19,262 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Running SSH command [Find Agent Install Path]
17:36:20,324 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:20,324 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:20,324 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Result of SSH command [Find Agent Install Path]: /home/akiotest/.java/.userPrefs/rhq-agent
17:36:20,324 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Running SSH command [Find Agent Install Path]
17:36:21,386 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:21,386 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:21,386 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Result of SSH command [Find Agent Install Path]: /home/akiotest/.java/.userPrefs/rhq-agent
17:36:21,386 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Running SSH command [Agent Install Check]
17:36:22,448 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:22,448 DEBUG [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) SSH reading exit status=0
17:36:22,448 INFO  [org.rhq.enterprise.server.install.remote.SSHInstallUtility] (http-/0.0.0.0:7080-3) Result of SSH command [Agent Install Check]:
Comment 7 John Mazzitelli 2013-07-02 13:30:21 EDT
I think I may have found the issue (though I don't have a Windows machine right now to confirm):

The method:

org.rhq.enterprise.server.install.remote.SSHFileSend.sendFile(Session, String, String)

has this code in it:

            //send "C0644 filesize filename" where filename doesn't contain a /
            long filesize = (new File(sourceFilename)).length();
            command = "C0644 " + filesize + " ";
            if (sourceFilename.lastIndexOf('/') > 0) {
                command += sourceFilename.substring(sourceFilename.lastIndexOf('/') + 1);
            } else {
                command += sourceFilename;
            }

I think we need to check for Windows separators here (\) as well as Linux separators (/).
Comment 8 John Mazzitelli 2013-07-02 13:51:28 EDT
git commit 70db4e0 checks for Windows separator in the source path and strips the file name if one is found.

I'm skeptical this actually fixes the problem, because it turns out this only touches the source filename, not the destination (and I think its the destFilename parameter that is causing the issue) but I don't know for sure. Would need someone on Windows who can build and test to confirm this fix actually works.
Comment 9 C Salperwyck 2013-07-05 04:20:36 EDT
I can do the test but do you have a night build? or what module should I build and replace? (I would like to avoid to dl all rhq sources ;-))

By the way, why you don't use the function "File.separator" to have just one condition?

Note You need to log in before you can comment on or make changes to this bug.