From be2e28d013e29140b0e401d9de3d49f1f14febcd Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Tue, 8 Mar 2016 09:41:49 -0500 Subject: [PATCH] Change inspector config to use MySQL As a result of the playbooks combined with the use of the sqllite database file, the inspector functionality was partially broken and could not be re-run without clean-up, in the form of the sqllite database file being removed, between test runs. Closes-Bug: #1554174 Change-Id: I77d33546dd97348298072b5047502b6705dfca11 --- .../tasks/inspector_install.yml | 37 ++++++++----------- .../templates/ironic-inspector.conf.j2 | 2 +- ...spector-to-use-mysql-17cb03cabb958ff9.yaml | 10 +++++ 3 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 releasenotes/notes/change-inspector-to-use-mysql-17cb03cabb958ff9.yaml diff --git a/playbooks/roles/bifrost-ironic-install/tasks/inspector_install.yml b/playbooks/roles/bifrost-ironic-install/tasks/inspector_install.yml index e243b15b0..b698dd703 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/inspector_install.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/inspector_install.yml @@ -21,26 +21,22 @@ include: pip_install.yml package=python-ironic-inspector-client state=latest -# Note(TheJulia): Until support exists in the inspector database schema, to -# allow for inspector to define its preferred database engine, MySQL cannot -# be used with the default engine in the OpenStack CI. -# See: https://bugs.launchpad.net/ironic-inspector/+bug/1506160 -#- name: "MySQL - Create database" -# mysql_db: -# login_user={{ mysql_username }} -# login_password={{ mysql_password }} -# name=inspector -# state=present -# encoding=utf8 -# register: test_created_inspector_db -#- name: "MySQL - Create user for inspector" -# mysql_user: -# login_user={{ mysql_username }} -# login_password={{ mysql_password }} -# name=inspector -# password={{ ironic_db_password }} -# priv=inspector.*:ALL -# state=present +- name: "MySQL - Create database" + mysql_db: + login_user={{ mysql_username }} + login_password={{ mysql_password }} + name=inspector + state=present + encoding=utf8 + register: test_created_inspector_db +- name: "MySQL - Create user for inspector" + mysql_user: + login_user={{ mysql_username }} + login_password={{ mysql_password }} + name=inspector + password={{ ironic_db_password }} + priv=inspector.*:ALL + state=present - name: "Inspector - Ensure /etc/ironic-inspector/ exists" file: dest=/etc/ironic-inspector @@ -72,7 +68,6 @@ - name: "Upgrade inspector DB Schema" shell: ironic-inspector-dbsync --config-file /etc/ironic-inspector/inspector.conf upgrade become: true - become_user: ironic environment: "{{ bifrost_venv_env if enable_venv else '{}' }}" - name: "Inspector - Get ironic-inspector install location" shell: echo $(dirname $(which ironic-inspector)) diff --git a/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 b/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 index fb233d49d..e8f6aee58 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 @@ -8,7 +8,7 @@ auth_strategy = {{ inspector_auth }} debug = {{ inspector_debug | bool }} [database] -connection=sqlite:///{{ inspector_data_dir }}/inspector.sqlite +connection=mysql+pymysql://inspector:{{ ironic_db_password }}@localhost/inspector?charset=utf8 [firewall] manage_firewall = {{ inspector_manage_firewall | bool }} diff --git a/releasenotes/notes/change-inspector-to-use-mysql-17cb03cabb958ff9.yaml b/releasenotes/notes/change-inspector-to-use-mysql-17cb03cabb958ff9.yaml new file mode 100644 index 000000000..1b60d9077 --- /dev/null +++ b/releasenotes/notes/change-inspector-to-use-mysql-17cb03cabb958ff9.yaml @@ -0,0 +1,10 @@ +--- +upgrade: + - Ironic inspector has been switched to using MySQL as + its back-end database. This was to correct a bug that + functionally broke inspection. +fixes: + - A bug in file ownership resulted in the ironic-inspector + functionality not working as expected, and the test being + unable to be re-executed without manual clean-up. This has + been corrected by moving the database use to MySQL.