← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1672778] [NEW] colon sign in password for mysql connection

 

Public bug reported:

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

** Affects: glance
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1672778

Title:
  colon sign in password for mysql connection

Status in Glance:
  New

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1672778/+subscriptions