scribble

Tibi's blog

About LinkedIn GitHub

23 Jul 2014
Status report - started to work on Puppet

It’s time to give my readers a follow up, how my project is going. In my last post I wrote about the pull requests I sent to Salt. They got merged, but the review process showed up some mistakes. My contribution was moved to salt-contrib, where I could make some changes on them. I’ve got some extra style fixes but they broke my unit tests :( Now, my code is ready again to merge into salt’s master branch.

In the meantime I began to take care of the Puppet part. Unfortunately, it’s harder than I thought it will be. If I want to handle it, I have to learn not just Ruby but Puppet’s own DSL and also that weird spec testing. I like challenges, so I began to get over some examples and documentation.

The struggling began

The first problems appeared when I tried to run Puppet from source. The documented installation process didn’t work, I had to install some gems manually based on the exceptions I got. There were some problems with rake as well. After a while I was able to generate a boilerplate module, but the generated spec test failed… I also found a bug in puppet lint. I had some misconception about including a class and declaring it with parameters. Maybe it was because the boilerplate spec test gave me strange include errors. I began to push my codes into GitHub [1] and set up Travis to do some auto tests. In my happiness I added more and more versions to test with Travis. Then I realized, there are incompatibilities between Puppet versions… Looking through the documentation I also found some strange things, my favorite is here [2]. The status of this bug report is accepted, because there is no activity on it.

When I saw the light

It turned out, that there is some nasty problem with my development environment. I was curious and tested my code on a Trusty with Puppet installed by apt. My always failing spec unittests got the power and succeeded. In a moment I cloned my Puppet test VM and set up as my new development environment on it. I don’t have a fancy Atom editor on it, but Vim is my best friend without a GUI (maybe with a GUI, too). I added some extra entries to the hosts file (and set chattr +i on it, to not be overridden at reboot), installed git and now it’s ready to rock :)

Maybe I was a little critical with Puppet. Its learning curve is definitely steeper than Salt’s and IMHO the documentation is also less brilliant. But the declarative language seems to be a good idea, just that old school pull mechanism wouldn’t be.

Here are some examples I think it will work when I’m finished:

syslog_ng::source {"s_gsoc":
  type => file,
  options => {
    file => /var/log/apache.log,
    follow_freq => 1,
    flags => [no_parse, validate_utf8]
  }
}

syslog_ng::destination {"d_gsoc":
  type => file,
  options => {
    file => /var/log/apache_out.log
  }
}

syslog_ng::log {"some name":
  sources => s_gsoc,
  destinations => d_gsoc
}

Tomorrow I will write a letter to the Puppet developers how I would like to implement my ideas. I hope they will help me :)

[1]

[2]


Till next time,
Tibor Benke at 00:00

scribble

About LinkedIn GitHub