Running "make" via puppet manifest

902 views
Skip to first unread message

Mike Reed

unread,
Aug 1, 2012, 3:56:11 PM8/1/12
to puppet...@googlegroups.com
Hello all,

I've been banging my head against the wall trying to get this "make" to run and I was hoping to get some opinions as to why this might not be working.  The module in question looks like this:

 class install-lei_chelsio_driver {
        # This will place the chelsio tarball locally in /usr/src.  File is pulled from puppet.
        file { "/usr/src/ChelsioUwire-1.0.2.26.tar.gz" :
                source  => "puppet:///install-lei_chelsio_driver/ChelsioUwire-1.0.2.26.tar.gz" ,
                ensure  => present ,
        }

        # Untar the tarball 
        exec { "/bin/tar -xvf /usr/src/ChelsioUwire-1.0.2.26.tar.gz" :
                cwd => "/usr/src/" ,
                creates => "/usr/src/ChelsioUwire-1.0.2.26" ,
        }

        # This will run the make which will line up everything to install the drivers from source.
        exec { "/usr/src/ChelsioUwire-1.0.2.26 make KDIR=/usr/src/linux-headers-2.6.32-41" :
                path => "/usr/src/ChelsioUwire-1.0.2.26" ,
        }
}

This is the error I get upon running a machine against the manifest:

err: /Stage[main]/Install-lei_chelsio_driver/Exec[/usr/src/ChelsioUwire-1.0.2.26 make KDIR=/usr/src/linux-headers-2.6.32-41]/returns: change from notrun to 0 failed: /usr/src/ChelsioUwire-1.0.2.26 make KDIR=/usr/src/linux-headers-2.6.32-41 returned 1 instead of one of [0] at /etc/puppet/modules/install-lei_chelsio_driver/manifests/init.pp:20   

I added the "path" parameter for good measure and still no dice.  

Any suggestions as to why this one won't properly fire?

As always, the help and support are much appreciated.

Cheers,

Mike

Peter Berghold

unread,
Aug 1, 2012, 4:05:22 PM8/1/12
to puppet...@googlegroups.com




On Wed, Aug 1, 2012 at 3:56 PM, Mike Reed <mjohn...@gmail.com> wrote:

        # This will run the make which will line up everything to install the drivers from source.
        exec { "/usr/src/ChelsioUwire-1.0.2.26 make KDIR=/usr/src/linux-headers-2.6.32-41" :
                path => "/usr/src/ChelsioUwire-1.0.2.26" ,
        }
}

T

Is that a space between the directory path and the "make?"  That line is confusing me.  Perhaps you wanted it to say
exec { thing:
            cwd => "/usr/src/ChelsioUwire-1.0.2.26",
             path=> "{path with system specific directories in it}",
             command => "make KDIR=/usr/src/linux-headers-2.6.32-41" :
}

It occurs to me that just having the path set to where you are doing your build is going to leave out the places where things like gcc, ld and friends live.  You path should be colon delimited with all the directory paths that contain commands your build is dependant on.

The other thought I had (and maybe I'm missing something here) is I usually put things like file and exec in this sort of format:

file { 'some-sort-of-tag':
                path => ...,
                souirce => ... (or content => ...)
}

and
exec { some-other-tag: ... etc }


--



Darren Chamberlain

unread,
Aug 1, 2012, 5:13:00 PM8/1/12
to puppet...@googlegroups.com
* Mike Reed <mjohn.reed at gmail.com> [2012/08/01 12:56]:
> # This will run the make which will line up everything to install
> the drivers from source.
> exec { "/usr/src/ChelsioUwire-1.0.2.26 make
> KDIR=/usr/src/linux-headers-2.6.32-41" :
> path => "/usr/src/ChelsioUwire-1.0.2.26" ,
> }
> }

You're running the command:

/usr/src/ChelsioUwire-1.0.2.26 make KDIR=/usr/src/linux-headers-2.6.32-41

Which doesn't make any sense, as the error message says:

> err:
> /Stage[main]/Install-lei_chelsio_driver/Exec[/usr/src/ChelsioUwire-1.0.2.26
> make KDIR=/usr/src/linux-headers-2.6.32-41]/returns: change from notrun to
> 0 failed: /usr/src/ChelsioUwire-1.0.2.26 make
> KDIR=/usr/src/linux-headers-2.6.32-41 returned 1 instead of one of [0] at
> /etc/puppet/modules/install-lei_chelsio_driver/manifests/init.pp:20

--
Darren Chamberlain <dar...@boston.com>

Calvin Walton

unread,
Aug 1, 2012, 6:32:43 PM8/1/12
to puppet...@googlegroups.com
On Wed, 2012-08-01 at 12:56 -0700, Mike Reed wrote:
> Hello all,
>
> I've been banging my head against the wall trying to get this "make" to run
> and I was hoping to get some opinions as to why this might not be working.
> The module in question looks like this:

Lets take a look in order:

> class install-lei_chelsio_driver {
> # This will place the chelsio tarball locally in /usr/src. File is pulled from puppet.
> file { "/usr/src/ChelsioUwire-1.0.2.26.tar.gz" :
> source => "puppet:///install-lei_chelsio_driver/ChelsioUwire-1.0.2.26.tar.gz" ,
> ensure => present ,
> }
>
> # Untar the tarball
> exec { "/bin/tar -xvf /usr/src/ChelsioUwire-1.0.2.26.tar.gz" :
> cwd => "/usr/src/" ,
> creates => "/usr/src/ChelsioUwire-1.0.2.26" ,
> }

You don't have any dependencies specified here, so puppet doesn't know
that it has to copy over the tar file before untarring. It's possible
that this worked previously by chance... but it could just as easily
fail later.
Add a
requires => File['/usr/src/ChelsioUwire-1.0.2.26.tar.gz'],
to this exec resource.

> # This will run the make which will line up everything to install the drivers from source.
> exec { "/usr/src/ChelsioUwire-1.0.2.26 make KDIR=/usr/src/linux-headers-2.6.32-41" :
> path => "/usr/src/ChelsioUwire-1.0.2.26" ,
> }

There's a few things wrong here; it's quite confused. The correct exec
syntax would look like this:
exec { 'make KDIR=/usr/src/linux-headers-2.6.32-41':
path => ['/usr/bin', '/bin' ],
cwd => '/usr/src/ChelsioUwire-1.0.2.26',
requires => Exec['/bin/tar -xvf /usr/src/ChelsioUwire-1.0.2.26.tar.gz'],
}

The 'requires' ensures that the file is untarred before the make command
is run. Take a look at
http://docs.puppetlabs.com/references/latest/type.html#exec for
descriptions of the parameters being passed to the exec.

> }

You should really give the rest of the puppet documentation a read
through as well;
http://docs.puppetlabs.com/learning/ordering.html talks about ordering
and dependencies.

--
Calvin Walton <calvin...@kepstin.ca>

Mike Reed

unread,
Aug 2, 2012, 12:25:02 PM8/2/12
to puppet...@googlegroups.com
Thank you all for the responses.  I think the solution of scripting the install and calling the script via puppet is an interesting thought.  Thanks as well for the suggested reading.

Cheers,

Mike

Kristof Willaert

unread,
Aug 2, 2012, 2:09:22 PM8/2/12
to puppet...@googlegroups.com
Hi,

On Thu, Aug 2, 2012 at 6:25 PM, Mike Reed <mjohn...@gmail.com> wrote:
Thank you all for the responses.  I think the solution of scripting the install and calling the script via puppet is an interesting thought.  Thanks as well for the suggested reading.

just my thoughts on this: if you are going to perform this procedure on a few hosts, why not go the extra mile and create a package (deb, RPM, ...) on a buildhost, and just distribute the package through the normal mechanism (yum, apt repo) ?

That way, your manifests will be reduced to the nearly trivial

package { 'ChelsioUwire':
  ensure => '1.0.2.26',
}

Kind regards,

k
Reply all
Reply to author
Forward
0 new messages