kitchen-wpar 0.4.1 → 0.4.2
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 +4 -4
- data/README.md +1 -0
- data/lib/kitchen/driver/wpar.rb +21 -12
- data/lib/kitchen/driver/wpar_version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 751e26f0786285bf78c6ee5f3fd473e1ace58fe1
|
|
4
|
+
data.tar.gz: 4cb551333fd4cd28330fe3d4d0abf382711e4176
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24ef2e0c84098e814ed16304d1c4eecf6119895b6605b79b246a672d739bf0d55463e6715518c0fd75e32badefad42d39f3e5b0978c721539946b0880d8eb473
|
|
7
|
+
data.tar.gz: f407294f4e657989eae0cba4d0580e18886f6cdb07bd176fdef57e4c98f32e20ed20355510ccfd463f1ce24ab126d0fc58e4861cccdde574ef2b09b79aa4225c
|
data/README.md
CHANGED
|
@@ -25,6 +25,7 @@ Please read the [Driver usage][driver_usage] page for more details.
|
|
|
25
25
|
* **isVersioned** create a versioned wpar. Used only with **wpar_mksysb**.
|
|
26
26
|
* **isWritable** adds the option ' -l' to have a non-shared, writable /usr file system and /opt file system.
|
|
27
27
|
* **share_network_resolution** adds the option ' -r' to share name resolution services (i.e. `/etc/resolv.conf`) with the wpar.
|
|
28
|
+
* **sudo** path to `sudo` command in case we need it.
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
### <a name="config-require-chef-omnibus"></a> require\_chef\_omnibus
|
data/lib/kitchen/driver/wpar.rb
CHANGED
|
@@ -50,6 +50,7 @@ module Kitchen
|
|
|
50
50
|
default_config :mkssys, '/usr/bin/mkssys'
|
|
51
51
|
default_config :startsrc, '/usr/bin/startsrc'
|
|
52
52
|
default_config :stopsrc, '/usr/bin/stopsrc'
|
|
53
|
+
default_config :sudo, ''
|
|
53
54
|
default_config :pam_sshd_account_rule, 'sshd account required pam_aix'
|
|
54
55
|
default_config :pam_sshd_session_rule, 'sshd session required pam_aix'
|
|
55
56
|
|
|
@@ -81,11 +82,19 @@ module Kitchen
|
|
|
81
82
|
configure_pam
|
|
82
83
|
end
|
|
83
84
|
end
|
|
85
|
+
|
|
86
|
+
#section to destroy wpar
|
|
87
|
+
def destroy(state)
|
|
88
|
+
ssh_command("#{config[:rmwpar]} -F #{config[:wpar_name]}", :stderr)
|
|
89
|
+
if wpar_exists?(state)
|
|
90
|
+
raise ActionFailed, "couldn't destroy wpar !"
|
|
91
|
+
end
|
|
92
|
+
end
|
|
84
93
|
|
|
85
94
|
protected
|
|
86
95
|
def build_mkwpar_command()
|
|
87
96
|
|
|
88
|
-
cmd = "#{config[:mkwpar]} -s -n #{config[:wpar_name]}"
|
|
97
|
+
cmd = "#{config[:sudo]} #{config[:mkwpar]} -s -n #{config[:wpar_name]}"
|
|
89
98
|
unless config[:wpar_address].nil?
|
|
90
99
|
cmd += " -N address=#{config[:wpar_address]}"
|
|
91
100
|
end
|
|
@@ -122,15 +131,15 @@ module Kitchen
|
|
|
122
131
|
end
|
|
123
132
|
|
|
124
133
|
def copy_key()
|
|
125
|
-
cmd = "mkdir /wpars/#{config[:wpar_name]}/.ssh;"
|
|
126
|
-
cmd += "chmod 700 /wpars/#{config[:wpar_name]}/.ssh"
|
|
134
|
+
cmd = "#{config[:sudo]} mkdir /wpars/#{config[:wpar_name]}/.ssh;"
|
|
135
|
+
cmd += "#{config[:sudo]} chmod 700 /wpars/#{config[:wpar_name]}/.ssh"
|
|
127
136
|
ssh_command(cmd, :stderr)
|
|
128
|
-
cmd="cp ~/.ssh/authorized_keys /wpars/#{config[:wpar_name]}/.ssh"
|
|
137
|
+
cmd="#{config[:sudo]} cp ~/.ssh/authorized_keys /wpars/#{config[:wpar_name]}/.ssh"
|
|
129
138
|
ssh_command(cmd, :stderr)
|
|
130
139
|
end
|
|
131
140
|
|
|
132
141
|
def wpar_exists?(state)
|
|
133
|
-
output=ssh_command("#{config[:lswpar]} #{config[:wpar_name]}", :stderr)
|
|
142
|
+
output=ssh_command("#{config[:sudo]} #{config[:lswpar]} #{config[:wpar_name]}", :stderr)
|
|
134
143
|
if output.include?('0960-419')
|
|
135
144
|
return false
|
|
136
145
|
end
|
|
@@ -140,7 +149,7 @@ module Kitchen
|
|
|
140
149
|
# Determines if the sshd service is defined in the WPAR.
|
|
141
150
|
def sshd_service_exists?
|
|
142
151
|
# FIXME: We should probably check exit status rather than AIX-specific error codes.
|
|
143
|
-
output=ssh_command("#{config[:clogin]} #{config[:wpar_name]} #{config[:lssrc]} -s sshd", :stderr)
|
|
152
|
+
output=ssh_command("#{config[:sudo]} #{config[:clogin]} #{config[:wpar_name]} #{config[:lssrc]} -s sshd", :stderr)
|
|
144
153
|
if output.include?('0513-085') # 0513-085 The sshd Subsystem is not on file.
|
|
145
154
|
return false
|
|
146
155
|
end
|
|
@@ -150,7 +159,7 @@ module Kitchen
|
|
|
150
159
|
# Creates an sshd service.
|
|
151
160
|
def create_sshd_service
|
|
152
161
|
# FIXME: We should probably check exit status rather than AIX-specific error codes.
|
|
153
|
-
output=ssh_command("#{config[:clogin]} #{config[:wpar_name]} #{config[:mkssys]} -s sshd -p /usr/sbin/sshd -a '-D' -u 0 -S -n 15 -f 9 -R -G local", :stderr)
|
|
162
|
+
output=ssh_command("#{config[:sudo]} #{config[:clogin]} #{config[:wpar_name]} #{config[:mkssys]} -s sshd -p /usr/sbin/sshd -a '-D' -u 0 -S -n 15 -f 9 -R -G local", :stderr)
|
|
154
163
|
if output.include?('0513-071') # 0513-071 The sshd Subsystem has been added.
|
|
155
164
|
return true
|
|
156
165
|
end
|
|
@@ -160,7 +169,7 @@ module Kitchen
|
|
|
160
169
|
# Determines if the sshd service is running.
|
|
161
170
|
def sshd_service_running?
|
|
162
171
|
# FIXME: We should probably check exit status rather than AIX-specific error codes.
|
|
163
|
-
output=ssh_command("#{config[:clogin]} #{config[:wpar_name]} #{config[:lssrc]} -s sshd", :stderr)
|
|
172
|
+
output=ssh_command("#{config[:sudo]} #{config[:clogin]} #{config[:wpar_name]} #{config[:lssrc]} -s sshd", :stderr)
|
|
164
173
|
if output.include?('active')
|
|
165
174
|
return true
|
|
166
175
|
end
|
|
@@ -170,7 +179,7 @@ module Kitchen
|
|
|
170
179
|
# Starts the sshd service.
|
|
171
180
|
def start_sshd_service
|
|
172
181
|
# FIXME: We should probably check exit status rather than AIX-specific error codes.
|
|
173
|
-
output=ssh_command("#{config[:clogin]} #{config[:wpar_name]} #{config[:startsrc]} -s sshd", :stderr)
|
|
182
|
+
output=ssh_command("#{config[:sudo]} #{config[:clogin]} #{config[:wpar_name]} #{config[:startsrc]} -s sshd", :stderr)
|
|
174
183
|
if output.include?('0513-059') # 0513-059 The sshd Subsystem has been started. Subsystem PID is 2688212.
|
|
175
184
|
return true
|
|
176
185
|
end
|
|
@@ -181,8 +190,8 @@ module Kitchen
|
|
|
181
190
|
# This includes account and session rules.
|
|
182
191
|
def pam_supports_sshd?
|
|
183
192
|
pam_config_path = "/wpars/#{config[:wpar_name]}/etc/pam.conf"
|
|
184
|
-
account_output=ssh_command("grep '#{config[:pam_sshd_account_rule]}' #{pam_config_path}", :stderr)
|
|
185
|
-
session_output=ssh_command("grep '#{config[:pam_sshd_session_rule]}' #{pam_config_path}", :stderr)
|
|
193
|
+
account_output=ssh_command("#{config[:sudo]} grep '#{config[:pam_sshd_account_rule]}' #{pam_config_path}", :stderr)
|
|
194
|
+
session_output=ssh_command("#{config[:sudo]} grep '#{config[:pam_sshd_session_rule]}' #{pam_config_path}", :stderr)
|
|
186
195
|
|
|
187
196
|
unless account_output.include?("#{config[:pam_sshd_account_rule]}")
|
|
188
197
|
return false
|
|
@@ -199,7 +208,7 @@ module Kitchen
|
|
|
199
208
|
pam_config_path = "/wpars/#{config[:wpar_name]}/etc/pam.conf"
|
|
200
209
|
pam_sshd_rules = "#{config[:pam_sshd_account_rule]}\\n#{config[:pam_sshd_session_rule]}"
|
|
201
210
|
header = "\\n\\n# sshd Rules\\n"
|
|
202
|
-
cmd = "#{config[:echo]} \"#{header}#{pam_sshd_rules}\" >> #{pam_config_path}"
|
|
211
|
+
cmd = "#{config[:sudo]} #{config[:echo]} \"#{header}#{pam_sshd_rules}\" >> #{pam_config_path}"
|
|
203
212
|
ssh_command(cmd, :stderr)
|
|
204
213
|
end
|
|
205
214
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kitchen-wpar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alain Dejoux
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-10-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
201
201
|
version: '0'
|
|
202
202
|
requirements: []
|
|
203
203
|
rubyforge_project:
|
|
204
|
-
rubygems_version: 2.6.
|
|
204
|
+
rubygems_version: 2.6.13
|
|
205
205
|
signing_key:
|
|
206
206
|
specification_version: 4
|
|
207
207
|
summary: test kitchen driver using AIX wpar
|