vagrant-bundlewrap 0.1.5 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0425eb9a9cb559feea955746ed73bf78a9a8a5fd
4
- data.tar.gz: fe15190cbb7dcc968f26af40ca477efd3854c0fd
3
+ metadata.gz: c3e5ba1df7f6d499f781efa407ee469a95f819ec
4
+ data.tar.gz: d2c9d5a5c06c1bc1dba794ccbf4f06b61ed36125
5
5
  SHA512:
6
- metadata.gz: 7fdb4736cc92f7875abbc6de34eaaa5a5e6f5f44ad0219909cd69da569fb8b5f2d046da53ae3f61409d7f1be8102dc02c3d2d4e79d31274dc1ccecd39557aaec
7
- data.tar.gz: 7c77d0e3d0608b3d6ccf48ef1441e239ec0815ff48aab071713791a7c571b03a686ce373adc3f595dd2a77100b32c6390bbcf737ab5632c108d33d2cec7a7420
6
+ metadata.gz: 1b0bc5e696ff8e20468fd93a55b15873b9c1f1b876443e7aba7d9e2979ce4b0d4a7a690ba73fc3fe0e01b6480df7e84f2ff799799203c362b8e99d20c7023835
7
+ data.tar.gz: 7fd00cbf3063511039687a9386b82f1fcf44a86499f7e08f3ee5d1f835d59b29a49df4a8b3540073dbc9e6498cf29bc0964912a78f2dc0b56b6bf67972064b25
data/Gemfile CHANGED
@@ -1,7 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
-
5
- group :development do
6
- gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
7
- end
data/Rakefile CHANGED
@@ -1,3 +1,3 @@
1
- require "bundler/gem_tasks"
1
+ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  Bundler::GemHelper.install_tasks
@@ -1,43 +1,46 @@
1
1
  module VagrantPlugins
2
- module BundleWrap
3
- class BwManage
2
+ module BundleWrap
3
+ class BwManage
4
4
 
5
- def initialize(repo_path)
6
- @repo_path = repo_path
7
- end
5
+ def initialize(repo_path)
6
+ @repo_path = repo_path
7
+ end
8
8
 
9
- def bw_cli(params, ret_stdout=true)
10
- params = params.gsub(/[^a-zA-Z0-9\-\_\.\s]/,'')
11
- old_path = Dir.pwd
12
- Dir.chdir(@repo_path)
13
- if ret_stdout
14
- result = `bw #{params}`
15
- else
16
- result = system("bw #{params}")
17
- end
18
- Dir.chdir(old_path)
19
- return result
20
- end
9
+ def bw_cli(params, ret_stdout=true)
10
+ params = params.gsub(/[^a-zA-Z0-9\-\_\.\s]/,'')
11
+ old_path = Dir.pwd
12
+ Dir.chdir(@repo_path)
13
+ if ret_stdout
14
+ result = `bw #{params}`
15
+ else
16
+ result = system("bw #{params}")
17
+ end
18
+ Dir.chdir(old_path)
19
+ return result
20
+ end
21
21
 
22
- def nodes()
23
- nodes = bw_cli("nodes")
24
- return nodes.split("\n")
25
- end
22
+ def nodes()
23
+ nodes = bw_cli("nodes")
24
+ return nodes.split("\n")
25
+ end
26
26
 
27
- def node_hosts()
28
- nodes = bw_cli("nodes --hostname")
29
- return nodes.split("\n")
30
- end
27
+ def node_hosts()
28
+ nodes = bw_cli("nodes --hostname")
29
+ return nodes.split("\n")
30
+ end
31
31
 
