Sebastien Liu
Sebastien Liu

Reputation: 121

vim bundles are not installed by vundle exactly in Puppet

I am trying to puppetise vundle which is to be used for CentOS user. The result of Puppet is positive without any error messages:

notice: /Stage[main]/Devops-base-utilities::Vimconfig /Exec[install_vundle]/returns: executed successfully

But when I checked ~/.vim/bundle directory, only vundle was cloned from git repository.

The exec command module is below:

exec { "install_vundle":
  user        => www,
  command     => 'vim +BundleInstall +qall',
  path        => "/usr/bin",
  provider    => shell,
  refreshonly => true,
  require     => [Package["vim-enhanced"], Exec["clone_vundle"]],
  subscribe   => File['/home/www/.vimrc.bundles.local']
}

But vim +BundleInstall +qall can be launched manually.

Upvotes: 2

Views: 361

Answers (2)

IxDay
IxDay

Reputation: 3707

You must provide a cwd => entry, because the installation tries to go back to cwd between git clones, and got a permission denied. This is not logged. I found it when using https://github.com/jdevera/parallel-vundle-installer.

Upvotes: 0

mcandre
mcandre

Reputation: 24612

Slava's suggestion worked for me!

Vagrantfile:

VAGRANTFILE_API_VERSION = '2'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = 'precise64'
  config.vm.box_url = 'http://files.vagrantup.com/precise64.box'

  config.vm.provision :shell do |shell|
    shell.inline = "mkdir -p /etc/puppet/modules;
                    puppet module install -f puppetlabs-stdlib;
                    puppet module install -f puppetlabs/apt"
  end

  config.vm.provision :puppet
end

manifests/default.pp:

# Update apt before installing any packages

class { "apt":
  update_timeout => 60
}

exec { "apt-update":
  command => "/usr/bin/apt-get update"
}

Exec["apt-update"] -> Package <| |>

package { "git":
  ensure => latest
}

package { "vim":
  ensure => latest
}

# Link vim profile

file { "/home/vagrant/.vimrc":
  ensure => link,
  target => "/vagrant/.vimrc",
  require => Package["vim"]
}

file { "/home/vagrant/.vim/":
  ensure => directory,
  owner => "vagrant",
  group => "vagrant",
  require => Package["vim"]
}

exec { "git vundle":
  command => "/usr/bin/sudo -u vagrant git clone https://github.com/gmarik/vundle.git /home/vagrant/.vim/bundle/vundle",
  require => [
    Package["git"],
    Package["vim"],
    File["/home/vagrant/.vimrc"],
    File["/home/vagrant/.vim/"]
  ]
}

# Install Vim packages

exec { "vundle":
  command => "/usr/bin/sudo -u vagrant /usr/bin/vim +BundleInstall +qall",
  environment => "HOME=/home/vagrant/",
  require => Exec["git vundle"]
}

.vimrc:

https://github.com/mcandre/dotfiles/blob/master/.vimrc

Upvotes: 1

Related Questions