From 952e99cb6beb80193c491ce730cd9d86f756457c Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Thu, 9 Mar 2017 22:25:46 +0000 Subject: [PATCH] roles: bifrost-ironic-install: Add PyMySQL dependency for ironic-dbsync We are using MariaDB database for ironic so we need to install the optional PyMySQL dependency for sqlalchemy on all distributions otherwise ironic-dbsync fails with the following error: CRITI [ironic] ImportError: No module named pymysql Traceback (most recent call last): File "/usr/bin/ironic-dbsync", line 10, in sys.exit(main()) File "/usr/lib/python2.7/site-packages/ironic/cmd/dbsync.py", line 103, in main CONF.command.func() File "/usr/lib/python2.7/site-packages/ironic/cmd/dbsync.py", line 35, in upgrade migration.upgrade(CONF.command.revision) File "/usr/lib/python2.7/site-packages/ironic/db/migration.py", line 36, in upgrade return get_backend().upgrade(version) File "/usr/lib/python2.7/site-packages/ironic/db/sqlalchemy/migration.py", line 56, in upgrade alembic.command.upgrade(config, revision or 'head') [...] File "/usr/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/pymysql.py", line 49, in dbapi return __import__('pymysql') ImportError: No module named pymysql Change-Id: Ib44779de06a7bad91a08e148e1c0e1eb9815afe8 --- .../defaults/required_defaults_Suse_family.yml | 1 + .../roles/bifrost-ironic-install/tasks/install.yml | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml index a1394b814..020ff4bba 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml @@ -47,4 +47,5 @@ required_packages: - socat - python-pip - gcc + - python-PyMySQL iscsi_client_package: "open-iscsi" diff --git a/playbooks/roles/bifrost-ironic-install/tasks/install.yml b/playbooks/roles/bifrost-ironic-install/tasks/install.yml index 53905f481..7521a408b 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/install.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/install.yml @@ -85,6 +85,16 @@ - name: "Install pymysql in venv if using" include: pip_install.yml package=pymysql virtualenv=bifrost_venv_dir when: skip_install is not defined and (enable_venv | bool == true) +# NOTE(hwoarang): The python-pymysql package is not available on the CentOS7 +# and old Debian/Ubuntu repositories so we need to get it via pip +- name: "Install pymysql on CentOS/Ubuntu if necessary" + include: pip_install.yml package=pymysql + when: + - skip_install is not defined + - enable_venv | bool == false + - (ansible_distribution == 'CentOS' and ansible_distribution_major_version <= 7) or + (ansible_distribution == 'Ubuntu' and ansible_distribution_version|version_compare('14.10', '==')) + - name: "Install Ironic using pip" include: pip_install.yml package=ironic