Plan creation fails due to duplicate name error

Bug #1620747 reported by Steven Hardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Julie Pichon

Bug Description

Duplicate entry for Environment: ['name']] error happens when trying to create a plan via the CLI:

2016-09-06 17:29:30.762 2034 INFO mistral.api.controllers.v2.environment [-] Create environment [env=Environment [id='Unset', name='overcloud', description='Unset', variables='{u'template': u'overcloud.yaml', u'environments': [{u'path': u'overcloud-resource-registry-puppet.yaml'}]}', scope='Unset', created_at='Unset', updated_at='Unset']]
2016-09-06 17:29:30.773 1136 INFO mistral.engine.rpc_backend.rpc [-] Received RPC request 'on_action_complete'[rpc_ctx=MistralContext {u'project_name': u'admin', u'user_id': u'4121cb1a51084d888f5f476c8d00e520', u'roles': [u'admin'], u'auth_uri': u'http://192.0.2.1:5000/v3', u'auth_cacert': None, u'auth_token': u'c31ee7510b0f4b7cbf627dafce85b2cb', u'is_trust_scoped': False, u'service_catalog': u'[{"endpoints": [{"adminURL": "http://192.0.2.1:5050", "region": "regionOne", "internalURL": "http://192.0.2.1:5050", "publicURL": "http://192.0.2.1:5050"}], "type": "baremetal-introspection", "name": "ironic-inspector"}, {"endpoints": [{"adminURL": "http://192.0.2.1:8080", "region": "regionOne", "internalURL": "http://192.0.2.1:8080/v1/AUTH_36c25109478c4b5a9a159f45bb5edf00", "publicURL": "http://192.0.2.1:8080/v1/AUTH_36c25109478c4b5a9a159f45bb5edf00"}], "type": "object-store", "name": "swift"}, {"endpoints": [{"adminURL": "http://192.0.2.1:9292", "region": "regionOne", "internalURL": "http://192.0.2.1:9292", "publicURL": "http://192.0.2.1:9292"}], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "ws://192.0.2.1:9000/", "region": "regionOne", "internalURL": "ws://192.0.2.1:9000/", "publicURL": "ws://192.0.2.1:9000/"}], "type": "messaging-websocket", "name": "zaqar-websocket"}, {"endpoints": [{"adminURL": "http://192.0.2.1:8774/v2.1", "region": "regionOne", "internalURL": "http://192.0.2.1:8774/v2.1", "publicURL": "http://192.0.2.1:8774/v2.1"}], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://192.0.2.1:6385", "region": "regionOne", "internalURL": "http://192.0.2.1:6385", "publicURL": "http://192.0.2.1:6385"}], "type": "baremetal", "name": "ironic"}, {"endpoints": [{"adminURL": "http://192.0.2.1:8888", "region": "regionOne", "internalURL": "http://192.0.2.1:8888", "publicURL": "http://192.0.2.1:8888"}], "type": "messaging", "name": "zaqar"}, {"endpoints": [{"adminURL": "http://192.0.2.1:8004/v1/36c25109478c4b5a9a159f45bb5edf00", "region": "regionOne", "internalURL": "http://192.0.2.1:8004/v1/36c25109478c4b5a9a159f45bb5edf00", "publicURL": "http://192.0.2.1:8004/v1/36c25109478c4b5a9a159f45bb5edf00"}], "type": "orchestration", "name": "heat"}, {"endpoints": [{"adminURL": "http://192.0.2.1:8989/v2", "region": "regionOne", "internalURL": "http://192.0.2.1:8989/v2", "publicURL": "http://192.0.2.1:8989/v2"}], "type": "workflowv2", "name": "mistral"}, {"endpoints": [{"adminURL": "http://192.0.2.1:9696", "region": "regionOne", "internalURL": "http://192.0.2.1:9696", "publicURL": "http://192.0.2.1:9696"}], "type": "network", "name": "neutron"}, {"endpoints": [{"adminURL": "http://192.0.2.1:35357/v2.0", "region": "regionOne", "internalURL": "http://192.0.2.1:5000/v2.0", "publicURL": "http://192.0.2.1:5000/v2.0"}], "type": "identity", "name": "keystone"}]', u'project_id': u'36c25109478c4b5a9a159f45bb5edf00', u'user_name': u'admin'}, action_ex_id=468faff9-23ad-45ed-8f7f-d8118765dd23, result=Result [data=None, error=u"Error occurred creating plan: Duplicate entry for Environment: ['name']", cancel=False]]
2016-09-06 17:29:30.892 1136 INFO workflow_trace [-] Action 'tripleo.create_plan' (468faff9-23ad-45ed-8f7f-d8118765dd23) [RUNNING -> ERROR, error = Error occurred creating plan: Duplicate entry for Environment: ['name']]
2016-09-06 17:29:30.915 1136 INFO workflow_trace [-] Task 'create_plan' (5f701f56-cf3a-4f1a-97af-aaa414cba87e) [RUNNING -> ERROR, msg=Error occurred creating plan: Duplicate entry for Environment: ['name']] (execution_id=95e8e090-cc76-4a08-98ea-90936d29a1c5)

Steven Hardy (shardy)
Changed in tripleo:
status: New → Triaged
milestone: none → newton-rc1
importance: Undecided → High
tags: added: mistral tripleo-common
Revision history for this message
Steven Hardy (shardy) wrote :

Ok, so I think this happens when you delete the plan stored in swift but forget to delete the mistral environment. Something of a corner case perhaps now we have overcloud plan delete, but I think the error needs to be clearer.

Revision history for this message
Julie Pichon (jpichon) wrote :

$ openstack overcloud plan create custom-plan
Exception creating plan: Unable to create plan. The Mistral environment already exists

$ openstack overcloud plan create --templates /usr/share/openstack-tripleo-heat-templates/ custom-plan
Creating Swift container to store the plan
Creating plan from template files in: /usr/share/openstack-tripleo-heat-templates/
Exception creating plan: Error occurred creating plan: Duplicate entry for Environment: ['name']

We probably want to copy over to the create_deployment_plan workflow the verify_container_doesnt_exist and verify_environment_doesnt_exist tasks.

https://github.com/openstack/tripleo-common/blob/master/workbooks/plan_management.yaml#L50

Changed in tripleo:
assignee: nobody → Julie Pichon (jpichon)
Revision history for this message
Julie Pichon (jpichon) wrote :
Changed in tripleo:
status: Triaged → In Progress
Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-common (master)

Reviewed: https://review.openstack.org/367379
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=96e2b0bee50e737ae92df7e04bb348f078efff26
Submitter: Jenkins
Branch: master

commit 96e2b0bee50e737ae92df7e04bb348f078efff26
Author: Julie Pichon <email address hidden>
Date: Thu Sep 8 14:11:16 2016 +0100

    Clearer error when the Mistral env already exists

    When creating a plan with custom templates, if the Mistral environment
    already exists the error message returned is unclear: "Duplicate entry
    for Environment: ['name']". This changes the message to be the same
    than when creating a plan using the default templates: "The Mistral
    environment already exists".

    Also, to avoid copy-pasting the mocks for each new unit test, I
    refactored them so that the mocks are all set up once in one place.

    Change-Id: Ic5855ff553c54a1b9842602812e4f65c49989ae1
    Closes-Bug: #1620747

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.