Read tag name instead of ID

Current version of db load_metadefs looks for tag id instead
of tag name. In result user needs to provide additional
unnecessary tag ID in .json file and also it may lead to
conflicts in DB and unhandled exceptions. This change fixes
this issue.

Backport change:-
    Has been cherry picked from
    commit 2b556b2f8d

Change-Id: Ie0192f87dce120221d09dba49d2eb33094464cef
Closes-Bug: 1445026
This commit is contained in:
Pawel Koniszewski 2015-04-16 03:21:20 -04:00 committed by Nikhil Komawar
parent e3bed85d51
commit 0f255ddbf6

View File

@ -327,7 +327,7 @@ def _populate_metadata(meta, metadata_path=None, merge=False,
'name': tag.get('name'),
'namespace_id': namespace_id,
}
tag_id = _get_resource_id(tags_table, namespace_id, tag['id'])
tag_id = _get_resource_id(tags_table, namespace_id, tag['name'])
if not tag_id:
values.update({'created_at': timeutils.utcnow()})
_insert_data_to_db(tags_table, values)