vagrant-dotvm 0.37.0 → 0.38.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c6f250ffa0d016a0f77aebecb935c60a6bf6404
4
- data.tar.gz: a475da352ae92757cae54c2c32c1d513a231d074
3
+ metadata.gz: 546eb0a4d4130f0321c5958da2e8a8210dfd193d
4
+ data.tar.gz: 99856b339b3bf669c834a1863415a1d6a1e62b78
5
5
  SHA512:
6
- metadata.gz: 54f0910f3a80bc6f40f8b0d589a86be42e503b3d10311e4fe3b82984364bc94fdd78225ad77e52d61e009fb8db7dbd57a9e7a16ae1095e4f17367b8421bcd54e
7
- data.tar.gz: cc2af37e215d3b87ae993ca494df52dbfcb7f6f06cc2603fe7e17f058adfa41bf4146e8d807c3ef35914c3ed0defbca888a6d091acd5cc795337c262777e7067
6
+ metadata.gz: c6892a28599974ad49a9a86fafc2e4a11ff51ede778ea74f5a99f36e804f5b8dd07ed458e89886999333dec4b978d57111b6b93bf73855aa1b3435a5efd0d592
7
+ data.tar.gz: b96acaf5f2f054dcf764adbb81cd6fc424a0f0962f44a4acf7e77188b1baae2aef840fa344946573144709785ab531d8db6ec04fffc05fd8828b6fce4373aebe
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- # 0.37.0 (upcoming)
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
@@ -7,6 +7,4 @@ end
7
7
 
8
8
  group :plugins do
9
9
  gemspec
10
- gem 'vagrant-group',
11
- git: 'git://github.com/krzysztof-magosa/vagrant-group.git'
12
10
  end
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).
@@ -122,6 +122,8 @@ module VagrantPlugins
122
122
  attr_accessor :recipes # chef
123
123
  attr_accessor :roles # chef
124
124
  attr_accessor :pillar
125
+ attr_accessor :force_remote_user # ansible
126
+ attr_accessor :env # shell
125
127
 
126
128
  attr_accessor :images
127
129
  attr_reader :build_images
@@ -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
- return false unless Vagrant.has_plugin?('vagrant-group')
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.group.groups[group] = [] unless vc.group.groups.key?(group)
79
- vc.group.groups[group] << machine_cfg.nick
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
 
@@ -122,7 +122,9 @@ module VagrantPlugins
122
122
  :delete_node,
123
123
  :delete_client,
124
124
  :recipe,
125
- :images
125
+ :images,
126
+ :force_remote_user,
127
+ :env
126
128
  ]
127
129
 
128
130
  RUNS_OPTIONS = [
@@ -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
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Dotvm
3
- VERSION = '0.37.0'
3
+ VERSION = '0.38.0.pre'
4
4
  end
5
5
  end
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.37.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: 2015-11-23 00:00:00.000000000 Z
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: '0'
116
+ version: 1.3.1
115
117
  requirements: []
116
118
  rubyforge_project:
117
119
  rubygems_version: 2.4.5.1