vagrant-kick 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.6.4"
12
+ gem "rcov", ">= 0"
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.6.4)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.9.2.2)
10
+ rcov (0.9.11)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.6.4)
19
+ rcov
20
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Tom De Vylder
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ ### Basic usage
2
+ $ ls vagrantproject/
3
+ Vagrantfile
4
+ tests/
5
+
6
+ $ ls tests/
7
+ node01.local
8
+ node01.ssh
9
+ node02.local
10
+ node02.ssh
11
+
12
+ $ cat tests/node01.local
13
+ check_http -H 192.168.1.10 -p 80
14
+
15
+ $ cat tests/node01.ssh
16
+ uptime
17
+ facter puppetversion
18
+ facter facterversion
19
+
20
+ $ vagrant kick
21
+ [node01] REMOTE
22
+ [node01] uptime
23
+ [node01] 23:47:27 up 2:36, 0 users, load average: 0.00, 0.00, 0.00
24
+ [node01]
25
+ [node01] facter puppetversion
26
+ [node01] 2.6.6
27
+ [node01]
28
+ [node01] facter facterversion
29
+ [node01] 1.6.0
30
+
31
+ [node01] LOCAL
32
+ [node01] check_http -H 192.168.1.10 -p 80
33
+ CRITICAL - Socket timeout after 10 seconds
34
+
35
+
36
+ ### Local tests
37
+ Anything inside $vmname.local will be executed on your local workstation.
38
+ This could be used to test if certain ports or services are exposed from the virtual machine using e.g. Nagios plugins or nmap.
39
+
40
+
41
+ ### Remote tests
42
+ Anything you put inside $vmname.local will be executed on your vm called $vmname, using SSH.
43
+ The following test...
44
+
45
+ $ cat tests/node01.ssh
46
+ uptime
47
+
48
+ would return the same output as...
49
+
50
+ $ ssh 192.168.1.10 "uptime"
51
+
52
+
53
+ ### Installation
54
+ $ rake install
55
+ $ ls pkg/
56
+ vagrant-kick-0.0.1.gem
57
+ $ sudo gem install pkg/vagrant-kick-0.0.1.gem
58
+
59
+ or
60
+
61
+ $ sudo rake install
62
+
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = vagrant-kick
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to vagrant-kick
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2011 Tom De Vylder. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "vagrant-kick"
18
+ gem.homepage = "https://github.com/arioch/vagrant-kick"
19
+ gem.license = "GPL2"
20
+ gem.summary = %Q{Vagrant plugin to kick off tests}
21
+ gem.description = %Q{Vagrant plugin to kick off a bunch of predefined tests}
22
+ gem.email = "tom@penumbra.be"
23
+ gem.authors = ["Tom De Vylder"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,51 @@
1
+ module Vagrant
2
+ module Command
3
+ class KickCommand < NamedBase
4
+ register "kick", "Run a number of predefined tests"
5
+
6
+ def execute
7
+ target_vms.each do |vm|
8
+ if vm.created?
9
+ if !vm.vm.accessible?
10
+ raise Errors::VMInaccessible
11
+ elsif vm.vm.running?
12
+ puts
13
+ # refactor in progress
14
+ puts "[#{vm.name}] REMOTE"
15
+ File.open("tests/#{vm.name}.ssh", "r").each do |infile|
16
+ commands = infile
17
+
18
+ vm.ssh.execute do |ssh|
19
+ ssh.sudo!(commands) do |channel, type, data|
20
+ puts
21
+ ssh.check_exit_status(data, commands) if type == :exit_status
22
+ vm.env.ui.info(infile) if type != :exit_status
23
+ vm.env.ui.info(data) if type != :exit_status
24
+ #vm.env.ui.info("") if type != :exit_status
25
+ end
26
+ end
27
+ end
28
+
29
+ puts
30
+ system "./tests/#{vm.name}.local"
31
+
32
+ puts "[#{vm.name}] LOCAL"
33
+ File.open("tests/#{vm.name}.local", "r").each do |infile|
34
+ puts "[#{vm.name}] #{infile}"
35
+ system "#{infile}"
36
+ end
37
+
38
+ else
39
+ vm.env.ui.info I18n.t("vagrant.commands.common.vm_not_running")
40
+ end
41
+ else
42
+ vm.env.ui.info I18n.t("vagrant.commands.common.vm_not_created")
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ # TODO:
51
+ # - catch exit status for each test
@@ -0,0 +1,6 @@
1
+ begin
2
+ require 'vagrant-kick'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'vagrant-kick'
6
+ end
@@ -0,0 +1,60 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "vagrant-kick"
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Tom De Vylder"]
12
+ s.date = "2011-12-27"
13
+ s.description = "Small plugin to fire a bunch of tests against your vm's"
14
+ s.email = "tom@penumbra.be"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/vagrant-kick.rb",
28
+ "lib/vagrant_init.rb",
29
+ "test/helper.rb",
30
+ "test/test_vagrant-kick.rb",
31
+ "vagrant-kick.gemspec"
32
+ ]
33
+ s.homepage = "http://github.com/arioch/vagrant-kick"
34
+ s.licenses = ["GPL2"]
35
+ s.require_paths = ["lib"]
36
+ s.rubygems_version = "1.8.13"
37
+ s.summary = "one-line summary of your gem"
38
+
39
+ if s.respond_to? :specification_version then
40
+ s.specification_version = 3
41
+
42
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
44
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
45
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
46
+ s.add_development_dependency(%q<rcov>, [">= 0"])
47
+ else
48
+ s.add_dependency(%q<shoulda>, [">= 0"])
49
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
50
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
51
+ s.add_dependency(%q<rcov>, [">= 0"])
52
+ end
53
+ else
54
+ s.add_dependency(%q<shoulda>, [">= 0"])
55
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
56
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
57
+ s.add_dependency(%q<rcov>, [">= 0"])
58
+ end
59
+ end
60
+
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-kick
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Tom De Vylder
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-12-27 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ requirement: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 3
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ version_requirements: *id001
31
+ name: shoulda
32
+ prerelease: false
33
+ type: :development
34
+ - !ruby/object:Gem::Dependency
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ hash: 23
41
+ segments:
42
+ - 1
43
+ - 0
44
+ - 0
45
+ version: 1.0.0
46
+ version_requirements: *id002
47
+ name: bundler
48
+ prerelease: false
49
+ type: :development
50
+ - !ruby/object:Gem::Dependency
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ hash: 7
57
+ segments:
58
+ - 1
59
+ - 6
60
+ - 4
61
+ version: 1.6.4
62
+ version_requirements: *id003
63
+ name: jeweler
64
+ prerelease: false
65
+ type: :development
66
+ - !ruby/object:Gem::Dependency
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ version_requirements: *id004
77
+ name: rcov
78
+ prerelease: false
79
+ type: :development
80
+ description: Vagrant plugin to kick off a bunch of predefined tests
81
+ email: tom@penumbra.be
82
+ executables: []
83
+
84
+ extensions: []
85
+
86
+ extra_rdoc_files:
87
+ - LICENSE.txt
88
+ - README.md
89
+ - README.rdoc
90
+ files:
91
+ - .document
92
+ - Gemfile
93
+ - Gemfile.lock
94
+ - LICENSE.txt
95
+ - README.md
96
+ - README.rdoc
97
+ - Rakefile
98
+ - VERSION
99
+ - lib/vagrant-kick.rb
100
+ - lib/vagrant_init.rb
101
+ - vagrant-kick.gemspec
102
+ homepage: https://github.com/arioch/vagrant-kick
103
+ licenses:
104
+ - GPL2
105
+ post_install_message:
106
+ rdoc_options: []
107
+
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ hash: 3
116
+ segments:
117
+ - 0
118
+ version: "0"
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ requirements: []
129
+
130
+ rubyforge_project:
131
+ rubygems_version: 1.8.13
132
+ signing_key:
133
+ specification_version: 3
134
+ summary: Vagrant plugin to kick off tests
135
+ test_files: []
136
+