Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1516992

Summary: Cannot use % on password for aodh connection to database
Product: Red Hat OpenStack Reporter: Marc Methot <mmethot>
Component: openstack-aodhAssignee: Mehdi ABAAKOUK <mabaakou>
Status: CLOSED ERRATA QA Contact: Sasha Smolyak <ssmolyak>
Severity: medium Docs Contact:
Priority: low    
Version: 9.0 (Mitaka)CC: apevec, ccollett, ealcaniz, jschluet, lhh, mabaakou, pkilambi
Target Milestone: zstreamKeywords: Triaged, ZStream
Target Release: 9.0 (Mitaka)   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: openstack-aodh-2.0.5-2.el7ost Doc Type: Bug Fix
Doc Text:
Previously, using a '%' character in the password connection string for aodh would cause aodh-dbsync to throw an error. With this update, you can now use a '%' in the password for the database url.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-15 12:45:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marc Methot 2017-11-23 19:36:03 UTC
Using a % in the password connection string for aodh:
-------------------------------------------
#vi /etc/aodh/aodh.conf
[database]
connection = mysql+pymysql://aodh:password%@111.111.111.111/aodh
-------------------------------------------
makes aodh-dbsync throw the following error:
-------------------------------------------
017-11-21 12:19:08.989 17234 CRITICAL aodh [-] ValueError: invalid interpolation syntax in 'mysql+pymysql://aodh:password%@111.111.111.111/aodh' at position 28
2017-11-21 12:19:08.989 17234 ERROR aodh Traceback (most recent call last):
2017-11-21 12:19:08.989 17234 ERROR aodh   File "/usr/bin/aodh-dbsync", line 10, in <module>
2017-11-21 12:19:08.989 17234 ERROR aodh     sys.exit(dbsync())
2017-11-21 12:19:08.989 17234 ERROR aodh   File "/usr/lib/python2.7/site-packages/aodh/cmd/storage.py", line 29, in dbsync
2017-11-21 12:19:08.989 17234 ERROR aodh     storage.get_connection_from_config(conf).upgrade()
2017-11-21 12:19:08.989 17234 ERROR aodh   File "/usr/lib/python2.7/site-packages/aodh/storage/impl_sqlalchemy.py", line 84, in upgrade
2017-11-21 12:19:08.989 17234 ERROR aodh     cfg = self._get_alembic_config()
2017-11-21 12:19:08.989 17234 ERROR aodh   File "/usr/lib/python2.7/site-packages/aodh/storage/impl_sqlalchemy.py", line 80, in _get_alembic_config
2017-11-21 12:19:08.989 17234 ERROR aodh     self.conf.database.connection)
2017-11-21 12:19:08.989 17234 ERROR aodh   File "/usr/lib/python2.7/site-packages/alembic/config.py", line 201, in set_main_option
2017-11-21 12:19:08.989 17234 ERROR aodh     self.file_config.set(self.config_ini_section, name, value)
2017-11-21 12:19:08.989 17234 ERROR aodh   File "/usr/lib64/python2.7/ConfigParser.py", line 752, in set
2017-11-21 12:19:08.989 17234 ERROR aodh     "position %d" % (value, tmp_value.find('%')))
2017-11-21 12:19:08.989 17234 ERROR aodh ValueError: invalid interpolation syntax in 'mysql+pymysql://aodh:password%@111.111.111.111/aodh' at position 28
2017-11-21 12:19:08.989 17234 ERROR aodh 
-------------------------------------------

AFAIK, using % in the password should be possible. The rest of OpenStack Services are using the very same password without any problem to connect to DB.

[root@server1 ~(keystone_admin)]$ rpm -qa | grep aodh
openstack-aodh-expirer-2.0.5-1.el7ost.noarch
python-aodhclient-0.5.0-1.el7ost.noarch
openstack-aodh-notifier-2.0.5-1.el7ost.noarch
openstack-aodh-compat-2.0.5-1.el7ost.noarch
openstack-aodh-common-2.0.5-1.el7ost.noarch
openstack-aodh-api-2.0.5-1.el7ost.noarch
python-aodh-2.0.5-1.el7ost.noarch
openstack-aodh-listener-2.0.5-1.el7ost.noarch
openstack-aodh-evaluator-2.0.5-1.el7ost.noarch

I also replicated this issue in OSP10

Comment 7 errata-xmlrpc 2018-03-15 12:45:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0540