Red Hat Bugzilla – Bug 591576
Request option to to use a directory other than the parent directory for the upgrade jar
Last modified: 2014-05-29 14:03:54 EDT
Description of problem:
Customer is requesting the option to to use a directory other than the parent directory for the upgrade jar.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
mazz - what would it take to fix this? (see issuetracker)
it would not be trivial to fix this - it would involve alot of work. You'd first have to add a new agent preference to indicate where this other directory would be and then we'd have to get the agent to pass that somehow to the ant script. The ant script would then have to be refactored to install into this new temp directory, clean out the old agent location and copy the new temp content into the original agent location. We'd have to backup the original somewhere too (because we use that to revert back to the old agent if the upgrade fails). So the revert portion of the code/script needs to be refactored to know about this custom temp location. There would be alot here to fix this.
I would say we not do this. The solution to the problem is to make an intermediate level in your file system where the agent and its backup versions can go that you can give proper file permissions.
For example, as I understand the problem, the issue is the user installed the agent in a directory like this:
And the agent is only given write permissions to that directory, and not the parent (/opt). Thus the auto-upgrade fails because we can't write to /opt which is where we'd store/backup our old files and build the new agent.
The solution is to create a intermediate location:
and install the agent to "/opt/rhq/rhq-agent".
You'd give the agent write access to /opt/rhq. This solves the problem.
BTW: my recommended solution is already documented here:
"Install The Agent In A Writable Directory
During the update process, files will need to be written in the directory where the agent is currently installed. This means that the parent directory of the agent's install directory must be writable by the user that is running the agent. As an example, if the agent's $RHQ_AGENT_HOME (i.e. where the agent is installed) is the directory called "/opt/rhq-agent-parent/rhq-agent", the agent will need to write files to the "/opt/rhq-agent-parent" directory and therefore must have write permissions there."
So those that are installing the agent should have already followed those instructions. Everyone reads the documentation when they install don't they ;)