Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Craig Dunn commented on PUP-6712 Re: Arrays in resource chaining Totally agreed. <||> should imply collection, where as Resource implies reference. therefore Foo -> Bar implies referencing and setting relationships, but not collection. That way I can do: Yumrepo -> Package ... and not care if some modules are using virtualized package resources, since they won't get realized with the above syntax. I realise this is off topic from the original ticket, but this would be a really nice side effect Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title R.I.Pienaar commented on PUP-6712 Re: Arrays in resource chaining Yes if we can make it so that syntax does not realise then that would be a massive win I was saying if without them would be a shortcut to the exact same behaviour it would be more confusing. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Craig Dunn commented on PUP-6712 Re: Arrays in resource chaining But Foo -> Bar would presumably be a nice way to set resource dependancies without collecting virtual resources. It's always bothered me that the two are so intertwined. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title R.I.Pienaar commented on PUP-6712 Re: Arrays in resource chaining I find the empty <||> is a nice reminder that this is in fact a find+realise and not a find. Of course the % of users who even know what virtual resources are must be single digit but might become even more surprising. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Craig Dunn commented on PUP-6712 Re: Arrays in resource chaining Out of interest, by definition, if the above syntax would work then could I also replace Yumrepo<||> -> Package <||> With simply; Yumrepo -> Package That would be a really nice side effect, since adding the <||> when there is no filter is tiresome. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Craig Dunn commented on PUP-6712 Re: Arrays in resource chaining Henrik Lindberg That would probably solve 99% of the use cases that I've seen - so my above example would become $fw_resources = [ Firewalld_zone, Firewalld_rich_rule, Firewalld_service, Firewalld_port, Firewalld_direct_chain, Firewalld_direct_rule, Firewalld_direct_passthrough ] Service['firewalld'] -> $fw_resources ~>
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Henrik Lindberg commented on PUP-6712 Re: Arrays in resource chaining That would be fixable though (as opposed to making it possible to get a collector inside an array). It would still not allow filtering - i.e. you could reference individual resources or "all" of that type. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Craig Dunn commented on PUP-6712 Re: Arrays in resource chaining Nope It lets you declare the variable $foo = [ File, Service ] But when you try and use it in a chain $foo -> Notify<||> Error: Could not find resource 'File[]' for relationship on 'Notify[bar]' on node localhost.localdomain Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Henrik Lindberg commented on PUP-6712 Re: Arrays in resource chaining The reference to File would mean all resources of that type (but I am not sure if that works). Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Henrik Lindberg commented on PUP-6712 Re: Arrays in resource chaining True, [ File <|| > ] will not work. Have you tried: [ File ] And it needs to be in an array assigned to a variable. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Craig Dunn commented on PUP-6712 Re: Arrays in resource chaining Henrik Lindberg That might work for individual resource references (eg Foo['bar']) but for using collector syntax chaining this wouldn't work $foo = [ File<||> ] Error: Could not parse for environment production: Invalid use of _expression_. A Virtual Query does not produce a value at /root/foo.pp:1:10 on node localhost.localdomain So your pattern is nice, but it wouldn't help these particular use cases. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group,
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-6712 Arrays in resource chaining Change By: Henrik Lindberg Team: Puppet Developer Support Sprint: PDS Triage There are a number of use cases where lots of different resource types need to require and notify the same things... eg{code}Foo <||> -> Resource_one<||> ~> Bar<||>Foo <||> -> Resource_two<||> ~> Bar<||>Foo <||> -> Resource_three<||> ~> Bar<||>Foo <||> -> Resource_four<||> ~> Bar<||>{code}A couple of real world examples of this are:https://github.com/crayfishx/puppet-firewalld/blob/3.1.4/manifests/init.pp#L163-L169https://github.com/voxpupuli/puppet-splunk/blob/4.0.0/manifests/init.pp#L189-L248The current chaining syntax is quite repetitive, it would make more sense if you could include arrays in resource chaining, so this:{code} Service['firewalld'] -> Firewalld_zone <||> ~> Exec['firewalld::reload'] Service['firewalld'] -> Firewalld_rich_rule <||> ~> Exec['firewalld::reload'] Service['firewalld'] -> Firewalld_service <||> ~> Exec['firewalld::reload'] Service['firewalld'] -> Firewalld_port <||> ~> Exec['firewalld::reload'] Service['firewalld'] -> Firewalld_direct_chain <||> ~> Exec['firewalld::reload'] Service['firewalld'] -> Firewalld_direct_rule <||> ~> Exec['firewalld::reload'] Service['firewalld'] -> Firewalld_direct_passthrough <||> ~> Exec['firewalld::reload']{code}Could be written more cleanly as something like:{code} Service['firewalld'] -> [ Firewalld_zone <||>, Firewalld_rich_rule <||>, Firewalld_service <||>, Firewalld_port <||>, Firewalld_direct_chain <||>, Firewalld_direct_rule <||>, Firewalld_direct_passthrough <||> ] ~> Exec['firewalld::reload']{code}So a chain to an array of references will apply the relationship to all members of the array. Add Comment
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Henrik Lindberg commented on PUP-6712 Re: Arrays in resource chaining The precedence of the collector _expression_ and the fact that it does not produce a value that can be used in the language (and hence not be placed as a data element in an Array) makes the suggested syntax and semantics impossible to achieve. I have not tried, but I think you can assign an array of references to a variable and use that variable in the chain. The array can contain references to resource types, and to individual resources - something like this: $x = [ ResourceA, ResourceB['this_b']] Service['some_service'] -> $x -> Exec['some_exec'] Would something like that work for you? Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at
Jira (PUP-6712) Arrays in resource chaining
Title: Message Title Craig Dunn created an issue Puppet / PUP-6712 Arrays in resource chaining Issue Type: New Feature Assignee: Unassigned Components: Language Created: 2016/09/19 7:05 AM Priority: Normal Reporter: Craig Dunn There are a number of use cases where lots of different resource types need to require and notify the same things... eg Foo <||> -> Resource_one<||> ~> Bar<||> Foo <||> -> Resource_two<||> ~> Bar<||> Foo <||> -> Resource_three<||> ~> Bar<||>