<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Ruby on Puppeteers Oy</title>
		<link>https://www.puppeteers.net/tags/ruby/</link>
		<description>Recent content in Ruby on Puppeteers Oy</description>
		<generator>Hugo</generator>
		<language>en-US</language>
		
		
		
		
			<lastBuildDate>Sat, 30 Jan 2021 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://www.puppeteers.net/tags/ruby/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Getting the last inactive vboxnet interface with Ruby</title>
				<link>https://www.puppeteers.net/blog/getting-the-last-inactive-vboxnet-interface-with-ruby/</link>
				<pubDate>Sat, 30 Jan 2021 00:00:00 +0000</pubDate>
				<guid>https://www.puppeteers.net/blog/getting-the-last-inactive-vboxnet-interface-with-ruby/</guid>
				<description>&lt;p&gt;This could possibly be the most esoteric blog post I&amp;rsquo;ve ever written, but here it goes. So, for reasons even we have difficulty comprehending (hint: related to PXE booting in a Vagrant/Virtualbox environment) we had to find out which &lt;em&gt;inactive&lt;/em&gt; vboxnet (hostonly) interface had the highest index. We wanted the code to (hopefully) run on all platforms (Linux, MacOS, Windows) so we wanted to write this code in Ruby. So, this was the brutal but working end-result:&lt;/p&gt;</description>
			</item>
			<item>
				<title>Creating custom facts programmatically</title>
				<link>https://www.puppeteers.net/blog/creating-custom-facts-programmatically/</link>
				<pubDate>Fri, 18 Dec 2020 00:00:00 +0000</pubDate>
				<guid>https://www.puppeteers.net/blog/creating-custom-facts-programmatically/</guid>
				<description>&lt;p&gt;Writing static facts is fairly easy even with a low level of Ruby skills. Below is an example of a fact that returns true or false depending on whether the node has a /boot partition:&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34;&gt;&#xA;    &lt;button class=&#34;code-copy&#34; type=&#34;button&#34; hidden aria-label=&#34;Copy code to clipboard&#34;&gt;&#xA;      &lt;span class=&#34;code-copy-label&#34; aria-hidden=&#34;true&#34;&gt;Copy&lt;/span&gt;&#xA;    &lt;/button&gt;&#xA;    &lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Facter.add(:has_bootfs) do&#xA;  setcode do&#xA;    if Facter.value(:mountpoints)[&amp;#39;/boot&amp;#39;].nil?&#xA;      false&#xA;    else&#xA;      true&#xA;    end&#xA;  end&#xA;end&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&lt;p&gt;As you can see above the required information was already inside the &amp;ldquo;mountpoints&amp;rdquo; fact of Facter.&lt;/p&gt;&#xA;&lt;p&gt;Using the fact is easy:&lt;/p&gt;</description>
			</item>
			<item>
				<title>Getting the interface that matches an IP in Puppet</title>
				<link>https://www.puppeteers.net/blog/getting-the-interface-that-matches-an-ip-in-puppet/</link>
				<pubDate>Tue, 14 Jan 2020 00:00:00 +0000</pubDate>
				<guid>https://www.puppeteers.net/blog/getting-the-interface-that-matches-an-ip-in-puppet/</guid>
				<description>&lt;p&gt;I was recently in a situation where I needed to figure out which interface name matched a particular, static IPv4 address. On a single or a handful of nodes this could have been hardcoded in Hiera, for example, but there were dozens of nodes. The way I solved this was by creating a custom fact that uses the IPv4 address and loops through the interfaces list to find the matching interface name:&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
