kitchen-wpar 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.cane +0 -0
- data/.gitignore +18 -0
- data/.tailor +4 -0
- data/.travis.yml +11 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +3 -0
- data/LICENSE +15 -0
- data/README.md +70 -0
- data/Rakefile +21 -0
- data/kitchen-wpar.gemspec +29 -0
- data/lib/kitchen/driver/wpar.rb +117 -0
- data/lib/kitchen/driver/wpar_version.rb +26 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c3db86c30d6693e1afb2814740daeeba20cda896
|
4
|
+
data.tar.gz: 66440895f72bacd569198f0a1c30411b5f7844be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 83c0a7ece5373cb188bf94c6f95af2170c93a7f390d1739ea53448e97c6dd7c923f06aefe8b3a6b71c2b19340205cd198655cf8485a2aa2903346c0836672fac
|
7
|
+
data.tar.gz: aa723e78b5cb0498ee7fb988f9448b9653a5723c3d4fdcfdedfa5c768af9af5230cef3ca0c60a1ebe163008076142edca1d8a431283fd0c7807bc7e6565a4c84
|
data/.cane
ADDED
File without changes
|
data/.gitignore
ADDED
data/.tailor
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Author:: Alain Dejoux (<adejoux@djouxtech.net>)
|
2
|
+
|
3
|
+
Copyright (C) 2016, Alain Dejoux
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# <a name="title"></a> Kitchen::Wpar
|
2
|
+
|
3
|
+
A Test Kitchen Driver for Wpar.
|
4
|
+
|
5
|
+
## <a name="requirements"></a> Requirements
|
6
|
+
|
7
|
+
You need a AIX partition with chef client and sudo installed.
|
8
|
+
|
9
|
+
## <a name="installation"></a> Installation and Setup
|
10
|
+
|
11
|
+
Please read the [Driver usage][driver_usage] page for more details.
|
12
|
+
|
13
|
+
## <a name="config"></a> Configuration
|
14
|
+
|
15
|
+
**TODO:** Write descriptions of all configuration options
|
16
|
+
* **wpar_name** wpar name on AIX global system. Default to **kitchenwpar**.
|
17
|
+
* **aix_host** aix global partition name. Default to **localhost**.
|
18
|
+
* **aix_user** aix global partition username. Default to **root**.
|
19
|
+
* **wpar_address** wpar IP address to use. Not needed if an entry already exists in `/etc/hosts` on Global partition.
|
20
|
+
* **wpar_vg** Volume group to use to store shared wpar filesystems. Default to **rootvg**.
|
21
|
+
* **wpar_rootvg** Specify the `hdisk` to use to create a rootvg system wpar.
|
22
|
+
|
23
|
+
|
24
|
+
### <a name="config-require-chef-omnibus"></a> require\_chef\_omnibus
|
25
|
+
|
26
|
+
Determines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be
|
27
|
+
installed. There are several different behaviors available:
|
28
|
+
|
29
|
+
* `true` - the latest release will be installed. Subsequent converges
|
30
|
+
will skip re-installing if chef is present.
|
31
|
+
* `latest` - the latest release will be installed. Subsequent converges
|
32
|
+
will always re-install even if chef is present.
|
33
|
+
* `<VERSION_STRING>` (ex: `10.24.0`) - the desired version string will
|
34
|
+
be passed the the install.sh script. Subsequent converges will skip if
|
35
|
+
the installed version and the desired version match.
|
36
|
+
* `false` or `nil` - no chef is installed.
|
37
|
+
|
38
|
+
The default value is unset, or `nil`.
|
39
|
+
Should be `false` if your AIX system has no internet access.
|
40
|
+
|
41
|
+
## <a name="development"></a> Development
|
42
|
+
|
43
|
+
* Source hosted at [GitHub][repo]
|
44
|
+
* Report issues/questions/feature requests on [GitHub Issues][issues]
|
45
|
+
|
46
|
+
Pull requests are very welcome! Make sure your patches are well tested.
|
47
|
+
Ideally create a topic branch for every separate change you make. For
|
48
|
+
example:
|
49
|
+
|
50
|
+
1. Fork the repo
|
51
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
52
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
53
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
54
|
+
5. Create new Pull Request
|
55
|
+
|
56
|
+
## <a name="authors"></a> Authors
|
57
|
+
|
58
|
+
Created and maintained by [Alain Dejoux][author] (<adejoux@djouxtech.net>)
|
59
|
+
|
60
|
+
## <a name="license"></a> License
|
61
|
+
|
62
|
+
Apache 2.0 (see [LICENSE][license])
|
63
|
+
|
64
|
+
|
65
|
+
[author]: https://github.com/adejoux
|
66
|
+
[issues]: https://github.com/adejoux/kitchen-wpar/issues
|
67
|
+
[license]: https://github.com/adejoux/kitchen-wpar/blob/master/LICENSE
|
68
|
+
[repo]: https://github.com/adejoux/kitchen-wpar
|
69
|
+
[driver_usage]: https://docs.chef.io/kitchen.html#drivers
|
70
|
+
[chef_omnibus_dl]: http://www.chef.io/chef/install/
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'cane/rake_task'
|
3
|
+
require 'tailor/rake_task'
|
4
|
+
|
5
|
+
desc "Run cane to check quality metrics"
|
6
|
+
Cane::RakeTask.new do |cane|
|
7
|
+
cane.canefile = './.cane'
|
8
|
+
end
|
9
|
+
|
10
|
+
Tailor::RakeTask.new
|
11
|
+
|
12
|
+
desc "Display LOC stats"
|
13
|
+
task :stats do
|
14
|
+
puts "\n## Production Code Stats"
|
15
|
+
sh "countloc -r lib"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Run all quality tasks"
|
19
|
+
task :quality => [:cane, :tailor, :stats]
|
20
|
+
|
21
|
+
task :default => [:quality]
|
@@ -0,0 +1,29 @@
|
|
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/wpar_version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'kitchen-wpar'
|
8
|
+
spec.version = Kitchen::Driver::WPAR_VERSION
|
9
|
+
spec.authors = ['Alain Dejoux']
|
10
|
+
spec.email = ['adejoux@djouxtech.net']
|
11
|
+
spec.description = %q{A Test Kitchen Driver for Wpar}
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = 'https://github.com/adejoux/kitchen-wpar'
|
14
|
+
spec.license = 'Apache 2.0'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = []
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'test-kitchen', '>= 1.0.0'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'cane'
|
27
|
+
spec.add_development_dependency 'tailor'
|
28
|
+
spec.add_development_dependency 'countloc'
|
29
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Alain Dejoux (<adejoux@djouxtech.net>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2016, Alain Dejoux
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
require 'kitchen'
|
20
|
+
require "kitchen/driver/wpar_version"
|
21
|
+
require 'net/ssh'
|
22
|
+
|
23
|
+
module Kitchen
|
24
|
+
|
25
|
+
module Driver
|
26
|
+
|
27
|
+
# Wpar driver for Kitchen.
|
28
|
+
#
|
29
|
+
# @author Alain Dejoux <adejoux@djouxtech.net>
|
30
|
+
class Wpar < Kitchen::Driver::Base
|
31
|
+
|
32
|
+
kitchen_driver_api_version 2
|
33
|
+
plugin_version Kitchen::Driver::WPAR_VERSION
|
34
|
+
|
35
|
+
default_config :mkwpar, '/usr/sbin/mkwpar'
|
36
|
+
default_config :startwpar, '/usr/sbin/startwpar'
|
37
|
+
default_config :rmwpar, '/usr/sbin/rmwpar'
|
38
|
+
default_config :lswpar, '/usr/sbin/lswpar'
|
39
|
+
default_config :wpar_name, 'kitchenwpar'
|
40
|
+
default_config :aix_host, 'localhost'
|
41
|
+
default_config :aix_user, 'root'
|
42
|
+
|
43
|
+
def create(state)
|
44
|
+
if wpar_exists?(state)
|
45
|
+
raise ActionFailed,'wpar already exists !'
|
46
|
+
end
|
47
|
+
cmd = build_mkwpar_command()
|
48
|
+
ssh_command(cmd, :stderr)
|
49
|
+
|
50
|
+
unless wpar_exists?(state)
|
51
|
+
raise ActionFailed,'Cannot create wpar !'
|
52
|
+
end
|
53
|
+
state[:hostname]= config[:wpar_address] || config[:wpar_name]
|
54
|
+
copy_key()
|
55
|
+
end
|
56
|
+
|
57
|
+
def destroy(state)
|
58
|
+
ssh_command("#{config[:rmwpar]} -F #{config[:wpar_name]}", :stderr)
|
59
|
+
if wpar_exists?(state)
|
60
|
+
raise ActionFailed,"couldn't destroy wpar !"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
protected
|
65
|
+
def build_mkwpar_command()
|
66
|
+
cmd = "#{config[:mkwpar]} -s -n #{config[:wpar_name]}"
|
67
|
+
unless config[:wpar_address].nil?
|
68
|
+
cmd += " -N address=#{config[:wpar_address]}"
|
69
|
+
end
|
70
|
+
|
71
|
+
unless config[:wpar_vg].nil?
|
72
|
+
cmd += " -g #{config[:wpar_vg]}"
|
73
|
+
end
|
74
|
+
|
75
|
+
unless config[:wpar_rootvg].nil?
|
76
|
+
cmd += " -D rootvg=yes devname=#{config[:wpar_rootvg]}"
|
77
|
+
end
|
78
|
+
|
79
|
+
cmd
|
80
|
+
end
|
81
|
+
|
82
|
+
def copy_key()
|
83
|
+
cmd = "mkdir /wpars/#{config[:wpar_name]}/.ssh;"
|
84
|
+
cmd += "chmod 700 /wpars/#{config[:wpar_name]}/.ssh"
|
85
|
+
ssh_command(cmd, :stderr)
|
86
|
+
cmd="cp ~/.ssh/authorized_keys /wpars/#{config[:wpar_name]}/.ssh"
|
87
|
+
ssh_command(cmd, :stderr)
|
88
|
+
end
|
89
|
+
|
90
|
+
def wpar_exists?(state)
|
91
|
+
output=ssh_command("#{config[:lswpar]} #{config[:wpar_name]}", :stderr)
|
92
|
+
if output.include?("0960-419")
|
93
|
+
return false
|
94
|
+
end
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
def ssh_command(cmd, stream)
|
99
|
+
out = ""
|
100
|
+
begin
|
101
|
+
host = config[:aix_host]
|
102
|
+
user = config[:aix_user]
|
103
|
+
keys = config[:aix_key]
|
104
|
+
Net::SSH.start(host, user, :keys => keys) do |ssh|
|
105
|
+
ssh.exec!(cmd) do |channel, stream, data|
|
106
|
+
out << data if stream == stream
|
107
|
+
print data
|
108
|
+
end
|
109
|
+
out
|
110
|
+
end
|
111
|
+
rescue
|
112
|
+
raise ActionFailed,'ssh command failed !'
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Alain Dejoux (<adejoux@djouxtech.net>)
|
4
|
+
|
5
|
+
# Copyright (C) 2016, Alain Dejoux
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
module Kitchen
|
20
|
+
|
21
|
+
module Driver
|
22
|
+
|
23
|
+
# Version string for Wpar Kitchen driver
|
24
|
+
WPAR_VERSION = "0.1.0"
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kitchen-wpar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alain Dejoux
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: test-kitchen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cane
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: tailor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: countloc
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: A Test Kitchen Driver for Wpar
|
98
|
+
email:
|
99
|
+
- adejoux@djouxtech.net
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".cane"
|
105
|
+
- ".gitignore"
|
106
|
+
- ".tailor"
|
107
|
+
- ".travis.yml"
|
108
|
+
- CHANGELOG.md
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- kitchen-wpar.gemspec
|
114
|
+
- lib/kitchen/driver/wpar.rb
|
115
|
+
- lib/kitchen/driver/wpar_version.rb
|
116
|
+
homepage: https://github.com/adejoux/kitchen-wpar
|
117
|
+
licenses:
|
118
|
+
- Apache 2.0
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.5.1
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: A Test Kitchen Driver for Wpar
|
140
|
+
test_files: []
|