Duplicated endpoints when updating more than one url

Bug #1234480 reported by Mathieu Gagné
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
puppet-keystone
Fix Released
Medium
Mathieu Gagné
Grizzly
Fix Committed
Medium
Mathieu Gagné

Bug Description

When updating more than one url (public, internal, admin) in a single puppet run, endpoints end up being created multiple times.

Mathieu Gagné (mgagne)
summary: - Duplicate endpoints when updating more than one url
+ Duplicated endpoints when updating more than one url
Revision history for this message
Mathieu Gagné (mgagne) wrote :

To reproduce, you need to run puppet twice.

First, configure a service endpoint:

  keystone_endpoint { 'RegionOne/cinder':
    ensure => present,
    public_url => 'http://example.org:8776/v1/%(tenant_id)s',
    admin_url => 'http://example.org:8776/v1/%(tenant_id)s',
    internal_url => 'http://example.org:8776/v1/%(tenant_id)s',
  }

Next, update 2 or more urls of the service endpoint:

  keystone_endpoint { 'RegionOne/cinder':
    ensure => present,
    public_url => 'http://test.com:8776/v1/%(tenant_id)s',
    admin_url => 'http://test.com:8776/v1/%(tenant_id)s',
    internal_url => 'http://test.com:8776/v1/%(tenant_id)s',
  }

You will end up with 3 endpoints which you can confirm by running keystone endpoint-list.

This is because updating an URL results in the endpoint being completely deleted and recreated. There is no update endpoint available.

When 2 or more urls are updated, the first url update deletes the old endpoint and recreate it with the updated values. The 2nd and 3rd url updates fail to delete the old endpoint because the service_id is cached. A 2nd and 3rd endpoint end up being created.

Revision history for this message
Dan Bode (bodepd) wrote :

The best solution is to get update_endpoint supported upstream.

The easiest way to solve this in puppet is to introduce a variable that tells us if it has already been recreated:

  def public_url=(value)
    destroy
    unless @already_recreated
       endpoint_hash[resource[:name]][:public_url] = value
       @already_recreated = true
     end
     create
  end

Revision history for this message
Dan Bode (bodepd) wrote :

let me try that one more time:

  def public_url=(value)
    destroy
    endpoint_hash[resource[:name]][:public_url] = value
    unless @already_recreated
       create
       @already_recreated = true
     end
  end

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-keystone (master)

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

Changed in puppet-keystone:
assignee: nobody → Mathieu Gagné (mgagne)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to puppet-keystone (master)

Reviewed: https://review.openstack.org/52675
Committed: http://github.com/stackforge/puppet-keystone/commit/ee7956e99a2979929fc09446929b60ca246821f6
Submitter: Jenkins
Branch: master

commit ee7956e99a2979929fc09446929b60ca246821f6
Author: Mathieu Gagné <email address hidden>
Date: Fri Oct 18 13:08:22 2013 -0400

    Fix duplicated keystone endpoints

    Duplicated endpoints were created when updating 2 or more URLs.

    Refactor keystone_endpoint to use prefetch and flush paradigms.

    Closes-bug: #1234480
    Change-Id: I91340995297c6afaf9c8841bc7ae71a8e25b1eb7

Changed in puppet-keystone:
status: In Progress → Fix Committed
Mathieu Gagné (mgagne)
Changed in puppet-keystone:
milestone: none → 3.0.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-keystone (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/53400

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to puppet-keystone (stable/grizzly)

Reviewed: https://review.openstack.org/53400
Committed: http://github.com/stackforge/puppet-keystone/commit/74bfe20e1542141e33d61a87f30b8414e25859bb
Submitter: Jenkins
Branch: stable/grizzly

commit 74bfe20e1542141e33d61a87f30b8414e25859bb
Author: Mathieu Gagné <email address hidden>
Date: Fri Oct 18 13:08:22 2013 -0400

    Fix duplicated keystone endpoints

    Duplicated endpoints were created when updating 2 or more URLs.

    Refactor keystone_endpoint to use prefetch and flush paradigms.

    Closes-bug: #1234480
    Change-Id: I91340995297c6afaf9c8841bc7ae71a8e25b1eb7
    (cherry picked from commit ee7956e99a2979929fc09446929b60ca246821f6)

Mathieu Gagné (mgagne)
Changed in puppet-keystone:
importance: Undecided → Medium
Mathieu Gagné (mgagne)
Changed in puppet-keystone:
milestone: 3.0.0 → 3.0.0-rc1
status: Fix Committed → Fix Released
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.