HomePhorge

(#5605) Prefetch doesnt work with composite keys
02b311113df8Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#5605) Prefetch doesnt work with composite keys

The uniqueness_key method of a type or resource object should return a
key that can be used to identify this resource. In fact puppet seldomly
uses this method and instead uses resource[:name] as an identifier.

While this is totally fine for resourcetypes with a single
key_attribute (and resource[:name] returning the namevar), it breaks
things as soon as one creates a type with a composite key (prefetching
for example is broken). To ease the process of replacing calls to
resource[:name] to resource.uniqueness_key, the method uniqueness_key now
just returns name_var if there is only one key_attribute (immitating
self[:name]) and only returns an array of all the values of all the
key_attributes if we have more than one key_attribute.

The resourcehash which is passed to providers in their prefetch method
is now build with uniqueness_key as the hashkey. Because of the new
behaviour of uniqueness_key we hopefully wont break existing providers
while allowing new providers for types with composite keys to implement
correct prefetch methods.

Details

Provenance
Stefan Schulte <stefan.schulte@taunusstein.net>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUcc1f2b39a65e: Merge branch '2.6.next' into 2.6.x
Branches
Unknown
Tags
Unknown

Event Timeline

Stefan Schulte <stefan.schulte@taunusstein.net> committed rPU02b311113df8: (#5605) Prefetch doesnt work with composite keys (authored by Stefan Schulte <stefan.schulte@taunusstein.net>).Dec 23 2010, 9:49 PM