bartavelle / language-puppet

A library to work with Puppet manifests, test them and eventually replace everything ruby.
BSD 3-Clause "New" or "Revised" License
51 stars 8 forks source link

Ruby 2.x (hruby) #1

Closed pradermecker closed 11 years ago

pradermecker commented 11 years ago

hruby does not allow me to test language-puppet (the beta branch) with ruby 2.x

I don't know what is involved to make hruby 2.0 compliant.

bartavelle commented 11 years ago

This is an issue with hruby.

You might try to get it (cabal unpack hruby), tweak the pathes (just edit what's in cbits1.8 and hruby.cabal), and reinstall it (cabal install -p). Please let me know how it went if you try this !

If you do not wish to try, or it doesn't work, please let me know how you installed ruby 2.0 so that I have a chance to get the paths right next week.

PierreR commented 11 years ago

Well somehow it is not that simple at least with archlinux.

The difficulties is in the shim.h file. ruby.his located at /usr/include/ruby-2.0.0 but if I use this path, I have got an exception because inside ruby.h there is another include to ruby/config.h. It fails because the config.h file is actually located at /usr/include/ruby-2.0.0/x86_64-linux/ruby/config.h

I guess I can make a symlink to make it work but it does not feel right given there has been a bug about this that had been rejected a while a ago: http://bugs.ruby-lang.org/issues/show/2317

There must be a less hackish way to do this ?

bartavelle commented 11 years ago

It seems that the "right way" is to run some ruby program (mkmf.rb) that should know where the files are. It doesn't seem to work for me however :

» ruby /usr/lib/ruby/1.8/mkmf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h

You might be able to add the correct path in the cabal file using

cc-options: -I/usr/include/ruby-2.0.0/x86_64-linux/ruby

I will try to install arch linux to check this.

bartavelle commented 11 years ago

Ok Ruby 2 is not compatible without modifications in hruby ... this will unfortunately be fixed only next week ...

pradermecker commented 11 years ago

next week is fine by me. Thanks !

bartavelle commented 11 years ago

I changed a ton of things during lunch. Would you mind giving it a try ?

For ruby 2, you need to compile hruby like this :

cabal install -p -f ruby20

PierreR commented 11 years ago

It builds !

How can I test it further ? I have only one exec called ReadArgsEx. Should I use an ghci session ?

I had wondered also what the module provides beyond puppet parser validate on the validation front (I know it can give valuable information about the config graph).

Thanks for your help.

bartavelle commented 11 years ago

Well it can do tons of things, which I'd be happy tell you about. The big use cases (at least, that's what I do daily) are :

You can find me on #haskell if you need more responsive help !

bartavelle commented 11 years ago

BTW, I don't think the ReadArgsEx is something from these packages, you should have a "puppetresources" executable once you build language-puppet.

PierreR commented 11 years ago

That's weird. I am building this with cabal-dev. There is no language-puppet in cabal-dev/bin

bartavelle commented 11 years ago

Weird ... are you sure you did checkout de "beta" branch before building ?

PierreR commented 11 years ago

Oups it slipped my mind ;-)

I will have to figure out how to test this exactly as my catalogs rely on hiera and custom fact to pull up the correct config for a node (maybe a dedicated wm where I can safely tweak the local facts). I will give it a go and let you know.

Thanks for your help

bartavelle commented 11 years ago

I unfortunately do not support Hiera yet, and custom facts are "hard" to add (you have to add stuff in Facter.hs).

You can collect those facts through the PuppetDB connection though.

As for Hiera, I do not use it, so I have no idea how this really works. For a while the documentation was ... sketchy. This will come however.