32
- def apply(node, interactive=false)
33
- node = node.gsub(/[^a-zA-Z0-9\-\_\.]/,'')
34
- if interactive
35
- return bw_cli("apply #{node} -i", ret_stdout=false)
36
- else
37
- return bw_cli("apply #{node}", ret_stdout=false)
38
- end
39
- end
40
-
41
- end
42
- end
32
+ def apply(node, debug=false, interactive=false)
33
+ node = node.gsub(/[^a-zA-Z0-9\-\_\.]/,'')
34
+ cmd = "--add-host-keys "
35
+ if debug
36
+ cmd = cmd + "--debug "
37
+ end
38
+ cmd = cmd + "apply "
39
+ if interactive
40
+ cmd = cmd + "--interactive "
41
+ end
42
+ return bw_cli(cmd + node, ret_stdout=false)
43
+ end
44
+ end
45
+ end
43
46
  end
@@ -1,46 +1,48 @@
1
1
  module VagrantPlugins
2
- module BundleWrap
3
- class Config < Vagrant.plugin("2", :config)
4
- attr_accessor :repo_path
5
- attr_accessor :node_name
6
- attr_accessor :node_host
7
- attr_accessor :interactive
8
-
9
-
10
- def initialize
11
- @repo_path = UNSET_VALUE
12
- @node_name = UNSET_VALUE
13
- @node_host = UNSET_VALUE
14
- @interactive = UNSET_VALUE
15
- end
16
-
17
- def finalize!
18
- @repo_path = "bundlewrap/" if @repo_path == UNSET_VALUE
19
- @node_name = nil if @node_name == UNSET_VALUE
20
- @node_host = nil if @node_host == UNSET_VALUE
21
- @interactive = false if @interactive == UNSET_VALUE
22
- end
23
-
24
- def validate(machine)
25
- errors = _detected_errors
26
-
27
- unless File.directory?(repo_path) and File.exist?("#{repo_path}/nodes.py") and File.exist?("#{repo_path}/groups.py")
28
- errors << "BundleWrap repository is missing in repo_path='#{repo_path}'.\n" +
29
- " Create a new one with 'bw repo create'."
30
- end
31
-
32
- unless @node_name
33
- errors << "BundleWrap config 'node_name' is not set. Use the node name from your BundleWrap nodes.py."
34
- end
35
-
36
- unless @node_host
37
- errors << "BundleWrap config 'node_host' is not set. Use the node host from your BundleWrap nodes.py.\n" +
38
- " This does not have to be a valid host name (e.g. 'node1.vm'), but it should be a unique one,\n" +
39
- " because it will be written in your ssh config file."
40
- end
41
-
42
- { "vagrant-bundlewrap" => errors }
43
- end
44
- end
45
- end
46
- end
2
+ module BundleWrap
3
+ class Config < Vagrant.plugin("2", :config)
4
+ attr_accessor :repo_path
5
+ attr_accessor :node_name
6
+ attr_accessor :node_host
7
+ attr_accessor :debug
8
+ attr_accessor :interactive
9
+
10
+ def initialize
11
+ @repo_path = UNSET_VALUE
12
+ @node_name = UNSET_VALUE
13
+ @node_host = UNSET_VALUE
14
+ @interactive = UNSET_VALUE
15
+ @debug = UNSET_VALUE
16
+ end
17
+
18
+ def finalize!
19
+ @repo_path = "bundlewrap/" if @repo_path == UNSET_VALUE
20
+ @node_name = nil if @node_name == UNSET_VALUE
21
+ @node_host = nil if @node_host == UNSET_VALUE
22
+ @debug = false if @debug == UNSET_VALUE
23
+ @interactive = false if @interactive == UNSET_VALUE
24
+ end
25
+
26
+ def validate(machine)
27
+ errors = _detected_errors
28
+
29
+ unless File.directory?(repo_path) and File.exist?("#{repo_path}/nodes.py") and File.exist?("#{repo_path}/groups.py")
30
+ errors << "BundleWrap repository is missing in repo_path='#{repo_path}'.\n" +
31
+ " Create a new one with 'bw repo create'."
32
+ end
33
+
34
+ unless @node_name
35
+ errors << "BundleWrap config 'node_name' is not set. Use the node name from your BundleWrap nodes.py."
36
+ end
37
+
38
+ unless @node_host
39
+ errors << "BundleWrap config 'node_host' is not set. Use the node host from your BundleWrap nodes.py.\n" +
40
+ " This does not have to be a valid host name (e.g. 'node1.vm'), but it should be a unique one,\n" +
41
+ " because it will be written in your ssh config file."
42
+ end
43
+
44
+ { "vagrant-bundlewrap" => errors }
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,19 +1,19 @@
1
1
  require "vagrant"
