vagrant-dotvm 0.37.0 → 0.38.0.pre
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/CHANGELOG.md +7 -1
- data/Gemfile +0 -2
- data/README.md +3 -0
- data/lib/vagrant-dotvm/config/provision.rb +2 -0
- data/lib/vagrant-dotvm/dotvm.rb +4 -4
- data/lib/vagrant-dotvm/group/command.rb +118 -0
- data/lib/vagrant-dotvm/group/config.rb +17 -0
- data/lib/vagrant-dotvm/injector/machine.rb +3 -5
- data/lib/vagrant-dotvm/injector/provision.rb +3 -1
- data/lib/vagrant-dotvm/plugin.rb +10 -0
- data/lib/vagrant-dotvm/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 546eb0a4d4130f0321c5958da2e8a8210dfd193d
|
4
|
+
data.tar.gz: 99856b339b3bf669c834a1863415a1d6a1e62b78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6892a28599974ad49a9a86fafc2e4a11ff51ede778ea74f5a99f36e804f5b8dd07ed458e89886999333dec4b978d57111b6b93bf73855aa1b3435a5efd0d592
|
7
|
+
data.tar.gz: b96acaf5f2f054dcf764adbb81cd6fc424a0f0962f44a4acf7e77188b1baae2aef840fa344946573144709785ab531d8db6ec04fffc05fd8828b6fce4373aebe
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
# 0.
|
1
|
+
# 0.38.0
|
2
|
+
* Support for `.yml` extension
|
3
|
+
* Added `force_remote_user` option to Ansible provision
|
4
|
+
* Added `env` option to shell provision
|
5
|
+
* Ability to configure groups without `vagrant-group` plugin installed
|
6
|
+
|
7
|
+
# 0.37.0
|
2
8
|
* Now it's possible to initialize DotVM environment with one command.
|
3
9
|
|
4
10
|
# 0.36.0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -36,3 +36,6 @@ $ mkdir projects
|
|
36
36
|
|
37
37
|
## More information
|
38
38
|
For more information please follow to [documentation](https://github.com/vagrant-dotvm/documentation).
|
39
|
+
|
40
|
+
## Logo
|
41
|
+
Computing graphic by [Webalys](http://www.streamlineicons.com/) from [Flaticon](http://www.flaticon.com/) is licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/). Made with [Logo Maker](http://logomakr.com).
|
data/lib/vagrant-dotvm/dotvm.rb
CHANGED
@@ -38,11 +38,11 @@ module VagrantPlugins
|
|
38
38
|
def init_instance
|
39
39
|
@instance = Config::Instance.new
|
40
40
|
@instance.variables.append_group 'env', ENV
|
41
|
-
@instance.variables.append_group 'global', (parse_variables "#{@path}/variables/*.yaml")
|
41
|
+
@instance.variables.append_group 'global', (parse_variables "#{@path}/variables/*.{yaml,yml}")
|
42
42
|
end
|
43
43
|
|
44
44
|
def load_options
|
45
|
-
Dir["#{@path}/options/*.yaml"].each do |file|
|
45
|
+
Dir["#{@path}/options/*.{yaml,yml}"].each do |file|
|
46
46
|
@instance.options = Replacer.new
|
47
47
|
.on(YAML.load_file(file) || {})
|
48
48
|
.using(@instance.variables)
|
@@ -53,7 +53,7 @@ module VagrantPlugins
|
|
53
53
|
def load_projects
|
54
54
|
Dir["#{@path}/projects/*"].each do |dir|
|
55
55
|
project = @instance.new_project
|
56
|
-
project.variables.append_group 'project', (parse_variables "#{dir}/variables/*.yaml")
|
56
|
+
project.variables.append_group 'project', (parse_variables "#{dir}/variables/*.{yaml,yml}")
|
57
57
|
project.variables.append_group(
|
58
58
|
'host',
|
59
59
|
{
|
@@ -69,7 +69,7 @@ module VagrantPlugins
|
|
69
69
|
}
|
70
70
|
)
|
71
71
|
|
72
|
-
Dir["#{dir}/machines/*.yaml"].each do |file|
|
72
|
+
Dir["#{dir}/machines/*.{yaml,yml}"].each do |file|
|
73
73
|
yaml = Replacer.new
|
74
74
|
.on(YAML.load_file(file) || [])
|
75
75
|
.using(@instance.variables.merge(project.variables))
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Dotvm
|
3
|
+
module Group
|
4
|
+
class Command < Vagrant.plugin(2, :command)
|
5
|
+
|
6
|
+
COMMANDS = %w(up halt destroy provision reload hosts suspend resume)
|
7
|
+
|
8
|
+
def self.synopsis
|
9
|
+
'runs vagrant command on specific group of VMs'
|
10
|
+
end # self.synopsis
|
11
|
+
|
12
|
+
def execute
|
13
|
+
options = {
|
14
|
+
provision_ignore_sentinel: false, # otherwise reload command does provision
|
15
|
+
}
|
16
|
+
opts = OptionParser.new do |o|
|
17
|
+
o.banner = sprintf('Usage: vagrant group <%s> <group-name>', COMMANDS.join('|'))
|
18
|
+
o.separator ''
|
19
|
+
|
20
|
+
o.on('-h', '--help', 'Print this help') do
|
21
|
+
safe_puts(opts.help)
|
22
|
+
return nil
|
23
|
+
end
|
24
|
+
|
25
|
+
o.on('-f', '--force', 'Do action (destroy, halt) without confirmation.') do
|
26
|
+
options[:force_confirm_destroy] = true
|
27
|
+
options[:force_halt] = true
|
28
|
+
end
|
29
|
+
|
30
|
+
o.on(nil, '--provision', 'Enable provisioning (up, reload).') do
|
31
|
+
options[:provision_ignore_sentinel] = true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
argv = parse_options(opts)
|
36
|
+
|
37
|
+
action = argv[0]
|
38
|
+
pattern = argv[1]
|
39
|
+
|
40
|
+
if !pattern || !action || !COMMANDS.include?(action)
|
41
|
+
safe_puts(opts.help)
|
42
|
+
return nil
|
43
|
+
end
|
44
|
+
|
45
|
+
groups = find_groups(pattern)
|
46
|
+
if groups.length == 0
|
47
|
+
@env.ui.error('No groups matched the pattern given.')
|
48
|
+
return nil
|
49
|
+
end
|
50
|
+
|
51
|
+
if action == 'hosts'
|
52
|
+
groups.each do |group|
|
53
|
+
print_hosts(group)
|
54
|
+
end
|
55
|
+
else
|
56
|
+
groups.each do |group|
|
57
|
+
do_action(action, options, group)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end # execute
|
61
|
+
|
62
|
+
def print_hosts(group)
|
63
|
+
@env.ui.info("Hosts in #{group} group:")
|
64
|
+
|
65
|
+
with_target_vms do |machine|
|
66
|
+
if machine.config.dotvm_group.groups.key?(group)
|
67
|
+
if machine.config.dotvm_group.groups[group].to_a.include? machine.name.to_s
|
68
|
+
@env.ui.info(" - #{machine.name}")
|
69
|
+
end
|
70
|
+
else
|
71
|
+
@env.ui.warn('No hosts associated.')
|
72
|
+
break
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end # print_hosts
|
76
|
+
|
77
|
+
def do_action(action, options, group)
|
78
|
+
with_target_vms do |machine|
|
79
|
+
if machine.config.dotvm_group.groups.key?(group)
|
80
|
+
if machine.config.dotvm_group.groups[group].include? machine.name.to_s
|
81
|
+
machine.action(action, **options)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end # do_action
|
86
|
+
|
87
|
+
def all_groups
|
88
|
+
groups = Set.new
|
89
|
+
|
90
|
+
with_target_vms do |machine|
|
91
|
+
machine.config.dotvm_group.groups.to_h.each do |group_name, _hosts|
|
92
|
+
groups << group_name
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
groups.to_a
|
97
|
+
end # all_groups
|
98
|
+
|
99
|
+
def find_groups(pattern)
|
100
|
+
groups = []
|
101
|
+
|
102
|
+
if pattern[0] == '/' && pattern[-1] == '/'
|
103
|
+
reg = Regexp.new(pattern[1..-2])
|
104
|
+
all_groups.each do |item|
|
105
|
+
groups << item if item.match(reg)
|
106
|
+
end
|
107
|
+
else
|
108
|
+
all_groups.each do |item|
|
109
|
+
groups << item if item == pattern
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
groups
|
114
|
+
end # find_groups
|
115
|
+
end # Command
|
116
|
+
end # Group
|
117
|
+
end # Dotvm
|
118
|
+
end # VagrantPlugins
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Dotvm
|
3
|
+
module Group
|
4
|
+
class Config < Vagrant.plugin(2, :config)
|
5
|
+
attr_accessor :groups
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@groups = UNSET_VALUE
|
9
|
+
end
|
10
|
+
|
11
|
+
def finalize!
|
12
|
+
@groups = {} if @groups == UNSET_VALUE
|
13
|
+
end
|
14
|
+
end # Config
|
15
|
+
end # Group
|
16
|
+
end # Dotvm
|
17
|
+
end # VagrantPlugins
|
@@ -70,13 +70,11 @@ module VagrantPlugins
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def inject_groups(machine_cfg, vc)
|
73
|
-
|
74
|
-
|
75
|
-
vc.group.groups = {} unless vc.group.groups.is_a?(Hash)
|
73
|
+
vc.dotvm_group.groups = {} unless vc.dotvm_group.groups.is_a?(Hash)
|
76
74
|
|
77
75
|
machine_cfg.groups.to_a.each do |group|
|
78
|
-
vc.
|
79
|
-
vc.
|
76
|
+
vc.dotvm_group.groups[group] = [] unless vc.dotvm_group.groups.key?(group)
|
77
|
+
vc.dotvm_group.groups[group] << machine_cfg.nick
|
80
78
|
end
|
81
79
|
end
|
82
80
|
|
data/lib/vagrant-dotvm/plugin.rb
CHANGED
@@ -8,6 +8,16 @@ module VagrantPlugins
|
|
8
8
|
require_relative 'command'
|
9
9
|
Command
|
10
10
|
end
|
11
|
+
|
12
|
+
command(:group) do
|
13
|
+
require_relative 'group/command'
|
14
|
+
Group::Command
|
15
|
+
end
|
16
|
+
|
17
|
+
config(:dotvm_group) do
|
18
|
+
require_relative 'group/config'
|
19
|
+
Group::Config
|
20
|
+
end
|
11
21
|
end # Plugin
|
12
22
|
end # Dotvm
|
13
23
|
end # VagrantPlugins
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-dotvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.38.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Magosa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,6 +70,8 @@ files:
|
|
70
70
|
- lib/vagrant-dotvm/config/run.rb
|
71
71
|
- lib/vagrant-dotvm/config/sharedfolder.rb
|
72
72
|
- lib/vagrant-dotvm/dotvm.rb
|
73
|
+
- lib/vagrant-dotvm/group/command.rb
|
74
|
+
- lib/vagrant-dotvm/group/config.rb
|
73
75
|
- lib/vagrant-dotvm/injector/abstractinjector.rb
|
74
76
|
- lib/vagrant-dotvm/injector/authorizedkey.rb
|
75
77
|
- lib/vagrant-dotvm/injector/host.rb
|
@@ -109,9 +111,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
111
|
version: '0'
|
110
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
113
|
requirements:
|
112
|
-
- - "
|
114
|
+
- - ">"
|
113
115
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
116
|
+
version: 1.3.1
|
115
117
|
requirements: []
|
116
118
|
rubyforge_project:
|
117
119
|
rubygems_version: 2.4.5.1
|