openstack provider only caches instance on first execution

Bug #1421573 reported by Javier Peña
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
puppet-keystone
Fix Released
Undecided
Javier Peña
Juno
Fix Released
Undecided
Unassigned

Bug Description

The instance method for several types (e.g. keystone_tenant) using the openstack provider only caches the instance on its first execution, which does not account for potential changes to the tenant. The following snippet should create a tenant and a Neutron network associated to that tenant:

keystone_tenant { 'test1':
  ensure => present,
  enabled => true,
  description => 'default tenant',
}

neutron_network { 'test1-network':
  ensure => present,
  router_external => true,
  tenant_name => 'test1',
}

With the old keystone provider, test1-network was correctly associated to the tenant, while it is not with the new. Looking at the way puppet-neutron gets the tenant-id from the tenant name:

  def self.get_tenant_id(catalog, name)
    instance_type = 'keystone_tenant'
    instance = catalog.resource("#{instance_type.capitalize!}[#{name}]")
    if ! instance
      instance = Puppet::Type.type(instance_type).instances.find do |i|
        i.provider.name == name
      end
    end
    if instance
      return instance.provider.id
    else
      fail("Unable to find #{instance_type} for name #{name}")
    end
  end

Since Keystone_tenant[test1] is already in the catalog, it is simply getting the id. This is broken by the new implementation. It could also be fixed directly in the puppet-neutron code, but there is a chance that other modules rely on this.

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/156503

Changed in puppet-keystone:
assignee: nobody → Colleen Murphy (krinkle)
status: New → In Progress
Changed in puppet-keystone:
assignee: Colleen Murphy (krinkle) → Javier Peña (jpena-c)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to puppet-keystone (master)

Reviewed: https://review.openstack.org/156503
Committed: https://git.openstack.org/cgit/stackforge/puppet-keystone/commit/?id=9a32c026ae28b56ac29edc658832fe4691ebe44e
Submitter: Jenkins
Branch: master

commit 9a32c026ae28b56ac29edc658832fe4691ebe44e
Author: Colleen Murphy <email address hidden>
Date: Tue Feb 17 00:17:40 2015 -0800

    Create resource cache upon creation

    Currently, the keystone providers ignore the output of the create
    command even though it provides much-needed information. This is a
    problem because if during the course of the puppet run that
    information is needed again, it must make another API request for it.
    This is especially problematic with the neutron providers, which
    instead of looking up the information via the API, look it up in the
    catalog. Since a keystone resource does not specify its ID upon
    creation, it reports it as nil, causing the neutron providers to
    silently fail when they need the ID of a keystone resource.

    This patch corrects the problem by saving the output from the create
    command in the @instance variable so that it is known to that
    resource and can be retrieved by other resources.

    Alternative to https://review.openstack.org/#/c/154812/

    Change-Id: I2090f5f4a94a6ae21bf71ac0f1b33caaa602e0bc
    Closes-bug: 1421573

Changed in puppet-keystone:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-keystone (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/160780

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

Reviewed: https://review.openstack.org/160780
Committed: https://git.openstack.org/cgit/stackforge/puppet-keystone/commit/?id=0c1a375600a48c1ec3097bf3f56b3c04e291b578
Submitter: Jenkins
Branch: stable/juno

commit 0c1a375600a48c1ec3097bf3f56b3c04e291b578
Author: Colleen Murphy <email address hidden>
Date: Tue Feb 17 00:17:40 2015 -0800

    Create resource cache upon creation

    Currently, the keystone providers ignore the output of the create
    command even though it provides much-needed information. This is a
    problem because if during the course of the puppet run that
    information is needed again, it must make another API request for it.
    This is especially problematic with the neutron providers, which
    instead of looking up the information via the API, look it up in the
    catalog. Since a keystone resource does not specify its ID upon
    creation, it reports it as nil, causing the neutron providers to
    silently fail when they need the ID of a keystone resource.

    This patch corrects the problem by saving the output from the create
    command in the @instance variable so that it is known to that
    resource and can be retrieved by other resources.

    Alternative to https://review.openstack.org/#/c/154812/

    Change-Id: I2090f5f4a94a6ae21bf71ac0f1b33caaa602e0bc
    Closes-bug: 1421573
    (cherry picked from commit 9a32c026ae28b56ac29edc658832fe4691ebe44e)

tags: added: in-stable-juno
Mathieu Gagné (mgagne)
Changed in puppet-keystone:
milestone: none → 6.0.0
Matt Fischer (mfisch)
Changed in puppet-keystone:
status: Fix Committed → Fix Released
Mathieu Gagné (mgagne)
Changed in puppet-keystone:
status: Fix Released → Fix Committed
Mathieu Gagné (mgagne)
Changed in puppet-keystone:
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.