2
2
 
3
3
  module VagrantPlugins
4
- module BundleWrap
5
- class Plugin < Vagrant.plugin("2")
6
- name "vagrant-bundlewrap"
4
+ module BundleWrap
5
+ class Plugin < Vagrant.plugin("2")
6
+ name "vagrant-bundlewrap"
7
7
 
8
- config(:bundlewrap, :provisioner) do
9
- require_relative "config"
10
- Config
11
- end
8
+ config(:bundlewrap, :provisioner) do
9
+ require_relative "config"
10
+ Config
11
+ end
12
12
 
13
- provisioner(:bundlewrap) do
14
- require_relative "provisioner"
15
- Provisioner
16
- end
17
- end
18
- end
13
+ provisioner(:bundlewrap) do
14
+ require_relative "provisioner"
15
+ Provisioner
16
+ end
17
+ end
18
+ end
19
19
  end
@@ -3,30 +3,29 @@ require_relative "bwmanage"
3
3
  require_relative "sshconf"
4
4
 
5
5
  module VagrantPlugins
6
- module BundleWrap
7
- class Provisioner < Vagrant.plugin("2", :provisioner)
6
+ module BundleWrap
7
+ class Provisioner < Vagrant.plugin("2", :provisioner)
8
8
 
9
- def initialize(machine, config)
10
- super(machine, config)
11
- @logger = Log4r::Logger.new("vagrant::provisioners::bundlewrap")
12
- end
9
+ def initialize(machine, config)
10
+ super(machine, config)
11
+ @logger = Log4r::Logger.new("vagrant::provisioners::bundlewrap")
12
+ end
13
13
 
14
- def configure(root_config)
15
- end
14
+ def configure(root_config)
15
+ end
16
16
 
17
- def provision
18
- ssh = SshConf.new
19
- ssh.update(config.node_host, @machine.ssh_info)
20
- bw = BwManage.new(config.repo_path)
21
- bw.apply(config.node_name, config.interactive)
22
- end
17
+ def provision
18
+ ssh = SshConf.new
19
+ ssh.update(config.node_host, @machine.ssh_info)
20
+ bw = BwManage.new(config.repo_path)
21
+ bw.apply(config.node_name, config.debug, config.interactive)
22
+ end
23
23
 
24
- def cleanup
25
- bw = BwManage.new(config.repo_path)
26
- ssh = SshConf.new
27
- ssh.remove_hosts(bw.node_hosts)
28
- end
29
-
30
- end
31
- end
32
- end
24
+ def cleanup
25
+ bw = BwManage.new(config.repo_path)
26
+ ssh = SshConf.new
27
+ ssh.remove_hosts(bw.node_hosts)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,63 +1,62 @@
1
1
  require "ssh-config"
2
2
 
3
3
  module VagrantPlugins
