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

Feature #15081

Add support for virtual and exported resources to create_resources

Added by Gary Richards almost 2 years ago. Updated 11 months ago.

Status:ClosedStart date:06/18/2012
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:functions
Target version:3.1.0
Affected Puppet version: Branch:https://github.com/puppetlabs/puppet/pull/1213
Keywords:create_resources

We've Moved!

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

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


Description

Hi,

I use create_resources quite a bit and have found that it would often be useful for the resources that it creates to be either virtual or exported.

In my own limited way I took a copy of create_resources.rb and it seems to be as simple as setting p_resource.exported or p_resource.virtual to true just after p_resource gets set to the new resource, but i’m sure there’s loads that I don’t understand about all this code!

Thanks

History

#1 Updated by James Turnbull over 1 year ago

  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Dan Bode

Dan – no action required but thought your input would be interesting. Any thoughts on the ticket?

#2 Updated by Dan Bode over 1 year ago

I am pretty sure it would be that simple.

I can’t imagine any unexpected consequences.

Seems pretty reasonable to me.

#3 Updated by Erik Dalén over 1 year ago

I’d be happy to get this feature in there. I think just adding @ or @@ to the type name should be a good way of doing it.

#4 Updated by konrad rzentarzewski over 1 year ago

i’m quite suprised it doesn’t work.

<4>root@punch(2)~$ puppet apply /tmp/ttt.pp 
could not create resource of unknown type @xx at /tmp/ttt.pp:5 on node punch.non.3dart.com
<4>root@punch(3)~$ cat /tmp/ttt.pp
define xx ($xox=$title) {
notify { "$title | $xox": }
}
create_resources('@xx',hiera('xx'))
realize(Xx["foo"])
<4>root@punch(4)~$ cat hiera/common/common.yaml 
# defaults
---
xx:
 foo:
  xox: one
 bar:
  xox: two
 barszcz:
  xox: tri

any good reason why i can’t migrate my user database from manifests to hiera?

#5 Updated by konrad rzentarzewski over 1 year ago

the following should fix the problem: http://pastie.org/private/5h0assjo94dwlkxk1fica

please integrate into telly.

#6 Updated by Erik Dalén over 1 year ago

  • Branch set to https://github.com/puppetlabs/puppet/pull/1213

Opened a pull request with a fix for this and tests.

#7 Updated by konrad rzentarzewski over 1 year ago

i’m using it on production (patched 2.7.18) for a week now, with no issues. just letting you know.

#8 Updated by Jeff McCune over 1 year ago

  • Category set to functions
  • Status changed from Needs Decision to Accepted
  • Assignee changed from Dan Bode to Jeff McCune
  • Target version set to 3.x
  • Keywords set to create_resources

I’ve committed to working on this by the c.o.b. Friday, 10/26.

We’re planning to get this into the next minor release of Puppet, which is 3.1.0 at the time of this update.

-Jeff

#9 Updated by Jeff McCune over 1 year ago

  • Status changed from Accepted to Merged - Pending Release
  • Assignee deleted (Jeff McCune)
  • Target version changed from 3.x to 3.1.0

Merged into master

As: 7af8c6e

Documentation update in 7174058

$ git branch —contains 7af8c6e dalen-create_resources-virtexport * master

#10 Updated by Matthaus Owens over 1 year ago

  • Status changed from Merged - Pending Release to Closed

Released in Puppet 3.1.0-rc1

Also available in: Atom PDF