Re: [Puppet Users] facter fails to detect network interfaces with long names
On Tue, Sep 20, 2011 at 06:50:25PM +0100, Ken Barber wrote: > I think this gives a little weight to this ticket for Facter then: > > http://projects.puppetlabs.com/issues/1346 > > Although - I don't see a 9 char limitation on Debian Wheezy. Not sure > where that patch came from though. I wonder how many other distros > suffer from this. It seems that they (and RHEL/Fedora) patched this long ago. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=405521 > > Of slightly related interest - I do see a 15 character limit when > using 'brctl addbr somelongnamefoo' to create a named interface - and > that seems to exist for both ifconfig and ip addr when reading the > interfaces. So I'm guessing 15 chars is the kernel limit or perhaps > brctl limit :-). Luckily all my interface names under 15 chars length. > > ken. > > On Tue, Sep 20, 2011 at 6:31 PM, Alex L. Demidov > wrote: > > On Tue, Sep 20, 2011 at 06:24:40PM +0100, Ken Barber wrote: > >> Hi Alex, > >> > >> What happens when you run 'ip addr list' instead? > > > > It shows interface names properly and not truncated. > > > >> > >> ken. > >> > >> On Tue, Sep 20, 2011 at 6:20 PM, Alex L. Demidov > >> wrote: > >> > I have Gentoo host where `ifconfig -a` prints long interface names > >> > truncated to 9 chars (there is closed bug report [1]). > >> > > >> > Unfortunately, `facter` uses `ifconfig -a` output to get list of > >> > interface names and because of truncation it generates `interfaces` > >> > fact with incorrect interface names. Also it fails to retrieve > >> > individual interface information with following message for > >> > each interface with name "myinterface": > >> > > >> > Device "myinterfa" does not exist. > >> > myinterfa: error fetching interface information: Device not found > >> > > >> > [1]: https://bugs.gentoo.org/show_bug.cgi?id=179920 > > > > -- > > Alex L. Demidov (ALD9-RIPE). > > http://alexeydemidov.com/ > > Freelance Consulting. > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Puppet Users" group. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscr...@googlegroups.com. > > For more options, visit this group at > > http://groups.google.com/group/puppet-users?hl=en. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. -- Alex L. Demidov (ALD9-RIPE). http://alexeydemidov.com/ Freelance Consulting. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] facter fails to detect network interfaces with long names
On Tue, Sep 20, 2011 at 06:24:40PM +0100, Ken Barber wrote: > Hi Alex, > > What happens when you run 'ip addr list' instead? It shows interface names properly and not truncated. > > ken. > > On Tue, Sep 20, 2011 at 6:20 PM, Alex L. Demidov > wrote: > > I have Gentoo host where `ifconfig -a` prints long interface names > > truncated to 9 chars (there is closed bug report [1]). > > > > Unfortunately, `facter` uses `ifconfig -a` output to get list of > > interface names and because of truncation it generates `interfaces` > > fact with incorrect interface names. Also it fails to retrieve > > individual interface information with following message for > > each interface with name "myinterface": > > > > Device "myinterfa" does not exist. > > myinterfa: error fetching interface information: Device not found > > > > [1]: https://bugs.gentoo.org/show_bug.cgi?id=179920 -- Alex L. Demidov (ALD9-RIPE). http://alexeydemidov.com/ Freelance Consulting. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] facter fails to detect network interfaces with long names
I have Gentoo host where `ifconfig -a` prints long interface names truncated to 9 chars (there is closed bug report [1]). Unfortunately, `facter` uses `ifconfig -a` output to get list of interface names and because of truncation it generates `interfaces` fact with incorrect interface names. Also it fails to retrieve individual interface information with following message for each interface with name "myinterface": Device "myinterfa" does not exist. myinterfa: error fetching interface information: Device not found [1]: https://bugs.gentoo.org/show_bug.cgi?id=179920 -- Alex L. Demidov (ALD9-RIPE). http://alexeydemidov.com/ Freelance Consulting. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] using host resource with hiera data source
On Mon, Aug 15, 2011 at 10:47:05AM -0700, Nan Liu wrote: > On Sun, Aug 14, 2011 at 10:18 AM, Alex L. Demidov > wrote: > > I'm trying to implement /etc/hosts handling using hiera as data > > source, but my current implementation requires data duplication > > because I could pass only array of strings as $name to host resource. > > Is there any way to avoid such data duplication? Or maybe it is > > possible to use templates but keep ability to have local modifications > > to /etc/hosts file? > > > > class hosts ($hosts = hiera("hosts"), $hostsdefs = > > hiera("hostsdefs")) { > > > > define hostentry( ) { > > host{ $name: ip => $hostsdefs[$name][ipaddress], > > host_aliases => $hostsdefs[$name][host_aliases] } > > } > > > > hostentry{ $hosts: } > > } > > > > common.yaml > > > > hosts: > > - host1.example.com > > - host2.example.com > > hostsdefs: > > host1.example.com: > > ipaddress: 10.0.0.1 > > host_aliases: host1 > > host2.example.com: > > ipaddress: 10.0.0.2 > > host_aliases: host2 > > > > Write a puppet function that returns hash key as an array and you can > avoid this data duplication. Thanks for suggestion. While looking for documentation about how to create custom function I've spotted that there is already exists `create_resources` function and using this function I was able to replace my code above with following: class hosts ($hosts = hiera_hash("hosts")) { create_resources( 'host', $hosts ) } # using hiera_hash allows merging data from different yaml files but # requires hiera 0.2.1 common.yaml hosts: host1.example.com: ip: 10.0.0.1 host_aliases: host1 host2.example.com: ip: 10.0.0.2 host_aliases: host2 There is only one drawback with this solution - it is impossible to have multiple lines in /etc/hosts with same hostname like this: 127.0.0.1 localhost ::1 localhost -- Alex L. Demidov (ALD9-RIPE). http://alexeydemidov.com/ Freelance Consulting. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] using host resource with hiera data source
I'm trying to implement /etc/hosts handling using hiera as data source, but my current implementation requires data duplication because I could pass only array of strings as $name to host resource. Is there any way to avoid such data duplication? Or maybe it is possible to use templates but keep ability to have local modifications to /etc/hosts file? class hosts ($hosts = hiera("hosts"), $hostsdefs = hiera("hostsdefs")) { define hostentry( ) { host{ $name: ip => $hostsdefs[$name][ipaddress], host_aliases => $hostsdefs[$name][host_aliases] } } hostentry{ $hosts: } } common.yaml hosts: - host1.example.com - host2.example.com hostsdefs: host1.example.com: ipaddress: 10.0.0.1 host_aliases: host1 host2.example.com: ipaddress: 10.0.0.2 host_aliases: host2 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.