The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #18399

Empty resource collectors can break long relationship chains

Added by Martin Collins over 3 years ago. Updated over 2 years ago.

Status:UnreviewedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Affected Puppet version: Branch:
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket is now tracked at: https://tickets.puppetlabs.com/browse/PUP-1410


Description

Hi,

When using chained resources, with a collection within the string, if the collection is empty, the chain is broken and the resources either side do not depend on each other.

Example:

test/manifests/init.pp

class test {
  $cr = ["1", "2"]

  exec{"pre":
    command => "/bin/true"
  }

  exec{"post":
    command => "/bin/true"
  }

  test::test{$cr: }

  Exec["pre"] 
    -> Exec<| tag == 'inter' |> 
      -> Exec["post"]
}

test/manifests/test.pp

define test::test{
  exec{"echo $name":
    command => "/bin/echo $name",
    tag     => "inter"
  }
}

Run as is:

!non_empty_collection.jpg!

If we comment out:

test::test{$cr: }

So it is empty, we get “empty_collection.jpg”, this:

!empty_collection.jpg!

To get the desired result and what I would have expected as the default, I have to manually add another relationship between “pre” and “post” to cater for the empty collection.

Exec["pre"] 
  -> Exec<| tag == 'inter' |> 
    -> Exec["post"]

Exec["pre"]
  -> Exec["post"]

Resulting in:

!workaround.jpg!

Is this the intended behaviour? I would expect the workaround relationship to be implicit (Pre –> a collection that happens to be empty –> post), as I do not know how many tags of “inter” will be created (in my real use, this is pulled from hiera)

Thanks, Martin

non_empty_collection.jpg (24.5 KB) Martin Collins, 01/07/2013 09:35 am

empty_collection.jpg (8.69 KB) Martin Collins, 01/07/2013 09:35 am

workaround.jpg (11.4 KB) Martin Collins, 01/07/2013 09:35 am

History

#1 Updated by Adrien Thebo over 2 years ago

  • Project changed from Puppet Documentation to Puppet

#2 Updated by Nick Fagerlund over 2 years ago

Yo, that is completely wacky and is almost definitely not intended behavior. Thanks for spotting it. We’ve moved it to a puppet issue, and I’ve made a note in the docs on chaining arrows about it.

#3 Updated by Nick Fagerlund over 2 years ago

  • Subject changed from Chained resources with empty collections to Empty resource collectors can break long relationship chains

#4 Updated by Martin Collins over 2 years ago

Redmine Issue #18399 has been migrated to JIRA:

https://tickets.puppetlabs.com/browse/PUP-1410

Also available in: Atom PDF