migration: Remove crudini when migrating tunnels
It turned out there doesn't need to be crudini tool present on the node running the command. This patch fetches the Neutron conf file instead and performs an ini lookup over it in order to get the DB connection string. Change-Id: Iaf79b8512a920e9f667bd6881d50e8852595fa71 Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
This commit is contained in:
parent
824ff38456
commit
94bea77fd7
@ -1,2 +1,3 @@
|
||||
---
|
||||
neutron_conf_path: /var/lib/config-data/puppet-generated/neutron/etc/neutron/neutron.conf
|
||||
neutron_conf_tempfile: /tmp/neutron.conf
|
||||
|
@ -1,8 +1,15 @@
|
||||
---
|
||||
- name: Get DB connection string
|
||||
command: crudini --get {{ neutron_conf_path }} database connection
|
||||
- name: Fetch neutron configuration
|
||||
fetch:
|
||||
src: "{{ neutron_conf_path }}"
|
||||
dest: "{{ neutron_conf_tempfile }}"
|
||||
flat: yes
|
||||
when: ovn_central is defined
|
||||
|
||||
- name: Get DB connection string
|
||||
set_fact:
|
||||
db_connection_string: "{{ lookup('ini', 'connection section=database file={{ neutron_conf_tempfile }}') }}"
|
||||
when: ovn_central is defined
|
||||
register: mysql_url
|
||||
|
||||
# The shell below is not readable well. The code spawns a sqlalchemy engine
|
||||
# and connects to the Neutron database to run following SQL command:
|
||||
@ -16,5 +23,5 @@
|
||||
# conn.execute("SQL COMMAND")
|
||||
#
|
||||
- name: Change vxlan networks to Geneve
|
||||
shell: podman exec -it neutron_api python3 -c $'from sqlalchemy import create_engine\nengine = create_engine("{{ mysql_url.stdout }}")\nwith engine.connect() as conn:\n\tconn.execute("update networksegments set networksegments.network_type=\'geneve\' where networksegments.network_type=\'vxlan\';")'
|
||||
shell: podman exec -it neutron_api python3 -c $'from sqlalchemy import create_engine\nengine = create_engine("{{ db_connection_string }}")\nwith engine.connect() as conn:\n\tconn.execute("update networksegments set networksegments.network_type=\'geneve\' where networksegments.network_type=\'vxlan\';")'
|
||||
when: ovn_central is defined
|
||||
|
Loading…
Reference in New Issue
Block a user