Bug 601460

Summary: on Windows, RHQ_AGENT env vars get updated in parent cmd.exe window by Agent upgrade install
Product: [Other] RHQ Project Reporter: Ian Springer <ian.springer>
Component: AgentAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED NOTABUG QA Contact: Mike Foley <mfoley>
Severity: low Docs Contact:
Priority: low    
Version: 1.3.1CC: ccrouch, jshaughn
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-29 15:37:04 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
agent update log (contains multiple install/update runs)
none
not sure if this has any relevance, but attaching just in case (it was in the /opt dir, which was what I passed as the arg to --install) none

Description Ian Springer 2010-06-07 22:49:19 EDT
I ran:

java -jar rhq-enterprise-agent-3.0.0.Beta1.jar --install=C:\opt 

to install the 3.0.0.Beta1 Agent. There was already an Agent installed on the box in C:\opt\rhq-agent, but I'm not sure whether it was running or not.

I just remembered that the Agent start bat file will use RHQ_AGENT_HOME, rather than its parent dir, as the Agent dir, if that env var is set. I checked the env vars in my current command window and sure enough the following vars were set:

 RHQ_AGENT_BIN_DIR_PATH=C:\opt\rhq-agent-OLD\bin\
 RHQ_AGENT_HOME=C:\opt\rhq-agent-OLD
 RHQ_AGENT_JAVA_ENDORSED_DIRS=C:\opt\rhq-agent-OLD\lib\endorsed
 RHQ_AGENT_JAVA_EXE_FILE_PATH=C:\opt\jdk-1.6.0_16\bin\java.exe
 RHQ_AGENT_JAVA_HOME=C:\opt\jdk-1.6.0_16
 RHQ_AGENT_JAVA_LIBRARY_PATH=C:\opt\rhq-agent-OLD\lib
 RHQ_AGENT_JAVA_OPTS=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true
 RHQ_AGENT_MAINCLASS=org.rhq.enterprise.agent.AgentMain

C:\opt\rhq-agent-OLD is where the 1.2.0.GA Agent is installed, which explains the "RHQ 1.2.0.GA [3862] (Mon Apr 27 16:55:22 EDT 2009)" printed when the Agent starts up (even though I'm starting it from C:\opt\rhq-agent which is a 3.0.0.Beta1 install). I didn't set these variables myself, so I'm guessing either the upgrade/install process or the start bat file set them and not from within a SETLOCAL/ENDLOCAL block, so they got updated in the enclosing command window. I would check carefully that anywhere you set RHQ_AGENT_* env vars is enclosed in SETLOCAL/ENDLOCAL.

My Agent updater/installer logs are attached.
Comment 1 Ian Springer 2010-06-07 22:51:08 EDT
Created attachment 421996 [details]
agent update log (contains multiple install/update runs)
Comment 2 Ian Springer 2010-06-07 22:52:18 EDT
Created attachment 421997 [details]
not sure if this has any relevance, but attaching just in case (it was in the /opt dir, which was what I passed as the arg to --install)
Comment 3 John Mazzitelli 2010-06-08 12:23:15 EDT
Ian, can you confirm the commands you ran. The only way for the "-OLD" directories to be created was if you did a "--upgrade". So, I think somewhere along the line, you did an --upgrade. Do you know for sure if you did?
Comment 4 John Mazzitelli 2010-06-08 12:30:23 EDT
I also think this might have something to do with the errors in the log about not being able to delete files. I suspect another command window (or some other process) had a current working directory of the C:\opt\rhq-agent (or subdirectory) and thus had it locked (i.e. windows won't be able to delete it). This looks to cause the install/update to encounter an error and try to roll back the install.
Comment 5 John Mazzitelli 2010-06-08 12:39:58 EDT
I just saw one thing that may explain this.

If you --install the 1.2 agent in C:\opt, then you --install (NOT update) the 3.0 agent in the same C:\opt, this is bad and you will get overlapping agents (e.g. I see both rhq-core-enterprise-agent.jars from both 1.2 and 3.0 - which is bad and makes it look like the agent you are running is still the 1.2 version becaues that jar is picked up first).

You must not --install twice in the same directory - if you already have an agent installed in C:\opt, you can "overlay" an agent in the same location, but you must use the --update.

(I still haven't been able to replicate the environment variables getting set in my console.)

I'm on Windows XP.
Comment 6 John Mazzitelli 2010-08-24 13:20:47 EDT
unassigning and lowering severity. I've not been able to reproduce this. Should get someone else to attempt to reproduce to see if its really a problem or not.