colon sign in password for mysql connection

Bug #1672778 reported by Alexander
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
New
Undecided
Unassigned

Bug Description

I've set up mysql password inside configuration files /etc/glance/glance-registry.conf and /etc/glance/glance-api.conf in section "database" setting "connection" to value

mysql+pymysql://glance:pwdwith:colon@controller/glance

and during populating of database with command "glance-manage db_sync"

I've got exit code 1 and next strace output in log file /var/log/glance/api.log:

2017-03-14 16:18:55.631 10528 CRITICAL glance [-] ValueError: invalid interpolation syntax in 'mysql+pymysql://glance:pwdwith%3Acolon@controller/glance' at position 30
2017-03-14 16:18:55.631 10528 ERROR glance Traceback (most recent call last):
2017-03-14 16:18:55.631 10528 ERROR glance File "/usr/bin/glance-manage", line 10, in <module>
2017-03-14 16:18:55.631 10528 ERROR glance sys.exit(main())
2017-03-14 16:18:55.631 10528 ERROR glance File "/usr/lib/python2.7/site-packages/glance/cmd/manage.py", line 447, in main
2017-03-14 16:18:55.631 10528 ERROR glance return CONF.command.action_fn()
2017-03-14 16:18:55.631 10528 ERROR glance File "/usr/lib/python2.7/site-packages/glance/cmd/manage.py", line 286, in sync
2017-03-14 16:18:55.631 10528 ERROR glance self.command_object.sync(CONF.command.version)
2017-03-14 16:18:55.631 10528 ERROR glance File "/usr/lib/python2.7/site-packages/glance/cmd/manage.py", line 116, in sync
2017-03-14 16:18:55.631 10528 ERROR glance alembic_migrations.place_database_under_alembic_control()
2017-03-14 16:18:55.631 10528 ERROR glance File "/usr/lib/python2.7/site-packages/glance/db/sqlalchemy/alembic_migrations/__init__.py", line 76, in place_database_under_alembic_control
2017-03-14 16:18:55.631 10528 ERROR glance a_config = get_alembic_config()
2017-03-14 16:18:55.631 10528 ERROR glance File "/usr/lib/python2.7/site-packages/glance/db/sqlalchemy/alembic_migrations/__init__.py", line 40, in get_alembic_config
2017-03-14 16:18:55.631 10528 ERROR glance config.set_main_option('sqlalchemy.url', sqlalchemy_url)
2017-03-14 16:18:55.631 10528 ERROR glance File "/usr/lib/python2.7/site-packages/alembic/config.py", line 218, in set_main_option
2017-03-14 16:18:55.631 10528 ERROR glance self.set_section_option(self.config_ini_section, name, value)
2017-03-14 16:18:55.631 10528 ERROR glance File "/usr/lib/python2.7/site-packages/alembic/config.py", line 245, in set_section_option
2017-03-14 16:18:55.631 10528 ERROR glance self.file_config.set(section, name, value)
2017-03-14 16:18:55.631 10528 ERROR glance File "/usr/lib64/python2.7/ConfigParser.py", line 752, in set
2017-03-14 16:18:55.631 10528 ERROR glance "position %d" % (value, tmp_value.find('%')))
2017-03-14 16:18:55.631 10528 ERROR glance ValueError: invalid interpolation syntax in 'mysql+pymysql://glance:pwdwith%3Acolon@controller/glance' at position 30
2017-03-14 16:18:55.631 10528 ERROR glance

I'm trying to setup OpenStack ocata using installation manual https://docs.openstack.org/ocata/install-guide-rdo/glance-install.html

Btw the same password in Keystone works well

Brief investigation of the issue showed me that bug caused by "sqlalchemy.engine.url.URL" class method "__to_string__" which used in function "get_alembic_config" (in module glance.db.sqlalchemy.alembic_migrations) via str(engine.url)

Inside this function password field is converted by method "_rfc_1738_quote" which replace characters :@/ to according URL-safe sequences. Then python parser SafeConfigParser is not able to identify interpolation pattern (in my case it is '%3A')

So I can suppose that it is not possible to use these characters inside config files mentioned above for database/connection setting

In installation manual I did not find any notifications that these characters forbidden in MySQL password

I can not reproduce this issue on OpenStack Liberty

Thank you

Tags: db
Alexander (aursu)
tags: added: db
Revision history for this message
Alexander (aursu) wrote :

OS: CentOS 7.3.1611
OpenStack Serie: Ocata
rpm package: python-glance-14.0.0

Revision history for this message
Gleb Zimin (gzimin) wrote :

So, this is the similar bug like this https://bugs.launchpad.net/glance/+bug/1695299
You can try to use this https://review.openstack.org/#/c/498427/3
Or this https://review.openstack.org/#/c/499410/
As i understand we can't use special symbols in user entered password, proof you can find here https://review.openstack.org/#/c/2682/
In future pay attention for this. I think we need to notice developers in documentation.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.