/usr/bin/mistral-db-manage sometimes failed with tables and column are already there

Bug #1478448 reported by Limor Stotland
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Nikolay Makhotkin
Liberty
Fix Released
High
Nikolay Makhotkin

Bug Description

sometimes when running /usr/bin/python /usr/bin/mistral-db-manage --config-file=/etc/mistral/mistral.conf populate more than once the command fail because column and table already there.
for example:
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: Traceback (most recent call last):
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: File "/usr/bin/mistral-db-manage", line 10, in <module>
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: sys.exit(main())
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: File "/usr/lib/python2.7/site-packages/mistral/db/sqlalchemy/migration/cli.py", line 129, in main
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: CONF.command.func(config, CONF.command.name)
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: File "/usr/lib/python2.7/site-packages/mistral/db/sqlalchemy/migration/cli.py", line 71, in do_populate
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: workflows.sync_db()
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: File "/usr/lib/python2.7/site-packages/mistral/services/workflows.py", line 32, in sync_db
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: register_standard_workflows()
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: File "/usr/lib/python2.7/site-packages/mistral/services/workflows.py", line 28, in register_standard_workflows
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: create_workflows(workflow_definition, scope='public')
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: File "/usr/lib/python2.7/site-packages/mistral/services/workflows.py", line 42, in create_workflows
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: db_wfs.append(_create_workflow(wf_spec, definition, scope))
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: File "/usr/lib/python2.7/site-packages/mistral/services/workflows.py", line 77, in _create_workflow
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: _get_workflow_values(wf_spec, definition, scope)
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: File "/usr/lib/python2.7/site-packages/mistral/db/v2/api.py", line 120, in create_workflow_definition
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: return IMPL.create_workflow_definition(values)
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: File "/usr/lib/python2.7/site-packages/mistral/db/sqlalchemy/base.py", line 91, in _within_session
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: result = func(*args, **kw)
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: File "/usr/lib/python2.7/site-packages/mistral/db/v2/sqlalchemy/api.py", line 247, in create_workflow_definition
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: "Duplicate entry for WorkflowDefinition: %s" % e.columns
Notice: /Stage[main]/Mistral::Services/Exec[mistral-dbsync]/returns: mistral.exceptions.DBDuplicateEntry: Duplicate entry for WorkflowDefinition: ['name']

Revision history for this message
Nikolay Makhotkin (nmakhotkin) wrote :

I've just checked, it is really a bug.

So, need to mark all preloaded workflows as 'system' or 'read-only' (like we've done with actions), delete them and load again.

Changed in mistral:
status: New → Triaged
importance: Undecided → High
milestone: none → liberty-3
Changed in mistral:
milestone: liberty-3 → none
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (master)

Fix proposed to branch: master
Review: https://review.openstack.org/223536

Changed in mistral:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/223536
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=1c702e2555c487db25a6a26c34707368071e14ba
Submitter: Jenkins
Branch: master

commit 1c702e2555c487db25a6a26c34707368071e14ba
Author: Nikolay Mahotkin <email address hidden>
Date: Tue Sep 15 14:25:58 2015 +0300

    Adding 'is_system' to definition model

     * Fixed work of mistral-db-manage populate
     * Fixed modifying of standard workflows

    Closes-Bug: #1478448
    Closes-Bug: #1396121

    Change-Id: Ia2825408ee43a6dfc80e33fa9614e11f3ff6d97b

Changed in mistral:
status: In Progress → Fix Committed
Changed in mistral:
milestone: 1.0.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.