vagrant-saltdeps 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGLOG.md +11 -0
- data/Gemfile.lock +1 -9
- data/LICENSE.txt +22 -0
- data/README.md +111 -2
- data/lib/vagrant-saltdeps/config.rb +1 -1
- data/lib/vagrant-saltdeps/provisioner.rb +33 -9
- data/lib/vagrant-saltdeps/version.rb +1 -1
- data/vagrant-saltdeps.gemspec +1 -2
- metadata +3 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9be297f3cfa2753d1efb9ce69a918ad7b3fec970
|
4
|
+
data.tar.gz: 41675ca3e8010efeefc5dde80f43d977cc4a4b7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7077e201093f952b6e894953e4dde51d9091bbc6519c1911bddbba4f2d8fc590c83148f7c4450402c713f39a644c5b63e503cbcf929a0b1dc69305d7797dae76
|
7
|
+
data.tar.gz: 26909405ea5f39cf8161ac62b3cac6d30d519e7a71a459858d33cd4fe0a92cb5505c5bdf61ee5ce67d5a3a4edbea0a433709798e1978f4405db1092e27519a1d
|
data/CHANGLOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -23,10 +23,9 @@ GIT
|
|
23
23
|
PATH
|
24
24
|
remote: .
|
25
25
|
specs:
|
26
|
-
vagrant-saltdeps (1.0.
|
26
|
+
vagrant-saltdeps (1.0.1)
|
27
27
|
activesupport (= 4.1.10)
|
28
28
|
git (~> 1.2)
|
29
|
-
pry (~> 0.10)
|
30
29
|
|
31
30
|
GEM
|
32
31
|
remote: https://rubygems.org/
|
@@ -42,7 +41,6 @@ GEM
|
|
42
41
|
timers (~> 4.0.0)
|
43
42
|
childprocess (0.5.5)
|
44
43
|
ffi (~> 1.0, >= 1.0.11)
|
45
|
-
coderay (1.1.0)
|
46
44
|
diff-lcs (1.2.5)
|
47
45
|
domain_name (0.5.23)
|
48
46
|
unf (>= 0.0.5, < 1.0.0)
|
@@ -69,7 +67,6 @@ GEM
|
|
69
67
|
logging (1.8.2)
|
70
68
|
little-plugger (>= 1.1.3)
|
71
69
|
multi_json (>= 1.8.4)
|
72
|
-
method_source (0.8.2)
|
73
70
|
mime-types (2.4.3)
|
74
71
|
mini_portile (0.6.0)
|
75
72
|
minitest (5.5.1)
|
@@ -83,10 +80,6 @@ GEM
|
|
83
80
|
nokogiri (1.6.3.1)
|
84
81
|
mini_portile (= 0.6.0)
|
85
82
|
nori (2.4.0)
|
86
|
-
pry (0.10.1)
|
87
|
-
coderay (~> 1.1.0)
|
88
|
-
method_source (~> 0.8.1)
|
89
|
-
slop (~> 3.4)
|
90
83
|
rake (10.4.2)
|
91
84
|
rb-fsevent (0.9.4)
|
92
85
|
rb-inotify (0.9.5)
|
@@ -112,7 +105,6 @@ GEM
|
|
112
105
|
rspec-support (3.2.2)
|
113
106
|
rubyntlm (0.4.0)
|
114
107
|
rubyzip (1.1.7)
|
115
|
-
slop (3.6.0)
|
116
108
|
thread_safe (0.3.5)
|
117
109
|
timers (4.0.1)
|
118
110
|
hitimes
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Joseph Hughes
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,2 +1,111 @@
|
|
1
|
-
# vagrant-
|
2
|
-
|
1
|
+
# vagrant-saltdeps
|
2
|
+
[](https://gitter.im/joshughes/vagrant-saltdeps?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
3
|
+
|
4
|
+
When testing salt formula with vagrant you may have one or many dependent formulas that are required to fully test your new formula. Vagrantsaltdeps is meant to help you manage these dependencies by checking them out from git and making them avaliable to your vagrant machine.
|
5
|
+
|
6
|
+
**NOTE:** This plugin requires Vagrant 1.2+,
|
7
|
+
|
8
|
+
## Features
|
9
|
+
|
10
|
+
* Check out dependent salt formula from git
|
11
|
+
* Branch support for dependent formula
|
12
|
+
* Grains and Pillar merging from dependent formula
|
13
|
+
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Install using standard Vagrant 1.1+ plugin installation methods.
|
18
|
+
|
19
|
+
```
|
20
|
+
$ vagrant plugin install vagrant-saltdeps
|
21
|
+
...
|
22
|
+
```
|
23
|
+
|
24
|
+
|
25
|
+
## Quick Start
|
26
|
+
|
27
|
+
After installing the plugin (instructions above), you must create a saltdeps.yml file somewhere in your repo. This file along with your grains and pillar files must live in the same place across your repos. Here is an example.
|
28
|
+
|
29
|
+
```
|
30
|
+
apache:
|
31
|
+
git: ssh://git@stash.itriagehealth.com/salt/artifactory-formula.git
|
32
|
+
branch: develop
|
33
|
+
```
|
34
|
+
|
35
|
+
After defining a saltdeps.yml file you must configure your Vagrantfile. You should put the vagrant-saltdeps provisioner before your salt provisioner since it touches the salt provisioner configuration.
|
36
|
+
|
37
|
+
```
|
38
|
+
# -*- mode: ruby -*-
|
39
|
+
# vi: set ft=ruby :
|
40
|
+
|
41
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
42
|
+
VAGRANTFILE_API_VERSION = "2"
|
43
|
+
|
44
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
45
|
+
config.vm.box = "ubuntu/trusty64"
|
46
|
+
config.vm.synced_folder "./.vagrant-salt", "/srv/salt", id: "vagrant-root"
|
47
|
+
|
48
|
+
config.ssh.forward_agent = true
|
49
|
+
|
50
|
+
config.vm.provider :virtualbox do |vb|
|
51
|
+
# Use VBoxManage to customize the VM. For example to change memory:
|
52
|
+
vb.customize ["modifyvm", :id, "--memory", "1024"]
|
53
|
+
end
|
54
|
+
|
55
|
+
if Vagrant.has_plugin?("vagrant-saltdeps")
|
56
|
+
config.vm.provision :saltdeps do |deps|
|
57
|
+
deps.checkout_path = "./.vagrant-salt/deps"
|
58
|
+
deps.deps_path = "./.vagrant-salt/saltdeps.yml"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Provision VM with current formula, in masterless mode
|
63
|
+
config.vm.provision :salt do |salt|
|
64
|
+
salt.minion_config = "./.vagrant-salt/minion"
|
65
|
+
salt.run_highstate = true
|
66
|
+
salt.install_type = 'stable'
|
67
|
+
salt.colorize = true
|
68
|
+
salt.verbose = true
|
69
|
+
end
|
70
|
+
|
71
|
+
# Run serverspec tests
|
72
|
+
if Vagrant.has_plugin?("vagrant-serverspec")
|
73
|
+
config.vm.provision :serverspec do |spec|
|
74
|
+
spec.pattern = './spec/*_spec.rb'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
```
|
80
|
+
|
81
|
+
This will get you started using the plugin. For further plugin configuration options please read below.
|
82
|
+
|
83
|
+
With the example above a new folder will be created in `.vagrant-salt/deps` called `apache-formula`. In this folder saltdeps will checkout the development branch from git and search to see if any grains or pillar files from that formula need to be merged into this formula's current grains and pillars. It will then configure the salt provisioner so it has access to the grain and pillar data and sync the apache formula to the vagrant vm.
|
84
|
+
|
85
|
+
## Configuration
|
86
|
+
|
87
|
+
This project exposes a few configuration options so you can decide the best way to lay out your salt-formula and still be able to test it in vagrant.
|
88
|
+
|
89
|
+
* **checkout_path** - Where you want saltdeps to checkout your dependent formulas. Defaults to `.saltdeps`
|
90
|
+
* **deps_path** - The path to yor saltdeps.yml file. Defaults to `.vagrant-salt/saltdeps.yml'
|
91
|
+
* **grains_path** - The path in **all** your repos where the grains file can be found. Defaults to `.vagrant-salt/grains`
|
92
|
+
* **pillars_path** - The path in **all** your repos where the pillars file can be found. Defaults to `.vagrant-salt/pillars`
|
93
|
+
* **merge_pillars** - Tells saltdeps if it should merge your dependent pillars into one file. Defaults to `true`.
|
94
|
+
* **merge_grains** - Tells saltdeps if it should merge your dependent grains into one file. Defaults to `true`.
|
95
|
+
* **merge_path** - Path where saltdeps should put the results of the merged pillars and grains files. Defaults to `.vagrant-salt/compiled_grains` and `.vagrant-salt/compiled_pillars`.
|
96
|
+
|
97
|
+
|
98
|
+
## Development
|
99
|
+
|
100
|
+
To work on the `vagrant-saltdeps` plugin, fork this repository out, and use
|
101
|
+
[Bundler](http://gembundler.com) to get the dependencies: **Note:** vagrant requires `bundler < 1.8`. So you will need to install `1.7.13` and use the syntax below to make sure you are running with that version.
|
102
|
+
|
103
|
+
```
|
104
|
+
$ bundle _1.7.13_
|
105
|
+
```
|
106
|
+
|
107
|
+
Currently there are not unit tests, but to test you can go to a directory with a Vagrantfile and run the following.
|
108
|
+
|
109
|
+
```
|
110
|
+
$ bundle _1.7.13_ exec vagrant provision
|
111
|
+
```
|
@@ -40,7 +40,7 @@ module VagrantPlugins
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def finalize!
|
43
|
-
@deps_path = expand('.vagrant-salt') if @deps_path == UNSET_VALUE
|
43
|
+
@deps_path = expand('.vagrant-salt/saltdeps.yml') if @deps_path == UNSET_VALUE
|
44
44
|
@grains_path = '.vagrant-salt/grains' if @grains_path == UNSET_VALUE
|
45
45
|
@pillars_path = '.vagrant-salt/pillars' if @pillars_path == UNSET_VALUE
|
46
46
|
@merged_path = '.vagrant-salt' if @merged_path == UNSET_VALUE
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'log4r'
|
2
2
|
require 'vagrant'
|
3
3
|
require 'git'
|
4
|
-
require '
|
4
|
+
require 'fileutils'
|
5
5
|
require "log4r"
|
6
6
|
|
7
7
|
|
@@ -63,21 +63,39 @@ module VagrantPlugins
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
def cleanup
|
67
|
+
if File.directory? @checkout_path
|
68
|
+
FileUtils.rm_rf(@checkout_path)
|
69
|
+
end
|
70
|
+
if File.directory? @merged_path
|
71
|
+
FileUtils.rm(@merged_path + '/compiled_grains') if File.exists? @merged_path + '/compiled_grains'
|
72
|
+
FileUtils.rm(@merged_path + '/compiled_pillars') if File.exists? @merged_path + '/compiled_pillars'
|
73
|
+
end
|
74
|
+
cleanup_check_path = self.clean_up_path
|
75
|
+
@deps.keys.each do |dep|
|
76
|
+
FileUtils.rm_rf(cleanup_check_path + '/' + dep) if File.directory?(cleanup_check_path + '/' + dep)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
66
80
|
def merge_grains
|
67
81
|
output_path = File.expand_path(@merged_path+'/compiled_grains', @machine.env.root_path)
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
82
|
+
if @merge_grains
|
83
|
+
merge(@grains_path, output_path)
|
84
|
+
@machine.config.vm.provisioners.each do |provisioner|
|
85
|
+
next unless provisioner.type == :salt
|
86
|
+
provisioner.config.grains_config= output_path
|
87
|
+
end
|
72
88
|
end
|
73
89
|
end
|
74
90
|
|
75
91
|
def merge_pillars
|
76
92
|
output_path = File.expand_path(@merged_path+'/compiled_pillars', @machine.env.root_path)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
93
|
+
if @merge_pillars
|
94
|
+
merge(@pillars_path, output_path)
|
95
|
+
@machine.config.vm.provisioners.each do |provisioner|
|
96
|
+
next unless provisioner.type == :salt
|
97
|
+
provisioner.config.pillar(YAML.load_file(output_path))
|
98
|
+
end
|
81
99
|
end
|
82
100
|
end
|
83
101
|
|
@@ -95,6 +113,12 @@ module VagrantPlugins
|
|
95
113
|
File.open(output, 'w') {|f| f.write merge_object.to_yaml }
|
96
114
|
end
|
97
115
|
|
116
|
+
def clean_up_path
|
117
|
+
checkout_path = @checkout_path.split('/')
|
118
|
+
base_checkout_path = checkout_path[0..(checkout_path.length-2)].join('/')
|
119
|
+
File.expand_path(base_checkout_path, @machine.env.root_path)
|
120
|
+
end
|
121
|
+
|
98
122
|
end
|
99
123
|
end
|
100
124
|
end
|
data/vagrant-saltdeps.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
lib = File.expand_path('../lib', __FILE__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require 'vagrant-
|
3
|
+
require 'vagrant-saltdeps/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "vagrant-saltdeps"
|
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.require_paths = ['lib']
|
19
19
|
|
20
20
|
s.add_runtime_dependency "git", "~> 1.2"
|
21
|
-
s.add_runtime_dependency "pry", '~> 0.10'
|
22
21
|
s.add_runtime_dependency "activesupport", '4.1.10'
|
23
22
|
|
24
23
|
s.add_development_dependency "rake", '~> 10.4'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-saltdeps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Hughes
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: pry
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.10'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0.10'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: activesupport
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,9 +74,11 @@ extra_rdoc_files: []
|
|
88
74
|
files:
|
89
75
|
- ".gitignore"
|
90
76
|
- ".rspec"
|
77
|
+
- CHANGLOG.md
|
91
78
|
- Gemfile
|
92
79
|
- Gemfile.lock
|
93
80
|
- LICENSE
|
81
|
+
- LICENSE.txt
|
94
82
|
- README.md
|
95
83
|
- Rakefile
|
96
84
|
- lib/vagrant-saltdeps.rb
|