vagrant-chef-solo-mount-options 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc43f3a670dbef7e0f7b2531c9732e053c0e8f95
4
+ data.tar.gz: 5f3185990f10a2982e05a758bd9bb3e74facdbc3
5
+ SHA512:
6
+ metadata.gz: be3326b6b4ed314af730005e64ff9a61a9429a2461cf44b1189ae7317d2540dbf510ef252cb8f6d935e021efc164a91e5d306342906a0986c72fab0b0a23c357
7
+ data.tar.gz: 9e15af754ae97001aece2d714d710ce0456148c819d58118dae6e91bef4cb8d951295279537610ead6f7c5507a7e332568e78b3e5ce5aa3417f359d8e007c75a
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.2
3
+
4
+ Metrics/LineLength:
5
+ Max: 120
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :plugins do
4
+ gem 'vagrant-chef-solo-mount-options', path: '.'
5
+ end
6
+
7
+ group :development do
8
+ gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git', tag: 'v1.8.6'
9
+ end
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Vagrant Chef Solo Provisioner, with mount options
2
+
3
+ Allows specifying `chef.synced_folder_options = {}` to forward to the synced folders declaration, for instance:
4
+
5
+ ```ruby
6
+ config.vm.provision :chef_solo_mount_options do |chef|
7
+ # ...
8
+
9
+ # Use NFS for speed and avoiding vboxfs issues
10
+ nfs_version = 3
11
+ nfs_version = 4 if FFI::Platform::IS_LINUX
12
+ chef.synced_folder_type = :nfs unless FFI::Platform::IS_WINDOWS
13
+ chef.synced_folder_options = {
14
+ mount_options: ['rw', "vers=#{nfs_version}", 'tcp', 'nolock', 'noatime', 'actimeo=1']
15
+ } unless FFI::Platform::IS_WINDOWS
16
+
17
+ # ...
18
+ end
19
+ ```
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bundle install` to install dependencies.
24
+
25
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/inviqa/vagrant-chef-solo-mount-options. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
30
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+ task default: :spec
@@ -0,0 +1,29 @@
1
+ require 'vagrant/util/presence'
2
+ require Vagrant.source_root.join('plugins', 'provisioners', 'chef', 'config', 'chef_solo')
3
+
4
+ module VagrantPlugins
5
+ module ChefMountOptions
6
+ module Config
7
+ # This class implements config for chef-solo, with additional options for mount points.
8
+ class ChefSoloMountOptions < VagrantPlugins::Chef::Config::ChefSolo
9
+ include Vagrant::Util::Presence
10
+
11
+ # Options for the synced folders to use.
12
+ # @return [Hash]
13
+ attr_accessor :synced_folder_options
14
+
15
+ def initialize
16
+ super
17
+
18
+ @synced_folder_options = UNSET_VALUE
19
+ end
20
+
21
+ def finalize!
22
+ super
23
+
24
+ @synced_folder_options = {} if @synced_folder_options == UNSET_VALUE
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,26 @@
1
+ require Vagrant.source_root.join('plugins', 'provisioners', 'chef', 'plugin')
2
+
3
+ module VagrantPlugins
4
+ module ChefMountOptions
5
+ # Declare the plugin for vagrant
6
+ class Plugin < Vagrant.plugin('2')
7
+ extend VagrantPlugins::Chef
8
+
9
+ name 'vagrant-chef-solo-mount-options'
10
+ description <<-DESC
11
+ Provides support for provisioning your virtual machines with
12
+ Chef via `chef-solo`, `chef-client`, `chef-zero` or `chef-apply`.
13
+ DESC
14
+
15
+ config :chef_solo_mount_options, :provisioner do
16
+ require_relative 'config/chef_solo_mount_options'
17
+ Config::ChefSoloMountOptions
18
+ end
19
+
20
+ provisioner :chef_solo_mount_options do
21
+ require_relative 'provisioner/chef_solo_mount_options'
22
+ Provisioner::ChefSoloMountOptions
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,43 @@
1
+ require 'vagrant/util/counter'
2
+ require Vagrant.source_root.join('plugins', 'provisioners', 'chef', 'provisioner', 'chef_solo')
3
+
4
+ module VagrantPlugins
5
+ module ChefMountOptions
6
+ module Provisioner
7
+ # This class implements provisioning via chef-solo, with options for mount points.
8
+ class ChefSoloMountOptions < VagrantPlugins::Chef::Provisioner::ChefSolo
9
+ extend Vagrant::Util::Counter
10
+ include Vagrant::Util::Counter
11
+
12
+ # Shares the given folders with the given prefix. The folders should
13
+ # be of the structure resulting from the `expanded_folders` function.
14
+ def share_folders(root_config, prefix, folders, existing = nil)
15
+ existing_set = Set.new
16
+ (existing || []).each do |_, fs|
17
+ fs.each do |_id, data|
18
+ existing_set.add(data[:guestpath])
19
+ end
20
+ end
21
+
22
+ folders.each do |type, local_path, remote_path|
23
+ next if type != :host
24
+
25
+ root_config.vm.synced_folder(local_path, remote_path, opts(prefix, remote_path))
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def opts(prefix, remote_path)
32
+ key = Digest::MD5.hexdigest(remote_path)
33
+ key = key[0..8]
34
+
35
+ opts = {}
36
+ opts[:id] = "v-#{prefix}-#{key}"
37
+ opts[:type] = @config.synced_folder_type if @config.synced_folder_type
38
+ opts.merge!(@config.synced_folder_options) if @config.synced_folder_options
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module ChefMountOptions
3
+ VERSION = '1.0.0'.freeze
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ require 'vagrant'
2
+
3
+ require_relative 'vagrant-chef-solo-mount-options/plugin'
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ require 'vagrant-chef-solo-mount-options/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'vagrant-chef-solo-mount-options'
9
+ spec.version = '1.0.0'.freeze
10
+ spec.authors = ['Kieren Evans']
11
+ spec.email = ['kevans+vagrant_plugins@inviqa.com']
12
+
13
+ spec.summary = 'Vagrant Chef Solo Provisioner, with mount options'
14
+ spec.description = 'Vagrant Chef Solo Provisioner, with mount options'
15
+ spec.homepage = ''
16
+ spec.licenses = ['MIT']
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|\.rubocop\.yml|Rakefile)/}) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.11'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'rubocop', '~> 0.43.0'
24
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-chef-solo-mount-options
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kieren Evans
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.43.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.43.0
55
+ description: Vagrant Chef Solo Provisioner, with mount options
56
+ email:
57
+ - kevans+vagrant_plugins@inviqa.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".rubocop.yml"
63
+ - Gemfile
64
+ - README.md
65
+ - Rakefile
66
+ - lib/vagrant-chef-solo-mount-options/config/chef_solo_mount_options.rb
67
+ - lib/vagrant-chef-solo-mount-options/plugin.rb
68
+ - lib/vagrant-chef-solo-mount-options/provisioner/chef_solo_mount_options.rb
69
+ - lib/vagrant-chef-solo-mount-options/version.rb
70
+ - lib/vagrant_chef_solo_mount_options.rb
71
+ - vagrant-chef-solo-mount-options.gemspec
72
+ homepage: ''
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.4.8
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Vagrant Chef Solo Provisioner, with mount options
96
+ test_files: []