4
- module BundleWrap
5
- class SshConf
6
-
7
- def initialize()
8
- touch()
9
- @ssh_config = ConfigFile.new
10
- end
11
-
12
- def touch()
13
- unless File.directory?(ENV['HOME'] + "/.ssh")
14
- FileUtils.mkdir_p(ENV['HOME'] + "/.ssh")
15
- end
16
- FileUtils.touch(ENV['HOME'] + "/.ssh/config")
17
- end
18
-
19
- def update(host, ssh_info)
20
- @ssh_config.set(host, 'HostName', ssh_info[:host])
21
- @ssh_config.set(host, 'Port', ssh_info[:port])
22
- @ssh_config.set(host, 'User', ssh_info[:username])
23
-
24
- ssh_keys = ssh_info[:private_key_path]
25
- ssh_keys.each do |ssh_key|
26
- @ssh_config.set(host, 'IdentityFile', ssh_key)
27
- end
28
-
29
- if ssh_info[:forward_agent]
30
- @ssh_config.set(host, 'ForwardAgent', 'yes')
31
- end
32
-
33
- if ssh_info[:forward_x11]
34
- @ssh_config.set(host, 'ForwardX11', 'yes')
35
- end
36
-
37
- if ssh_info[:proxy_command]
38
- @ssh_config.set(host, 'ProxyCommand', ssh_info[:proxy_command])
39
- end
40
-
41
- @ssh_config.set(host, 'UserKnownHostsFile', '/dev/null')
42
- @ssh_config.set(host, 'StrictHostKeyChecking', 'no')
43
- @ssh_config.set(host, 'PasswordAuthentication', 'no')
44
- @ssh_config.set(host, 'IdentitiesOnly', 'yes')
45
- @ssh_config.set(host, 'LogLevel', 'FATAL')
46
-
47
- @ssh_config.save()
48
- end
49
-
50
- def remove_host(host)
51
- @ssh_config.rm!(host)
52
- end
53
-
54
- def remove_hosts(hosts)
55
- hosts.each do |host|
56
- @ssh_config.rm(host)
57
- end
58
- @ssh_config.save()
59
- end
60
-
61
- end
62
- end
4
+ module BundleWrap
5
+ class SshConf
6
+
7
+ def initialize()
8
+ touch()
9
+ @ssh_config = ConfigFile.new
10
+ end
11
+
12
+ def touch()
13
+ unless File.directory?(ENV['HOME'] + "/.ssh")
14
+ FileUtils.mkdir_p(ENV['HOME'] + "/.ssh")
15
+ end
16
+ FileUtils.touch(ENV['HOME'] + "/.ssh/config")
17
+ end
18
+
19
+ def update(host, ssh_info)
20
+ @ssh_config.set(host, 'HostName', ssh_info[:host])
21
+ @ssh_config.set(host, 'Port', ssh_info[:port])
22
+ @ssh_config.set(host, 'User', ssh_info[:username])
23
+
24
+ ssh_keys = ssh_info[:private_key_path]
25
+ ssh_keys.each do |ssh_key|
26
+ @ssh_config.set(host, 'IdentityFile', ssh_key)
27
+ end
28
+
29
+ if ssh_info[:forward_agent]
30
+ @ssh_config.set(host, 'ForwardAgent', 'yes')
31
+ end
32
+
33
+ if ssh_info[:forward_x11]
34
+ @ssh_config.set(host, 'ForwardX11', 'yes')
35
+ end
36
+
37
+ if ssh_info[:proxy_command]
38
+ @ssh_config.set(host, 'ProxyCommand', ssh_info[:proxy_command])
39
+ end
40
+
41
+ @ssh_config.set(host, 'UserKnownHostsFile', '/dev/null')
42
+ @ssh_config.set(host, 'StrictHostKeyChecking', 'no')
43
+ @ssh_config.set(host, 'PasswordAuthentication', 'no')
44
+ @ssh_config.set(host, 'IdentitiesOnly', 'yes')
45
+ @ssh_config.set(host, 'LogLevel', 'FATAL')
46
+
47
+ @ssh_config.save()
48
+ end
49
+
50
+ def remove_host(host)
51
+ @ssh_config.rm!(host)
52
+ end
53
+
54
+ def remove_hosts(hosts)
55
+ hosts.each do |host|
56
+ @ssh_config.rm(host)
57
+ end
58
+ @ssh_config.save()
59
+ end
60
+ end
61
+ end
63
62
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module BundleWrap
3
- VERSION = "0.1.5"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.5"
22
21
  spec.add_development_dependency "rake"
23
22
  spec.add_runtime_dependency "ssh-config", "~> 0.1.3"
24
23
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-bundlewrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Kendinibilir
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-22 00:00:00.000000000 Z
11
+ date: 2016-02-24 00:00:00.000000000 Z
12
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.5'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: '1.5'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement