Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql functions break with password warning on mysql 5.6 #318

Closed
lfolco opened this issue Feb 24, 2016 · 1 comment
Closed

mysql functions break with password warning on mysql 5.6 #318

lfolco opened this issue Feb 24, 2016 · 1 comment

Comments

@lfolco
Copy link
Contributor

lfolco commented Feb 24, 2016

Mysql 5.6 adds the warning "Warning: Using a password on the command line interface can be insecure." when you use the password on the command line. A lot of the mysql functions currently try to cast the result of a query to an int, which is failing due to the password warning:

def user_exists(name, host='localhost', **kwargs):
    """
    Check if a MySQL user exists.
    """
    with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
        res = query("""
            use mysql;
            SELECT COUNT(*) FROM user
                WHERE User = '%(name)s' AND Host = '%(host)s';
            """ % {
                'name': name,
                'host': host,
            }, **kwargs)
    return res.succeeded and (int(res) == 1)
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/fabric/main.py", line 743, in main
    *args, **kwargs
  File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 368, in execute
    multiprocessing
  File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 264, in _execute
    return task.run(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 171, in run
    return self.wrapped(*args, **kwargs)
  File "/Users/lfolco/Sites/sitename/dev/sitename.com/fabfile.py", line 465, in setup_mysql
    require.mysql.user('%(db_magento_user)s' % env, '%(db_magento_password)s' % env)
  File "/Library/Python/2.7/site-packages/fabtools/require/mysql.py", line 70, in user
    if not user_exists(name, **kwargs):
  File "/Library/Python/2.7/site-packages/fabtools/mysql.py", line 56, in user_exists
    return res.succeeded and (int(res) == 1)
ValueError: invalid literal for int() with base 10: 'Warning: Using a password on the command line interface can be insecure.\r\n0'
@sunu
Copy link

sunu commented May 4, 2017

@hobbestigrou Hi, I have fabtools==0.20.0 and this bug is still there for me. Here's the traceback

Traceback (most recent call last):
  File "/home/tarashish/work/fabenv/local/lib/python2.7/site-packages/fabric/main.py", line 757, in main
    *args, **kwargs
  File "/home/tarashish/work/fabenv/local/lib/python2.7/site-packages/fabric/tasks.py", line 386, in execute
    multiprocessing
  File "/home/tarashish/work/fabenv/local/lib/python2.7/site-packages/fabric/tasks.py", line 276, in _execute
    return task.run(*args, **kwargs)
  File "/home/tarashish/work/fabenv/local/lib/python2.7/site-packages/fabric/tasks.py", line 173, in run
    return self.wrapped(*args, **kwargs)
  File "/home/tarashish/work/muziris/deploy/fabfile.py", line 305, in setup
    setup_mysql()
  File "/home/tarashish/work/fabenv/local/lib/python2.7/site-packages/fabric/tasks.py", line 170, in __call__
    return self.run(*args, **kwargs)
  File "/home/tarashish/work/fabenv/local/lib/python2.7/site-packages/fabric/tasks.py", line 173, in run
    return self.wrapped(*args, **kwargs)
  File "/home/tarashish/work/muziris/deploy/fabfile.py", line 72, in setup_mysql
    require.mysql.user(env['db_user'], env['db_user_pwd'])
  File "/home/tarashish/work/fabenv/local/lib/python2.7/site-packages/fabtools/require/mysql.py", line 115, in user
    if not user_exists(name, **kwargs):
  File "/home/tarashish/work/fabenv/local/lib/python2.7/site-packages/fabtools/mysql.py", line 56, in user_exists
    return res.succeeded and (int(res) == 1)
ValueError: invalid literal for int() with base 10: 'mysql: [Warning] Using a password on the command line interface can be insecure.\r\n0'
Disconnecting from vagrant@192.168.33.13... done.
(fabenv)
→ pip freeze | grep fabtools    
You are using pip version 6.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
fabtools==0.20.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants