vagrant-hiera 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ Gemfile.lock
2
+ pkg/
3
+ *.swp
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
+ #ruby=1.9.3
2
+ #ruby-gemset=vagrant-hiera
3
+
1
4
  source 'https://rubygems.org'
2
5
 
3
6
  gem 'vagrant'
data/README.md CHANGED
@@ -33,10 +33,19 @@ And then...
33
33
 
34
34
  `vagrant up`
35
35
 
36
- **Note**: You will need to add/checkout [hiera-puppet]("https://github.com/puppetlabs/hiera-puppet" "Hiera Puppet") to your module path. See the following links for more information:
36
+ **Notes**:
37
+ You will need to add/checkout [hiera-puppet]("https://github.com/puppetlabs/hiera-puppet" "Hiera Puppet") to your module path. See the following links for more information:
37
38
  - https://github.com/puppetlabs/hiera-puppet#installation
38
39
  - https://groups.google.com/d/msg/puppet-users/IlPq14Rsnm0/UhbbRUsqqLgJ
39
40
 
41
+ I've only tested this plugin on puppet 3. Thus, it will download and install puppet v3 (which as of now is a pre-release version). Although it is not tested, if you would like to configure the plugin to use a different version of puppet, hiera, etc., you can do so by adding the following config to your Vagrantfile.
42
+
43
+ ```
44
+ config.hiera.(puppet_apt_source|puppet_version|hiera_puppet_version|hiera_version|apt_opts) = ' ... '
45
+ ```
46
+
47
+ Thanks to [haf]('http://github.com/haf') for the contribution.
48
+
40
49
  ## Contributing
41
50
 
42
51
  1. Fork it
@@ -44,3 +53,5 @@ And then...
44
53
  3. Commit your changes (`git commit -am 'Added some feature'`)
45
54
  4. Push to the branch (`git push origin my-new-feature`)
46
55
  5. Create new Pull Request
56
+
57
+
@@ -7,6 +7,12 @@ module VagrantHiera
7
7
  attr_accessor :data_path
8
8
  attr_accessor :guest_data_path
9
9
 
10
+ attr_accessor :puppet_apt_source
11
+ attr_accessor :puppet_version
12
+ attr_accessor :hiera_puppet_version
13
+ attr_accessor :hiera_version
14
+ attr_accessor :apt_opts
15
+
10
16
  def guest_config_path
11
17
  @guest_config_path.nil? ? (@guest_config_path = '/tmp/vagrant-hiera/config') : @guest_config_path
12
18
  end
@@ -15,6 +21,26 @@ module VagrantHiera
15
21
  @guest_data_path.nil? ? (@guest_data_path = '/tmp/vagrant-hiera/data') : @guest_data_path
16
22
  end
17
23
 
24
+ def puppet_apt_source
25
+ @puppet_apt_source.nil? ? (@puppet_apt_source = 'deb http://apt.puppetlabs.com/ lucid devel main') : @puppet_apt_source
26
+ end
27
+
28
+ def puppet_version
29
+ @puppet_version.nil? ? (@puppet_version = '3.0.0-0.1rc5puppetlabs1') : @puppet_version
30
+ end
31
+
32
+ def hiera_puppet_version
33
+ @hiera_puppet_version.nil? ? (@hiera_puppet_version = '1.0.0-0.1rc3') : @hiera_puppet_version
34
+ end
35
+
36
+ def hiera_version
37
+ @hiera_version.nil? ? (@hiera_version = '1.0.0-0.1rc4') : @hiera_version
38
+ end
39
+
40
+ def apt_opts
41
+ @apt_opts.nil? ? (@apt_opts = '-y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"') : @apt_opts
42
+ end
43
+
18
44
  def config_path
19
45
  File.expand_path(@config_path) rescue nil
20
46
  end
@@ -31,6 +57,11 @@ module VagrantHiera
31
57
  errors.add("Config path can not be empty.") if config_path.nil?
32
58
  errors.add("Config file can not be empty.") if config_file.nil?
33
59
  errors.add("Data path can not be empty.") if data_path.nil?
60
+ errors.add("Puppet apt source can not be empty.") if puppet_apt_source.nil?
61
+ errors.add("Puppet version path can not be empty.") if puppet_version.nil?
62
+ errors.add("Hiera puppet version path can not be empty.") if hiera_puppet_version.nil?
63
+ errors.add("Hiera version path can not be empty.") if hiera_version.nil?
64
+ errors.add("Apt opts path can not be empty.") if apt_opts.nil?
34
65
  config = File.join("#{config_path}", "#{config_file}")
35
66
  errors.add("Config file not found at '#{config}'.") unless File.exists?(config)
36
67
  errors.add("Data directory not found at '#{data_path}'.") unless File.exists?("#{data_path}")
@@ -5,11 +5,17 @@ module VagrantHiera
5
5
  def initialize(app, env)
6
6
  @app = app
7
7
  @env = env
8
- @puppet_repo = 'deb http://apt.puppetlabs.com/ lucid devel main'
9
- @puppet_version = '3.0.0-0.1rc4puppetlabs1'
10
- @hiera_puppet_version = '1.0.0-0.1rc1-1-g3e68ff0'
11
- @hiera_version = '1.0.0-0.1rc3'
12
- @apt_opts = "-y --force-yes -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\""
8
+
9
+ @guest_config_path = @env[:vm].config.hiera.guest_config_path
10
+ @guest_data_path = @env[:vm].config.hiera.guest_data_path
11
+ @config_path = @env[:vm].config.hiera.config_path
12
+ @data_path = @env[:vm].config.hiera.data_path
13
+ @config_file = @env[:vm].config.hiera.config_file
14
+ @puppet_apt_source = @env[:vm].config.hiera.puppet_apt_source
15
+ @puppet_version = @env[:vm].config.hiera.puppet_version
16
+ @hiera_puppet_version = @env[:vm].config.hiera.hiera_puppet_version
17
+ @hiera_version = @env[:vm].config.hiera.hiera_version
18
+ @apt_opts = @env[:vm].config.hiera.apt_opts
13
19
  end
14
20
 
15
21
  def call(env)
@@ -18,7 +24,7 @@ module VagrantHiera
18
24
  add_apt_repo unless apt_repo_set?
19
25
  install_puppet unless puppet_installed?
20
26
  install_hiera unless hiera_installed?
21
- install_puppet_hiera unless hiera_puppet_installed?
27
+ install_hiera_puppet unless hiera_puppet_installed?
22
28
  create_shared_folders
23
29
  create_symlink_to_hiera_config
24
30
  end
@@ -37,14 +43,16 @@ module VagrantHiera
37
43
  end
38
44
 
39
45
  def apt_repo_set?
40
- setup = ( @env[:vm].channel.execute("grep '#{@puppet_repo}' /etc/apt/sources.list", :error_check => false) == 0 )
46
+ setup = ( @env[:vm].channel.execute("grep '#{@puppet_apt_source}' /etc/apt/sources.list", :error_check => false) == 0 )
41
47
  @env[:ui].success I18n.t('vagrant.plugins.hiera.middleware.setup.apt_repo_set') if setup
42
48
  setup
43
49
  end
44
50
 
45
51
  def add_apt_repo
46
52
  @env[:ui].warn I18n.t('vagrant.plugins.hiera.middleware.setup.add_apt_repo')
47
- @env[:vm].channel.sudo("echo '#{@puppet_repo}' >> /etc/apt/sources.list")
53
+ @env[:vm].channel.sudo("wget http://apt.puppetlabs.com/puppetlabs-release-stable.deb")
54
+ @env[:vm].channel.sudo("dpkg -i puppetlabs-release-stable.deb")
55
+ @env[:vm].channel.sudo("echo '#{@puppet_apt_source}' >> /etc/apt/sources.list.d/puppet.list")
48
56
  @env[:vm].channel.sudo("apt-get update")
49
57
  end
50
58
 
@@ -76,17 +84,17 @@ module VagrantHiera
76
84
  data = {}
77
85
  data[:owner] ||= @env[:vm].config.ssh.username
78
86
  data[:group] ||= @env[:vm].config.ssh.username
79
- @env[:vm].guest.mount_shared_folder('vagrant-hiera-config', @env[:vm].config.hiera.guest_config_path, data)
80
- @env[:vm].guest.mount_shared_folder('vagrant-hiera-data', @env[:vm].config.hiera.guest_data_path, data)
87
+ @env[:vm].guest.mount_shared_folder('vagrant-hiera-config', @guest_config_path, data)
88
+ @env[:vm].guest.mount_shared_folder('vagrant-hiera-data', @guest_data_path, data)
81
89
  end
82
90
 
83
91
  def create_symlink_to_hiera_config
84
92
  @env[:ui].info I18n.t('vagrant.plugins.hiera.middleware.setup.installing_hiera_config')
85
93
  @env[:vm].channel.sudo("mkdir -p /etc/puppet")
86
94
  # This is where I think this file will end up once the official puppet v3 release is out
87
- @env[:vm].channel.sudo("ln -fs #{@env[:vm].config.hiera.guest_config_path}/#{@env[:vm].config.hiera.config_file} /etc/hiera.yaml")
95
+ @env[:vm].channel.sudo("ln -fs #{@guest_config_path}/#{@config_file} /etc/hiera.yaml")
88
96
  # But this is where it looks for it now
89
- @env[:vm].channel.sudo("ln -fs #{@env[:vm].config.hiera.guest_config_path}/#{@env[:vm].config.hiera.config_file} /etc/puppet/hiera.yaml")
97
+ @env[:vm].channel.sudo("ln -fs #{@guest_config_path}/#{@config_file} /etc/puppet/hiera.yaml")
90
98
  end
91
99
  end
92
100
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Hiera
3
- VERSION = "0.3.4"
3
+ VERSION = "0.3.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-hiera
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-28 00:00:00.000000000 Z
12
+ date: 2012-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: vagrant
@@ -34,6 +34,7 @@ executables: []
34
34
  extensions: []
35
35
  extra_rdoc_files: []
36
36
  files:
37
+ - .gitignore
37
38
  - .rvmrc
38
39
  - Gemfile
39
40
  - LICENSE