diff --git a/ironic_inspector/node_cache.py b/ironic_inspector/node_cache.py index 2b1737597..02549c69f 100644 --- a/ironic_inspector/node_cache.py +++ b/ironic_inspector/node_cache.py @@ -497,7 +497,7 @@ def find_node(**attributes): % (name, value)) value_list = [] for v in value: - value_list.append('name="%s" AND value="%s"' % (name, v)) + value_list.append("name='%s' AND value='%s'" % (name, v)) stmt = ('select distinct uuid from attributes where ' + ' OR '.join(value_list)) rows = (db.model_query(db.Attribute.uuid).from_statement( diff --git a/releasenotes/notes/fix-crash-when-use-postgresql-ac6c708f48f55c83.yaml b/releasenotes/notes/fix-crash-when-use-postgresql-ac6c708f48f55c83.yaml new file mode 100644 index 000000000..4e6d968e4 --- /dev/null +++ b/releasenotes/notes/fix-crash-when-use-postgresql-ac6c708f48f55c83.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Use only single quotes for strings inside SQL statements. Fixes a crash + when PostgreSQL is used as a database backend.