Duplicated endpoints when updating more than one url

Bug #1234480 reported by Mathieu Gagné on 2013-10-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
puppet-keystone
Medium
Mathieu Gagné
Grizzly
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) on 2013-10-03
summary: - Duplicate endpoints when updating more than one url
+ Duplicated endpoints when updating more than one url
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.

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

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

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

Changed in puppet-keystone:
assignee: nobody → Mathieu Gagné (mgagne)
status: New → In Progress

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) on 2013-10-23
Changed in puppet-keystone:
milestone: none → 3.0.0

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) on 2013-12-26
Changed in puppet-keystone:
importance: Undecided → Medium
Mathieu Gagné (mgagne) on 2014-01-16
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  Edit
Everyone can see this information.

Other bug subscribers