kitchen-poolsclosed 0.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f29a77ca06a66e26349e9fa6d43108df3c34ddfc
4
+ data.tar.gz: e098666628ddcd1a6d4877f968f7c29bc176093f
5
+ SHA512:
6
+ metadata.gz: 1c6b9355cdb1d8b5537907980092e8e0e242fb5181e7852b8deb2c1c020148254187488e7df332b0d58ccb26de0894bb2f5c5a35f45ae9ba30bc8639cb7ef00b
7
+ data.tar.gz: 632daf0788ec1c1668f655894a7b1967e25b6c8522ea473a599f0992b1b5d936150bc273a7cc860d76697ceeab2da5c5add00b0cbb21ffae849f140f3dca749d
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kitchen-poolsclosed.gemspec
4
+ gemspec
5
+ gem 'kitchen'
6
+ gem 'webmock'
7
+ gem 'pry-byebug'
8
+ gem 'rest-client'
data/Gemfile.lock ADDED
@@ -0,0 +1,83 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ kitchen-poolsclosed (0.0.0.1)
5
+ test-kitchen (~> 1.4, >= 1.4.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.4.0)
11
+ artifactory (2.5.0)
12
+ byebug (9.0.6)
13
+ coderay (1.1.1)
14
+ crack (0.4.3)
15
+ safe_yaml (~> 1.0.0)
16
+ domain_name (0.5.20160826)
17
+ unf (>= 0.0.5, < 1.0.0)
18
+ hashdiff (0.3.0)
19
+ http-cookie (1.0.3)
20
+ domain_name (~> 0.5)
21
+ kitchen (0.0.3)
22
+ method_source (0.8.2)
23
+ mime-types (3.1)
24
+ mime-types-data (~> 3.2015)
25
+ mime-types-data (3.2016.0521)
26
+ mixlib-install (2.1.4)
27
+ artifactory
28
+ mixlib-shellout
29
+ mixlib-versioning
30
+ thor
31
+ mixlib-shellout (2.2.7)
32
+ mixlib-versioning (1.1.0)
33
+ net-scp (1.2.1)
34
+ net-ssh (>= 2.6.5)
35
+ net-ssh (3.2.0)
36
+ net-ssh-gateway (1.2.0)
37
+ net-ssh (>= 2.6.5)
38
+ netrc (0.11.0)
39
+ pry (0.10.4)
40
+ coderay (~> 1.1.0)
41
+ method_source (~> 0.8.1)
42
+ slop (~> 3.4)
43
+ pry-byebug (3.4.0)
44
+ byebug (~> 9.0)
45
+ pry (~> 0.10)
46
+ rake (10.5.0)
47
+ rest-client (2.0.0)
48
+ http-cookie (>= 1.0.2, < 2.0)
49
+ mime-types (>= 1.16, < 4.0)
50
+ netrc (~> 0.8)
51
+ safe_yaml (1.0.4)
52
+ slop (3.6.0)
53
+ test-kitchen (1.13.2)
54
+ mixlib-install (>= 1.2, < 3.0)
55
+ mixlib-shellout (>= 1.2, < 3.0)
56
+ net-scp (~> 1.1)
57
+ net-ssh (>= 2.9, < 4.0)
58
+ net-ssh-gateway (~> 1.2.0)
59
+ safe_yaml (~> 1.0)
60
+ thor (~> 0.18)
61
+ thor (0.19.1)
62
+ unf (0.1.4)
63
+ unf_ext
64
+ unf_ext (0.0.7.2)
65
+ webmock (2.1.0)
66
+ addressable (>= 2.3.6)
67
+ crack (>= 0.3.2)
68
+ hashdiff
69
+
70
+ PLATFORMS
71
+ ruby
72
+
73
+ DEPENDENCIES
74
+ bundler (~> 1.12)
75
+ kitchen
76
+ kitchen-poolsclosed!
77
+ pry-byebug
78
+ rake (~> 10.0)
79
+ rest-client
80
+ webmock
81
+
82
+ BUNDLED WITH
83
+ 1.13.6
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 Chris Evett
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Kitchen::Poolsclosed
2
+
3
+ ![](http://i.imgur.com/QnCGPzK.png)
4
+
5
+ [test-kitchen](www.kitchen.ci) Plugin for [poolsclosed](www.github.com/chrisevett/poolsclosed)
6
+
7
+
8
+ ## Installation
9
+
10
+ $ gem install kitchen-poolsclosed
11
+
12
+ ## .kitchen.yml config
13
+ driver:
14
+ name: poolsclosed
15
+ poolsclosed_baseurl: http://path.tomy.rundeck.com/
16
+
17
+ transport:
18
+ name: winrm
19
+ username: administrator
20
+ password: mysupersecretpassword
21
+
22
+ Note: this currently only supports windows. Yes the bit that touches the operating system is independent of this driver. Don't ask questions.
23
+
24
+ ## Contributing
25
+
26
+ Pull requests welcome [https://github.com/chrisevett/kitchen-poolsclosed](https://github.com/chrisevett/kitchen-poolsclosed)
27
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+ task default: :spec
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kitchen/driver/poolsclosed_version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kitchen-poolsclosed'
8
+ spec.version = Kitchen::Driver::POOLSCLOSED_VERSION
9
+ spec.authors = ['chris evett']
10
+ spec.email = ['chris.evett@gmail.com']
11
+
12
+ spec.summary = 'test-kitchen integration for poolsclosed'
13
+ spec.description = 'https://github.com/chrisevett/poolsclosed'
14
+ spec.homepage = 'https://github.com/chrisevett/kitchen-poolsclosed'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.12'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_dependency 'test-kitchen', '~> 1.4', '>= 1.4.1'
24
+ end
@@ -0,0 +1,96 @@
1
+ # idk why this is needed, there is a file in test kitchen that does this
2
+ # for some reason my project isnt being aggreeable without it
3
+ require 'pathname'
4
+ require 'thread'
5
+
6
+ require 'kitchen/errors'
7
+ require 'kitchen/logger'
8
+ require 'kitchen/logging'
9
+ require 'kitchen/shell_out'
10
+ require 'kitchen/configurable'
11
+ require 'kitchen/util'
12
+
13
+ require 'kitchen/provisioner'
14
+ require 'kitchen/provisioner/base'
15
+ require 'kitchen/color'
16
+ require 'kitchen/collection'
17
+ require 'kitchen/config'
18
+ require 'kitchen/data_munger'
19
+ require 'kitchen/driver'
20
+ require 'kitchen/driver/base'
21
+ require 'kitchen/driver/ssh_base'
22
+ require 'kitchen/driver/proxy'
23
+ require 'kitchen/instance'
24
+ require 'kitchen/transport'
25
+ require 'kitchen/transport/base'
26
+ require 'kitchen/loader/yaml'
27
+ require 'kitchen/metadata_chopper'
28
+ require 'kitchen/platform'
29
+ require 'kitchen/state_file'
30
+ require 'kitchen/ssh'
31
+ require 'kitchen/suite'
32
+ require 'kitchen/verifier'
33
+ require 'kitchen/verifier/base'
34
+ require 'kitchen/version'
35
+ require 'rubygems'
36
+ require 'kitchen'
37
+
38
+ require 'rest-client'
39
+ require 'pry-byebug'
40
+ require 'kitchen/driver/poolsclosed_version'
41
+
42
+ module Kitchen
43
+ module Driver
44
+ class Poolsclosed < Kitchen::Driver::Base
45
+ kitchen_driver_api_version 2
46
+ plugin_version Kitchen::Driver::POOLSCLOSED_VERSION
47
+
48
+ required_config :poolsclosed_baseurl
49
+ no_parallel_for :create, :destroy
50
+
51
+ # this is defined in the base plugin
52
+ def create(state)
53
+ # we are checking the config here instead of when the class is loaded because
54
+ # test-kitchen doesn't have the platform object instantiated until we call create
55
+ raise Kitchen::UserError, /Error. Only windows is supported./ unless windows_os?
56
+ puts 'before newhost'
57
+ newhost = poolsclosed_machine
58
+ raise Kitchen::InstanceFailure, /Error, no available instances in poolsclosed/ if newhost.nil?
59
+ state[:hostname] = newhost
60
+ end
61
+
62
+ def poolsclosed_machine
63
+ RestClient::Request.new(method: :get,
64
+ url: "#{config[:poolsclosed_baseurl]}machine",
65
+ headers: { content_type: :json }).execute do |rsp, _request, _result|
66
+ case rsp.code
67
+ when 200
68
+ JSON.parse(rsp.body)['machineRelease']
69
+ else
70
+ raise Kitchen::InstanceFailure, "Error, could not obtain machine name from poolsclosed. Error code #{rsp.code}"
71
+ end
72
+ end
73
+ end
74
+
75
+ # this will generate false positives, but poolsclosed should handle it
76
+ def destroy(state)
77
+ hostname = state[:hostname]
78
+ poolsclosed_delete(hostname)
79
+ state.delete(:hostname)
80
+ end
81
+
82
+ def poolsclosed_delete(hostname)
83
+ RestClient::Request.new(method: :delete,
84
+ url: "#{config[:poolsclosed_baseurl]}machine",
85
+ headers: { content_type: :json, params: { machineName: hostname } }).execute do |rsp, _request, _result|
86
+ case rsp.code
87
+ when 200
88
+ JSON.parse(rsp.body)['machineDelete']
89
+ else
90
+ raise Kitchen::InstanceFailure, "Error, could not delete machine from poolsclosed. Error code #{rsp.code}"
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,5 @@
1
+ module Kitchen
2
+ module Driver
3
+ POOLSCLOSED_VERSION = '0.0.0.1'.freeze
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kitchen-poolsclosed
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - chris evett
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-10-30 00:00:00.000000000 Z
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.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-kitchen
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.4'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.4.1
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '1.4'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.4.1
61
+ description: https://github.com/chrisevett/poolsclosed
62
+ email:
63
+ - chris.evett@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - ".gitignore"
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - LICENSE
72
+ - README.md
73
+ - Rakefile
74
+ - kitchen-poolsclosed.gemspec
75
+ - lib/kitchen/driver/poolsclosed.rb
76
+ - lib/kitchen/driver/poolsclosed_version.rb
77
+ homepage: https://github.com/chrisevett/kitchen-poolsclosed
78
+ licenses: []
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.5.1
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: test-kitchen integration for poolsclosed
100
+ test_files: []