| Summary: | Passing agent command-line options via start script/environment prevents agent from starting as normal | ||
|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | Larry O'Leary <loleary> |
| Component: | Agent | Assignee: | Charles Crouch <ccrouch> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Mike Foley <mfoley> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 4.2 | CC: | ccrouch, hbrock, hrupp, mazz |
| Target Milestone: | --- | ||
| Target Release: | JON 3.1.0, RHQ 4.3.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Fixed In Version: | 4.3 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-08-31 10:09:47 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Bug Depends On: | |||
| Bug Blocks: | 782579 | ||
|
Description
Larry O'Leary
2011-12-18 06:23:21 UTC
I think the issue here is the following lines in rhq-agent-wrapper.sh and the equivalent lines in rhq-agent-wrapper.bat:
if [ "x$RHQ_AGENT_CMDLINE_OPTS" = "x" ]; then
RHQ_AGENT_CMDLINE_OPTS=--daemon
fi
export RHQ_AGENT_CMDLINE_OPTS
These lines run after rhq-agent-env.sh is sourced.
They should be replaced with something like:
found_daemon_option=0
for opt in $RHQ_AGENT_CMDLINE_OPTS; do
if [ "$opt" = "-d" ] || [ "$opt" = "--daemon" ]; then
found_daemon_option=1
break
fi
done
if [ "$found_daemon_option" = "0" ]; then
RHQ_AGENT_CMDLINE_OPTS="--daemon $RHQ_AGENT_CMDLINE_OPTS"
fi
export RHQ_AGENT_CMDLINE_OPTS
This way, we ensure the --daemon option always gets included in $RHQ_AGENT_CMDLINE_OPTS, whether or not the user defined RHQ_AGENT_CMDLINE_OPTS. Because the wrapper scripts always want the daemon option.
I don't think we need to add support for a RHQ_AGENT_ADDITIONAL_CMDLINE_OPTS variable, since the wrapper script setting of --daemon is the one special case of a hard-coded option. The scripts don't set any default options that are only used when RHQ_AGENT_CMDLINE_OPTS is not predefined, so it's a bit of a different beast than RHQ_AGENT_JAVA_OPTS.
Note, due to the fact that rhq-agent-env.sh is used by both rhq-agent-wrapper.sh and rhq-agent.sh, users should never include --daemon when setting RHQ_AGENT_CMDLINE_OPTS in rhq-agent-env.sh. We should remove it from the commented out "#RHQ_AGENT_CMDLINE_OPTS=" line in the default rhq-agent-env.sh and add a comment telling users to never include --daemon in the value. I'll create a separate BZ for that change.
ian's proposed fix to rhq-agent-wrapper.sh looks good. I would recommend that solution. Yes, the point was to always make sure --daemon should be there (even though what we have didn't really do that 100% of the time). However we can ensure that --daemon is there, we should do it. per bz triage (asantos, ccrouch, mfoley. loleary) Fixed in master: http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=31181a3 and: http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=d838043 Note, the fix was not required on the Windows side, because rhq-agent-wrapper.bat does not use the RHQ_AGENT_CMDLINE_OPTS variable. Instead, when starting the Agent via rhq-agent-wrapper.bat, Agent command line options must be specified in wrapper\rhq-agent-wrapper.conf or wrapper\rhq-agent-wrapper.inc. I did add some better comments in rhq-agent-env.bat regarding RHQ_AGENT_CMDLINE_OPTS and a couple other variables not being used by rhq-agent-wrapper.bat. Bulk close of old bugs in VERIFIED state. |