Bug 718315

Summary: auto-installer appending blank properties when installing on Oracle
Product: [Other] RHQ Project Reporter: John Mazzitelli <mazz>
Component: InstallerAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: high    
Version: 4.0.1CC: hrupp, ian.springer
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-07 19:28:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 678340    

Description John Mazzitelli 2011-07-01 19:04:12 UTC
While doing a silent upgrade install w/ an Oracle db, I saw the 
following in the server log:

2011-06-30 16:45:05,383 INFO  
[org.rhq.enterprise.installer.ConfigurationBean] Oracle does not need to 
have server-name,
  port and db-name individually set, skipping

I then looked at my rhq-server.properties file and noticed some new 
lines had been appended to it, presumably by the installer:

rhq.server.database.db-name=
rhq.server.database.server-name=
rhq.server.database.password=jon
rhq.server.database.port=

This doesn't seem right, because I already have all four of these props 
defined in rhq-server.properties:

<snip>
rhq.server.database.password = -17408cdce5dc39fc
rhq.server.database.server-name = foo.redhat.com
rhq.server.database.port = 1521
rhq.server.database.db-name = JON
<snip>

I'm guessing the appending of the db-name, server-name, and port props 
are related to the log message above. I have no idea why the password 
prop was appended.

My upgrade happened to fail, so I attempted to run the installer a 
second time but got the following error in the server log, presumably 
caused by the "rhq.server.database.password=jon" line which was appended 
to the properties file:

2011-06-30 17:34:55,274 FATAL 
[org.rhq.enterprise.installer.ConfigurationBean] Could not decrypt the 
password for some reason - auto-installation failed
java.lang.Exception: Decoding db password failed:
     at 
org.rhq.enterprise.installer.ConfigurationBean.decodePassword(ConfigurationBean.java:803)
     at 
org.rhq.enterprise.installer.ConfigurationBean.save(ConfigurationBean.java:549)
     at 
org.rhq.enterprise.installer.AutoInstallServlet.init(AutoInstallServlet.java:49)
<snip>
Caused by: java.lang.NumberFormatException: For input string: "jon"
     at 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
     at java.lang.Integer.parseInt(Integer.java:449)
     at java.math.BigInteger.<init>(BigInteger.java:316)
     at 
org.jboss.resource.security.SecureIdentityLoginModule.decode(SecureIdentityLoginModule.java:168)
<snip>

I've hit this several times now

Comment 1 John Mazzitelli 2011-07-01 19:04:43 UTC
this was posted to rhq-devel mailing list today by ips

Comment 2 John Mazzitelli 2011-08-08 19:53:58 UTC
the main problem is the spaces surrounding the "=". Unknown why this is behaving like that (I thought the Java Properties API supported "a = b" as well as "a=b", but whatever code is used, it doesn't like the spaces).

So, to fix the problem, don't use spaces around "=". So you want:

<snip>
rhq.server.database.password=-17408cdce5dc39fc
rhq.server.database.server-name=foo.redhat.com
rhq.server.database.port=1521
rhq.server.database.db-name=JON
<snip>

Comment 3 John Mazzitelli 2011-08-08 20:53:12 UTC
I found that this is a limitation in the RHQ utility PropertiesFileUpdate. This is the utility that we use to "update" or "modify" a properties file where we can change the value of a property value (the right side of the equals sign) by reusing the existing line in the .properties file that already defines the property name (the left side of the equals sign).

I fixed the code and added a unit test. Should be in master today or sometime soon.

That said, I do not know why "jon" ended up as your password default. I suspect its probably grabbing it as a default from some build artifact, but I really don't know. In any event, I think fixing this spaces-around-equals is going to fix this anyway.

Comment 4 Mike Foley 2011-08-09 14:33:54 UTC
verified 8/9/2011 build.  tested adding leading and trailing spaces to oracle configuration information.  verifying the connection to oracle.

Comment 5 Mike Foley 2012-02-07 19:28:08 UTC
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE