voxpupuli / puppet-virtualbox

A Puppet module to install and manage VirtualBox
https://forge.puppet.com/puppet/virtualbox
Apache License 2.0
5 stars 29 forks source link

uname -r call without full path #92

Closed BEfelipe closed 4 years ago

BEfelipe commented 5 years ago

https://github.com/voxpupuli/puppet-virtualbox/blob/8b9c47037fd8c41e96b91d5ab29c6b7c47db9036/manifests/kernel.pp#L18

if puppet is called from a bootstrapping process /usr/bin may not be in the PATH by default, this will cause setup to fail

Error: '/usr/lib/virtualbox/vboxdrv.sh setup' returned 1 instead of one of [0]
  Error: /Stage[main]/Virtualbox::Kernel/Exec[vboxdrv]/returns: change from 'notrun' to ['0'] failed: '/usr/lib/virtualbox/vboxdrv.sh setup' returned 1 instead of one of [0] (corrective)

LOG

Building the main VirtualBox module.
Error building the module:
/tmp/vbox.0/Makefile-header.gmk:100: *** The variable KERN_DIR must be a kernel build folder and end with /build without a trailing slash, or KERN_VER must be set.  Stop.

please fully qualify the path for this or add all paths to exec resource.

BEfelipe commented 4 years ago

second this CentOS7.7

Building the main VirtualBox module. Error building the module: /tmp/vbox.0/Makefile-header.gmk:100: *** The variable KERN_DIR must be a kernel build folder and end with /build without a trailing slash, or KERN_VER must be set. Stop.

mwaldmueller commented 4 years ago

I would suggest this code:

exec { 'vboxdrv'
  unless      => '/sbin/lsmod | grep vboxdrv',
  command     => "${vboxdrv_command} setup",
  environment => [ "KERN_DIR=/lib/modules/${kernelrelease}/build" ],
  require     => Package[$vboxdrv_dependencies],
}
ghoneycutt commented 4 years ago

Thanks! Could you please provide a pull request.