beaker 2.29.0 → 2.29.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/HISTORY.md +44 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +6 -6
- data/acceptance/tests/base/dsl/helpers/host_helpers/install_package_test.rb +1 -10
- data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +1 -24
- data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +1 -12
- data/acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb +32 -0
- data/acceptance/tests/base/packages.rb +4 -1
- data/beaker.gemspec +1 -0
- data/lib/beaker/host/aix.rb +1 -1
- data/lib/beaker/host/aix/exec.rb +18 -0
- data/lib/beaker/host/mac/exec.rb +22 -0
- data/lib/beaker/host/pswindows/exec.rb +24 -0
- data/lib/beaker/host/unix/exec.rb +78 -0
- data/lib/beaker/host/unix/pkg.rb +19 -2
- data/lib/beaker/host/windows/exec.rb +26 -0
- data/lib/beaker/host_prebuilt_steps.rb +8 -64
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/host_prebuilt_steps_spec.rb +62 -70
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDZlMGU2MGNjMGIzZmQxNzkyZjlhZjRhYmE1ODgwZDVlYTQ3ZTE3Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGY0NDVlMDJiNTk4Mjg0Mzk4MjVjOTdjN2JlOGI4YmNhNTAwYjRlNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTYzNjJjODNkNDE1ZGU1MTYxNTQyMjZhZjM0MTQzZDc5MzQ4ZGM1Nzc4M2Y3
|
10
|
+
YWRkNWRhYjQwMGQyZWU2Y2I3Y2FiN2QxMTI5YTk2NDAzMTUxZDU4NTU3MmQ0
|
11
|
+
NGU0MWJiNzQ2N2JjMTYzMTMxYjQwNzA4NjdjN2ExNGRhOWJiZjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjFiZmE3NzNiODg0ODgyZTAwMzNjMjhiMmY4YzA5MWU5NWQ1ZjlmZDI5YTY5
|
14
|
+
MWVkY2U4NzZlMGEwNDY2YjU2MmM2NzRhOTEzYzRhOGVmNWMzYjk0N2FhODMx
|
15
|
+
ZWQ0MzQ1MWRlYjFiNGIxMzQ5ZDM5MjllNzMzYzhlY2JjNDk0YjA=
|
data/HISTORY.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# default - History
|
2
2
|
## Tags
|
3
|
-
* [LATEST -
|
3
|
+
* [LATEST - 23 Nov, 2015 (5781838d)](#LATEST)
|
4
|
+
* [2.29.0 - 18 Nov, 2015 (33fd2399)](#2.29.0)
|
4
5
|
* [2.28.0 - 4 Nov, 2015 (89829551)](#2.28.0)
|
5
6
|
* [2.27.0 - 21 Oct, 2015 (0378d13a)](#2.27.0)
|
6
7
|
* [2.26.0 - 13 Oct, 2015 (427a512b)](#2.26.0)
|
@@ -101,7 +102,48 @@
|
|
101
102
|
* [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
|
102
103
|
|
103
104
|
## Details
|
104
|
-
### <a name = "LATEST">LATEST -
|
105
|
+
### <a name = "LATEST">LATEST - 23 Nov, 2015 (5781838d)
|
106
|
+
|
107
|
+
* (GEM) update beaker version to 2.29.1 (5781838d)
|
108
|
+
|
109
|
+
* Merge pull request #1019 from ody/bkr633_lesser_ruby (41647b80)
|
110
|
+
|
111
|
+
|
112
|
+
```
|
113
|
+
Merge pull request #1019 from ody/bkr633_lesser_ruby
|
114
|
+
|
115
|
+
(BKR-633) Explicitly depend on mime-types.
|
116
|
+
```
|
117
|
+
* (BKR-633) Explicitly depend on mime-types. (99fb8b11)
|
118
|
+
|
119
|
+
|
120
|
+
```
|
121
|
+
(BKR-633) Explicitly depend on mime-types.
|
122
|
+
|
123
|
+
This commit will add an explicit dependency on the mime-types gem to
|
124
|
+
beaker's gemspec that installs versions less than 3.0 on systems with
|
125
|
+
a Ruby version less than 2.0.
|
126
|
+
|
127
|
+
This has to be done in order for beaker to install freshly on systems
|
128
|
+
where it hasn't been installed before. The mime-types gem dropped
|
129
|
+
ruby 1.9.2 support with 3.0 and one of beaker's dependency, fog
|
130
|
+
depends on any version of mime-types greater than 0.
|
131
|
+
```
|
132
|
+
* Merge pull request #1009 from kevpl/bkr499_solaris10_fixups (22fe3324)
|
133
|
+
|
134
|
+
|
135
|
+
```
|
136
|
+
Merge pull request #1009 from kevpl/bkr499_solaris10_fixups
|
137
|
+
|
138
|
+
(BKR-499) solaris10 fixups
|
139
|
+
```
|
140
|
+
* (BKR-499) refactoring set_env into host logic (a661dfe0)
|
141
|
+
|
142
|
+
* (BKR-499) Solaris 10 Fixes (ba1289ca)
|
143
|
+
|
144
|
+
### <a name = "2.29.0">2.29.0 - 18 Nov, 2015 (33fd2399)
|
145
|
+
|
146
|
+
* (HISTORY) update beaker history for gem release 2.29.0 (33fd2399)
|
105
147
|
|
106
148
|
* (GEM) update beaker version to 2.29.0 (5ae7782f)
|
107
149
|
|
@@ -57,9 +57,9 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
# NOTE: there does not seem to be a reliable way to confine to cygwin hosts.
|
60
|
-
confine_block :to, :platform => /windows
|
60
|
+
confine_block :to, :platform => /windows/ do
|
61
61
|
|
62
|
-
# NOTE: rsync methods are not working currently on windows
|
62
|
+
# NOTE: rsync methods are not working currently on windows platforms
|
63
63
|
|
64
64
|
step "#create_remote_file CURRENTLY fails on #{default['platform']}, using rsync" do
|
65
65
|
remote_tmpdir = tmpdir_on default
|
@@ -74,7 +74,7 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
confine_block :except, :platform => /windows
|
77
|
+
confine_block :except, :platform => /windows/ do
|
78
78
|
|
79
79
|
step "#create_remote_file creates a remote file with the specified contents, using rsync" do
|
80
80
|
remote_tmpdir = tmpdir_on default
|
@@ -137,9 +137,9 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
137
137
|
end
|
138
138
|
|
139
139
|
# NOTE: there does not appear to be a way to confine just to cygwin hosts
|
140
|
-
confine_block :to, :platform => /windows
|
140
|
+
confine_block :to, :platform => /windows/ do
|
141
141
|
|
142
|
-
# NOTE: rsync methods are not working currently on windows
|
142
|
+
# NOTE: rsync methods are not working currently on windows
|
143
143
|
# platforms. Would expect this to be documented better.
|
144
144
|
|
145
145
|
step "#create_remote_file creates remote files on all remote hosts, when given an array, using rsync" do
|
@@ -158,7 +158,7 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
confine_block :except, :platform => /windows|
|
161
|
+
confine_block :except, :platform => /windows|fedora/ do
|
162
162
|
|
163
163
|
step "#create_remote_file creates remote files on all remote hosts, when given an array, using rsync" do
|
164
164
|
remote_tmpdir = tmpdir_on default
|
@@ -22,20 +22,11 @@ test_name "dsl::helpers::host_helpers #install_package" do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
confine_block :to, :platform => /solaris/ do
|
26
|
-
|
27
|
-
step "#install_package CURRENTLY fails on solaris platforms" do
|
28
|
-
assert_raises Beaker::Host::CommandFailure do
|
29
|
-
install_package default, "rsync"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
25
|
confine_block :to, :platform => /osx/ do
|
35
26
|
# TODO: install_package on OSX installs via a .dmg file -- how to test this?
|
36
27
|
end
|
37
28
|
|
38
|
-
confine_block :except, :platform => /windows|
|
29
|
+
confine_block :except, :platform => /windows|osx/ do
|
39
30
|
|
40
31
|
step "#install_package fails if package is not known on the OS" do
|
41
32
|
assert_raises Beaker::Host::CommandFailure do
|
@@ -2,29 +2,6 @@ require "helpers/test_helper"
|
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #rsync_to" do
|
4
4
|
|
5
|
-
confine_block :to, :platform => /^solaris.*10/ do
|
6
|
-
|
7
|
-
step "#rsync_to CURRENTLY will fail without error, but not copy the requested file, on #{default['platform']} due to lack of installed rsync" do
|
8
|
-
|
9
|
-
# NOTE: this should be documented
|
10
|
-
# FIXME: This is also true for CentOS/EL-*, but package removal appears
|
11
|
-
# to not be working properly, so we cannot get test isolation
|
12
|
-
# to test this as if the system is pristine.
|
13
|
-
Dir.mktmpdir do |local_dir|
|
14
|
-
local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
15
|
-
remote_tmpdir = tmpdir_on default
|
16
|
-
|
17
|
-
rsync_to default, local_filename, remote_tmpdir
|
18
|
-
|
19
|
-
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
20
|
-
|
21
|
-
assert_raises Beaker::Host::CommandFailure do
|
22
|
-
remote_contents = on(default, "cat #{remote_filename}").stdout
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
5
|
confine_block :to, :platform => /^centos|el-\d|fedora/ do
|
29
6
|
step "installing `rsync` on #{default['platform']} for all later test steps" do
|
30
7
|
hosts.each do |host|
|
@@ -54,7 +31,7 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
54
31
|
end
|
55
32
|
end
|
56
33
|
|
57
|
-
confine_block :except, :platform => /windows
|
34
|
+
confine_block :except, :platform => /windows/ do
|
58
35
|
|
59
36
|
step "#rsync_to fails if the local file cannot be found" do
|
60
37
|
remote_tmpdir = tmpdir_on default
|
@@ -33,18 +33,7 @@ test_name "dsl::helpers::host_helpers #upgrade_package" do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
confine_block :
|
37
|
-
|
38
|
-
step "#upgrade_package CURRENTLY fails on solaris platforms" do
|
39
|
-
# NOTE: pkgutil doesn't appear to be installed by default -- documentation
|
40
|
-
# could be better here.
|
41
|
-
assert_raises Beaker::Host::CommandFailure do
|
42
|
-
upgrade_package default, "bash"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
confine_block :except, :platform => /windows|solaris|osx/ do
|
36
|
+
confine_block :except, :platform => /windows|osx/ do
|
48
37
|
confine_block :to, :platform => /centos|el-\d/ do
|
49
38
|
|
50
39
|
step "#upgrade_package CURRENTLY does not fail on CentOS if unknown package is specified" do
|
@@ -0,0 +1,32 @@
|
|
1
|
+
test_name "confirm host prebuilt steps behave correctly" do
|
2
|
+
|
3
|
+
confine_block :except, :platform => /f5|windows/ do
|
4
|
+
step "confirm ssh environment file existence" do
|
5
|
+
hosts.each do |host|
|
6
|
+
assert(host.file_exist?(host[:ssh_env_file]))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
step "confirm PATH env variable is set in the ssh environment file" do
|
11
|
+
hosts.each do |host|
|
12
|
+
assert(0 == on(host, "grep \"PATH\" #{host[:ssh_env_file]}").exit_code)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
confine_block :to, :platform => /solaris-10/ do
|
18
|
+
step "confirm /opt/csw/bin has been added to the path" do
|
19
|
+
hosts.each do |host|
|
20
|
+
assert(0 == on(host, "grep \"/opt/csw/bin\" #{host[:ssh_env_file]}").exit_code)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
confine_block :to, :platform => /openbsd/ do
|
26
|
+
step "confirm PKG_PATH is set in the ssh environment file" do
|
27
|
+
hosts.each do |host|
|
28
|
+
assert(0 == on(host, "grep \"PKG_PATH\" #{host[:ssh_env_file]}").exit_code)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -19,6 +19,8 @@ def get_host_pkg(host)
|
|
19
19
|
Beaker::HostPrebuiltSteps::FREEBSD_PACKAGES
|
20
20
|
when host['platform'] =~ /openbsd/
|
21
21
|
Beaker::HostPrebuiltSteps::OPENBSD_PACKAGES
|
22
|
+
when host['platform'] =~ /solaris-10/
|
23
|
+
Beaker::HostPrebuiltSteps::SOLARIS10_PACKAGES
|
22
24
|
else
|
23
25
|
Beaker::HostPrebuiltSteps::UNIX_PACKAGES
|
24
26
|
end
|
@@ -48,8 +50,9 @@ hosts.each do |host|
|
|
48
50
|
# this works on Windows as well, althought it pulls in
|
49
51
|
# a lot of dependencies.
|
50
52
|
package = 'zsh'
|
53
|
+
package = 'CSWzsh' if host['platform'] =~ /solaris-10/
|
51
54
|
|
52
|
-
if host['platform'] =~ /solaris/
|
55
|
+
if host['platform'] =~ /solaris-11/
|
53
56
|
logger.debug("#{package} should be uninstalled on #{host}")
|
54
57
|
host.uninstall_package(package)
|
55
58
|
assert_equal(false, host.check_for_package(package), "'#{package}' should not be installed")
|
data/beaker.gemspec
CHANGED
@@ -51,6 +51,7 @@ Gem::Specification.new do |s|
|
|
51
51
|
s.add_runtime_dependency 'google-api-client', '~> 0.8'
|
52
52
|
s.add_runtime_dependency 'aws-sdk', '~> 1.57'
|
53
53
|
s.add_runtime_dependency 'docker-api'
|
54
|
+
s.add_runtime_dependency 'mime-types', '~> 2.99' if RUBY_VERSION < '2.0' # dropped ruby 1.9 rupport in 3.0
|
54
55
|
s.add_runtime_dependency 'fog-google', '~> 0.0.9' # dropped ruby 1.9 support in 0.1
|
55
56
|
s.add_runtime_dependency 'fog', ['~> 1.25', '< 1.35.0']
|
56
57
|
|
data/lib/beaker/host/aix.rb
CHANGED
data/lib/beaker/host/aix/exec.rb
CHANGED
@@ -8,4 +8,22 @@ module Aix::Exec
|
|
8
8
|
def get_ip
|
9
9
|
execute("ifconfig -a inet| awk '/broadcast/ {print $2}' | cut -d/ -f1 | head -1").strip
|
10
10
|
end
|
11
|
+
|
12
|
+
# Restarts the SSH service
|
13
|
+
#
|
14
|
+
# @return [Result] result of starting ssh service
|
15
|
+
def ssh_service_restart
|
16
|
+
exec(Beaker::Command.new("stopsrc -g ssh"))
|
17
|
+
exec(Beaker::Command.new("startsrc -g ssh"))
|
18
|
+
end
|
19
|
+
|
20
|
+
# Sets the PermitUserEnvironent setting & restarts the SSH service
|
21
|
+
#
|
22
|
+
# @api private
|
23
|
+
# @return [Result] result of the command starting the SSH service
|
24
|
+
# (from {#ssh_service_restart}).
|
25
|
+
def ssh_permit_user_environment
|
26
|
+
exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
27
|
+
ssh_service_restart()
|
28
|
+
end
|
11
29
|
end
|
data/lib/beaker/host/mac/exec.rb
CHANGED
@@ -5,4 +5,26 @@ module Mac::Exec
|
|
5
5
|
(abs ? '/usr/bin/touch' : 'touch') + " #{file}"
|
6
6
|
end
|
7
7
|
|
8
|
+
# Restarts the SSH service
|
9
|
+
#
|
10
|
+
# @return [Result] result of starting SSH service
|
11
|
+
def ssh_service_restart
|
12
|
+
launch_daemons_plist = '/System/Library/LaunchDaemons/ssh.plist'
|
13
|
+
exec(Beaker::Command.new("launchctl unload #{launch_daemons_plist}"))
|
14
|
+
exec(Beaker::Command.new("launchctl load #{launch_daemons_plist}"))
|
15
|
+
end
|
16
|
+
|
17
|
+
# Sets the PermitUserEnvironment setting & restarts the SSH service
|
18
|
+
#
|
19
|
+
# @api private
|
20
|
+
# @return [Result] result of the command starting the SSH service
|
21
|
+
# (from {#ssh_service_restart})
|
22
|
+
def ssh_permit_user_environment
|
23
|
+
ssh_config_file = '/etc/sshd_config'
|
24
|
+
ssh_config_file = '/private/etc/ssh/sshd_config' if self['platform'] =~ /osx-10\.*11/
|
25
|
+
|
26
|
+
exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> #{ssh_config_file}"))
|
27
|
+
ssh_service_restart()
|
28
|
+
end
|
29
|
+
|
8
30
|
end
|
@@ -148,4 +148,28 @@ module PSWindows::Exec
|
|
148
148
|
self.close #refresh the state
|
149
149
|
end
|
150
150
|
|
151
|
+
# Overrides the {Windows::Exec#ssh_permit_user_environment} method,
|
152
|
+
# since no steps are needed in this setup to allow user ssh environments
|
153
|
+
# to work.
|
154
|
+
def ssh_permit_user_environment
|
155
|
+
end
|
156
|
+
|
157
|
+
# Sets the user SSH environment.
|
158
|
+
#
|
159
|
+
# @param [Hash{String=>String}] env Environment variables to set on the system,
|
160
|
+
# in the form of a hash of String variable
|
161
|
+
# names to their corresponding String values.
|
162
|
+
#
|
163
|
+
# @note this class doesn't manipulate an SSH environment file, it just sets
|
164
|
+
# the environment variables on the system.
|
165
|
+
#
|
166
|
+
# @api private
|
167
|
+
# @return nil
|
168
|
+
def ssh_set_user_environment(env)
|
169
|
+
#add the env var set to this test host
|
170
|
+
env.each_pair do |var, value|
|
171
|
+
add_env_var(var, value)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
151
175
|
end
|
@@ -159,4 +159,82 @@ module Unix::Exec
|
|
159
159
|
mirror_env_to_profile_d(env_file)
|
160
160
|
end
|
161
161
|
|
162
|
+
# Restarts the SSH service.
|
163
|
+
#
|
164
|
+
# @return [Result] result of restarting the SSH service
|
165
|
+
def ssh_service_restart
|
166
|
+
case self['platform']
|
167
|
+
when /debian|ubuntu|cumulus/
|
168
|
+
exec(Beaker::Command.new("service ssh restart"))
|
169
|
+
when /el-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7/
|
170
|
+
exec(Beaker::Command.new("systemctl restart sshd.service"))
|
171
|
+
when /el-|centos|fedora|redhat|oracle|scientific|eos/
|
172
|
+
exec(Beaker::Command.new("/sbin/service sshd restart"))
|
173
|
+
when /sles/
|
174
|
+
exec(Beaker::Command.new("rcsshd restart"))
|
175
|
+
when /solaris/
|
176
|
+
exec(Beaker::Command.new("svcadm restart svc:/network/ssh:default"))
|
177
|
+
when /(free|open)bsd/
|
178
|
+
exec(Beaker::Command.new("sudo /etc/rc.d/sshd restart"))
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Sets the PermitUserEnvironment setting & restarts the SSH service.
|
183
|
+
#
|
184
|
+
# @api private
|
185
|
+
# @return [Result] result of the command restarting the SSH service
|
186
|
+
# (from {#ssh_service_restart}).
|
187
|
+
def ssh_permit_user_environment
|
188
|
+
case self['platform']
|
189
|
+
when /debian|ubuntu|cumulus/
|
190
|
+
exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
191
|
+
when /el-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7/
|
192
|
+
exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
193
|
+
when /el-|centos|fedora|redhat|oracle|scientific|eos/
|
194
|
+
exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
195
|
+
when /sles/
|
196
|
+
exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
197
|
+
when /solaris/
|
198
|
+
# kept solaris here because refactoring it into its own Host module
|
199
|
+
# conflicts with the solaris hypervisor that already exists
|
200
|
+
exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
201
|
+
when /(free|open)bsd/
|
202
|
+
exec(Beaker::Command.new("sudo perl -pi -e 's/^#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config"), {:pty => true} )
|
203
|
+
end
|
204
|
+
|
205
|
+
ssh_service_restart()
|
206
|
+
end
|
207
|
+
|
208
|
+
# Fills the user SSH environment file.
|
209
|
+
#
|
210
|
+
# @param [Hash{String=>String}] env Environment variables to set on the system,
|
211
|
+
# in the form of a hash of String variable
|
212
|
+
# names to their corresponding String values.
|
213
|
+
#
|
214
|
+
# @api private
|
215
|
+
# @return nil
|
216
|
+
def ssh_set_user_environment(env)
|
217
|
+
#ensure that ~/.ssh/environment exists
|
218
|
+
ssh_env_file_dir = Pathname.new(self[:ssh_env_file]).dirname
|
219
|
+
mkdir_p(ssh_env_file_dir)
|
220
|
+
exec(Beaker::Command.new("chmod 0600 #{ssh_env_file_dir}"))
|
221
|
+
exec(Beaker::Command.new("touch #{self[:ssh_env_file]}"))
|
222
|
+
#add the constructed env vars to this host
|
223
|
+
add_env_var('PATH', '$PATH')
|
224
|
+
# FIXME
|
225
|
+
if self['platform'] =~ /openbsd-(\d)\.?(\d)-(.+)/
|
226
|
+
version = "#{$1}.#{$2}"
|
227
|
+
arch = $3
|
228
|
+
arch = 'amd64' if ['x64', 'x86_64'].include?(arch)
|
229
|
+
add_env_var('PKG_PATH', "http://ftp.openbsd.org/pub/OpenBSD/#{version}/packages/#{arch}/")
|
230
|
+
elsif self['platform'] =~ /solaris-10/
|
231
|
+
add_env_var('PATH', '/opt/csw/bin')
|
232
|
+
end
|
233
|
+
|
234
|
+
#add the env var set to this test host
|
235
|
+
env.each_pair do |var, value|
|
236
|
+
add_env_var(var, value)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
162
240
|
end
|
data/lib/beaker/host/unix/pkg.rb
CHANGED
@@ -11,7 +11,11 @@ module Unix::Pkg
|
|
11
11
|
result = exec(Beaker::Command.new("which #{name}"), :accept_all_exit_codes => true)
|
12
12
|
case self['platform']
|
13
13
|
when /solaris-10/
|
14
|
-
|
14
|
+
# solaris 10 appears to have considered `which` to have run successfully,
|
15
|
+
# even if the command didn't exist, so it'll return a 0 exit code in
|
16
|
+
# either case. Instead we match for the phrase output when a match isn't
|
17
|
+
# found: "no #{name} in $PATH", reversing it to match our API
|
18
|
+
!( result.stdout.match(/^no\ #{name}\ in\ /) )
|
15
19
|
else
|
16
20
|
result.exit_code == 0
|
17
21
|
end
|
@@ -36,6 +40,9 @@ module Unix::Pkg
|
|
36
40
|
result = execute("pkg info #{name}", opts) { |result| result }
|
37
41
|
when /solaris-10/
|
38
42
|
result = execute("pkginfo #{name}", opts) { |result| result }
|
43
|
+
if result.exit_code == 1
|
44
|
+
result = execute("pkginfo CSW#{name}", opts) { |result| result }
|
45
|
+
end
|
39
46
|
when /freebsd-9/
|
40
47
|
result = execute("pkg_info #{name}", opts) { |result| result }
|
41
48
|
when /freebsd-10/
|
@@ -82,6 +89,11 @@ module Unix::Pkg
|
|
82
89
|
update_apt_if_needed
|
83
90
|
execute("apt-get install --force-yes #{cmdline_args} -y #{name}", opts)
|
84
91
|
when /solaris-11/
|
92
|
+
if opts[:acceptable_exit_codes]
|
93
|
+
opts[:acceptable_exit_codes] << 4
|
94
|
+
else
|
95
|
+
opts[:acceptable_exit_codes] = [0, 4] unless opts[:accept_all_exit_codes]
|
96
|
+
end
|
85
97
|
execute("pkg #{cmdline_args} install #{name}", opts)
|
86
98
|
when /solaris-10/
|
87
99
|
execute("pkgutil -i -y #{cmdline_args} #{name}", opts)
|
@@ -180,9 +192,14 @@ module Unix::Pkg
|
|
180
192
|
update_apt_if_needed
|
181
193
|
execute("apt-get install -o Dpkg::Options::='--force-confold' #{cmdline_args} -y --force-yes #{name}", opts)
|
182
194
|
when /solaris-11/
|
195
|
+
if opts[:acceptable_exit_codes]
|
196
|
+
opts[:acceptable_exit_codes] << 4
|
197
|
+
else
|
198
|
+
opts[:acceptable_exit_codes] = [0, 4] unless opts[:accept_all_exit_codes]
|
199
|
+
end
|
183
200
|
execute("pkg #{cmdline_args} update #{name}", opts)
|
184
201
|
when /solaris-10/
|
185
|
-
execute("pkgutil -u -y #{cmdline_args}
|
202
|
+
execute("pkgutil -u -y #{cmdline_args} #{name}", opts)
|
186
203
|
else
|
187
204
|
raise "Package #{name} cannot be upgraded on #{self}"
|
188
205
|
end
|
@@ -50,4 +50,30 @@ module Windows::Exec
|
|
50
50
|
result.exit_code == 0
|
51
51
|
end
|
52
52
|
|
53
|
+
# Restarts the SSH service.
|
54
|
+
#
|
55
|
+
# @return [Result] result of starting SSH service
|
56
|
+
def ssh_service_restart
|
57
|
+
command_result = nil
|
58
|
+
# we get periodic failures to restart the service, so looping these with re-attempts
|
59
|
+
repeat_fibonacci_style_for(5) do
|
60
|
+
0 == exec(Beaker::Command.new("cygrunsrv -E sshd"), :acceptable_exit_codes => [0, 1] ).exit_code
|
61
|
+
end
|
62
|
+
repeat_fibonacci_style_for(5) do
|
63
|
+
command_result = exec(Beaker::Command.new("cygrunsrv -S sshd"), :acceptable_exit_codes => [0, 1] )
|
64
|
+
0 == command_result.exit_code
|
65
|
+
end
|
66
|
+
command_result
|
67
|
+
end
|
68
|
+
|
69
|
+
# Sets the PermitUserEnvironment setting & restarts the SSH service
|
70
|
+
#
|
71
|
+
# @api private
|
72
|
+
# @return [Result] result of the command starting the SSH service
|
73
|
+
# (from {#ssh_service_restart}).
|
74
|
+
def ssh_permit_user_environment
|
75
|
+
exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/sshd_config"))
|
76
|
+
ssh_service_restart()
|
77
|
+
end
|
78
|
+
|
53
79
|
end
|
@@ -21,6 +21,7 @@ module Beaker
|
|
21
21
|
SLES_PACKAGES = ['curl', 'ntp']
|
22
22
|
DEBIAN_PACKAGES = ['curl', 'ntpdate', 'lsb-release']
|
23
23
|
CUMULUS_PACKAGES = ['curl', 'ntpdate']
|
24
|
+
SOLARIS10_PACKAGES = ['CSWcurl', 'CSWntp']
|
24
25
|
ETC_HOSTS_PATH = "/etc/hosts"
|
25
26
|
ETC_HOSTS_PATH_SOLARIS = "/etc/inet/hosts"
|
26
27
|
ROOT_KEYS_SCRIPT = "https://raw.githubusercontent.com/puppetlabs/puppetlabs-sshkeys/master/templates/scripts/manage_root_authorized_keys"
|
@@ -107,6 +108,8 @@ module Beaker
|
|
107
108
|
check_and_install_packages_if_needed(host, FREEBSD_PACKAGES)
|
108
109
|
when host['platform'] =~ /openbsd/
|
109
110
|
check_and_install_packages_if_needed(host, OPENBSD_PACKAGES)
|
111
|
+
when host['platform'] =~ /solaris-10/
|
112
|
+
check_and_install_packages_if_needed(host, SOLARIS10_PACKAGES)
|
110
113
|
when host['platform'] !~ /debian|aix|solaris|windows|sles-|osx-|cumulus|f5-/
|
111
114
|
check_and_install_packages_if_needed(host, UNIX_PACKAGES)
|
112
115
|
end
|
@@ -523,72 +526,13 @@ module Beaker
|
|
523
526
|
next if host['platform'] =~ /f5/
|
524
527
|
env = construct_env(host, opts)
|
525
528
|
logger.debug("setting local environment on #{host.name}")
|
526
|
-
|
527
|
-
|
528
|
-
if host.is_cygwin?
|
529
|
-
host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /etc/sshd_config"))
|
530
|
-
# we get periodic failures to restart the service, so looping these with re-attempts
|
531
|
-
repeat_fibonacci_style_for(5) do
|
532
|
-
0 == host.exec(Command.new("cygrunsrv -E sshd"), :acceptable_exit_codes => [0, 1] ).exit_code
|
533
|
-
end
|
534
|
-
repeat_fibonacci_style_for(5) do
|
535
|
-
0 == host.exec(Command.new("cygrunsrv -S sshd"), :acceptable_exit_codes => [0, 1] ).exit_code
|
536
|
-
end
|
537
|
-
env['CYGWIN'] = 'nodosfilewarning'
|
538
|
-
else
|
539
|
-
#nothing to do here
|
540
|
-
end
|
541
|
-
when /osx-10\.*11/
|
542
|
-
host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /private/etc/ssh/sshd_config"))
|
543
|
-
host.exec(Command.new("launchctl unload /System/Library/LaunchDaemons/ssh.plist"))
|
544
|
-
host.exec(Command.new("launchctl load /System/Library/LaunchDaemons/ssh.plist"))
|
545
|
-
when /osx/
|
546
|
-
host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /etc/sshd_config"))
|
547
|
-
host.exec(Command.new("launchctl unload /System/Library/LaunchDaemons/ssh.plist"))
|
548
|
-
host.exec(Command.new("launchctl load /System/Library/LaunchDaemons/ssh.plist"))
|
549
|
-
when /debian|ubuntu|cumulus/
|
550
|
-
host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
551
|
-
host.exec(Command.new("service ssh restart"))
|
552
|
-
when /el-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7/
|
553
|
-
host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
554
|
-
host.exec(Command.new("systemctl restart sshd.service"))
|
555
|
-
when /el-|centos|fedora|redhat|oracle|scientific|eos/
|
556
|
-
host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
557
|
-
host.exec(Command.new("/sbin/service sshd restart"))
|
558
|
-
when /sles/
|
559
|
-
host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
560
|
-
host.exec(Command.new("rcsshd restart"))
|
561
|
-
when /solaris/
|
562
|
-
host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
563
|
-
host.exec(Command.new("svcadm restart svc:/network/ssh:default"))
|
564
|
-
when /aix/
|
565
|
-
host.exec(Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
|
566
|
-
host.exec(Command.new("stopsrc -g ssh"))
|
567
|
-
host.exec(Command.new("startsrc -g ssh"))
|
568
|
-
when /(free|open)bsd/
|
569
|
-
host.exec(Command.new("sudo perl -pi -e 's/^#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config"), {:pty => true} )
|
570
|
-
host.exec(Command.new("sudo /etc/rc.d/sshd restart"))
|
529
|
+
if host['platform'] =~ /windows/ and host.is_cygwin?
|
530
|
+
env['CYGWIN'] = 'nodosfilewarning'
|
571
531
|
end
|
532
|
+
host.ssh_permit_user_environment()
|
533
|
+
|
534
|
+
host.ssh_set_user_environment(env)
|
572
535
|
|
573
|
-
if not host.is_powershell?
|
574
|
-
#ensure that ~/.ssh/environment exists
|
575
|
-
host.exec(Command.new("mkdir -p #{Pathname.new(host[:ssh_env_file]).dirname}"))
|
576
|
-
host.exec(Command.new("chmod 0600 #{Pathname.new(host[:ssh_env_file]).dirname}"))
|
577
|
-
host.exec(Command.new("touch #{host[:ssh_env_file]}"))
|
578
|
-
#add the constructed env vars to this host
|
579
|
-
host.add_env_var('PATH', '$PATH')
|
580
|
-
# FIXME
|
581
|
-
if host['platform'] =~ /openbsd-(\d)\.?(\d)-(.+)/
|
582
|
-
version = "#{$1}.#{$2}"
|
583
|
-
arch = $3
|
584
|
-
arch = 'amd64' if ['x64', 'x86_64'].include?(arch)
|
585
|
-
host.add_env_var('PKG_PATH', "http://ftp.openbsd.org/pub/OpenBSD/#{version}/packages/#{arch}/")
|
586
|
-
end
|
587
|
-
end
|
588
|
-
#add the env var set to this test host
|
589
|
-
env.each_pair do |var, value|
|
590
|
-
host.add_env_var(var, value)
|
591
|
-
end
|
592
536
|
# REMOVE POST BEAKER 3: backwards compatability, do some setup based upon the global type
|
593
537
|
# this is the worst and i hate it
|
594
538
|
Class.new.extend(Beaker::DSL).configure_type_defaults_on(host)
|
data/lib/beaker/version.rb
CHANGED
@@ -492,71 +492,69 @@ describe Beaker do
|
|
492
492
|
context "set_env" do
|
493
493
|
subject { dummy_class.new }
|
494
494
|
|
495
|
-
it "
|
496
|
-
|
497
|
-
"echo '\nPermitUserEnvironment yes' >> /etc/sshd_config",
|
498
|
-
"cygrunsrv -E sshd",
|
499
|
-
"cygrunsrv -S sshd"
|
500
|
-
]
|
501
|
-
set_env_helper('windows', commands)
|
495
|
+
it "permits user environments on an OS X host" do
|
496
|
+
test_host_ssh_permit_user_environment('osx')
|
502
497
|
end
|
503
498
|
|
504
|
-
it "
|
505
|
-
|
506
|
-
"echo '\nPermitUserEnvironment yes' >> /etc/sshd_config",
|
507
|
-
"launchctl unload /System/Library/LaunchDaemons/ssh.plist",
|
508
|
-
"launchctl load /System/Library/LaunchDaemons/ssh.plist"
|
509
|
-
]
|
510
|
-
set_env_helper('osx', commands)
|
499
|
+
it "permits user environments on an ssh-based linux host" do
|
500
|
+
test_host_ssh_permit_user_environment('ubuntu')
|
511
501
|
end
|
512
502
|
|
513
|
-
it "
|
514
|
-
|
515
|
-
"echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config",
|
516
|
-
"service ssh restart"
|
517
|
-
]
|
518
|
-
set_env_helper('ubuntu', commands)
|
503
|
+
it "permits user environments on an sshd-based linux host" do
|
504
|
+
test_host_ssh_permit_user_environment('eos')
|
519
505
|
end
|
520
506
|
|
521
|
-
it "
|
522
|
-
|
523
|
-
"echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config",
|
524
|
-
"/sbin/service sshd restart"
|
525
|
-
]
|
526
|
-
set_env_helper('eos', commands)
|
507
|
+
it "permits user environments on an sles host" do
|
508
|
+
test_host_ssh_permit_user_environment('sles')
|
527
509
|
end
|
528
510
|
|
529
|
-
it "
|
530
|
-
|
531
|
-
"echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config",
|
532
|
-
"rcsshd restart"
|
533
|
-
]
|
534
|
-
set_env_helper('sles', commands)
|
511
|
+
it "permits user environments on a solaris host" do
|
512
|
+
test_host_ssh_permit_user_environment('solaris')
|
535
513
|
end
|
536
514
|
|
537
|
-
it "
|
538
|
-
|
539
|
-
"echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config",
|
540
|
-
"svcadm restart svc:/network/ssh:default"
|
541
|
-
]
|
542
|
-
set_env_helper('solaris', commands)
|
515
|
+
it "permits user environments on an aix host" do
|
516
|
+
test_host_ssh_permit_user_environment('aix')
|
543
517
|
end
|
544
518
|
|
545
|
-
it "
|
546
|
-
|
547
|
-
"echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config",
|
548
|
-
"stopsrc -g ssh",
|
549
|
-
"startsrc -g ssh"
|
550
|
-
]
|
551
|
-
set_env_helper('aix', commands)
|
519
|
+
it "permits user environments on a FreeBSD host" do
|
520
|
+
test_host_ssh_permit_user_environment('freebsd')
|
552
521
|
end
|
553
522
|
|
554
|
-
it "
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
523
|
+
it "permits user environments on a windows host" do
|
524
|
+
test_host_ssh_permit_user_environment('windows')
|
525
|
+
end
|
526
|
+
|
527
|
+
|
528
|
+
it "sets user ssh environment on an OS X host" do
|
529
|
+
test_host_ssh_set_user_environment('osx')
|
530
|
+
end
|
531
|
+
|
532
|
+
it "sets user ssh environment on an ssh-based linux host" do
|
533
|
+
test_host_ssh_set_user_environment('ubuntu')
|
534
|
+
end
|
535
|
+
|
536
|
+
it "sets user ssh environment on an sshd-based linux host" do
|
537
|
+
test_host_ssh_set_user_environment('eos')
|
538
|
+
end
|
539
|
+
|
540
|
+
it "sets user ssh environment on an sles host" do
|
541
|
+
test_host_ssh_set_user_environment('sles')
|
542
|
+
end
|
543
|
+
|
544
|
+
it "sets user ssh environment on a solaris host" do
|
545
|
+
test_host_ssh_set_user_environment('solaris')
|
546
|
+
end
|
547
|
+
|
548
|
+
it "sets user ssh environment on an aix host" do
|
549
|
+
test_host_ssh_set_user_environment('aix')
|
550
|
+
end
|
551
|
+
|
552
|
+
it "sets user ssh environment on a FreeBSD host" do
|
553
|
+
test_host_ssh_set_user_environment('freebsd')
|
554
|
+
end
|
555
|
+
|
556
|
+
it "sets user ssh environment on a windows host" do
|
557
|
+
test_host_ssh_set_user_environment('windows')
|
560
558
|
end
|
561
559
|
|
562
560
|
it "skips an f5 host correctly" do
|
@@ -585,33 +583,27 @@ describe Beaker do
|
|
585
583
|
subject.set_env(host, options.merge( opts ))
|
586
584
|
end
|
587
585
|
|
588
|
-
def
|
586
|
+
def test_host_ssh_permit_user_environment(platform_name)
|
587
|
+
test_host_ssh_calls(platform_name, :ssh_permit_user_environment)
|
588
|
+
end
|
589
|
+
|
590
|
+
def test_host_ssh_set_user_environment(platform_name)
|
591
|
+
test_host_ssh_calls(platform_name, :ssh_set_user_environment)
|
592
|
+
end
|
593
|
+
|
594
|
+
def test_host_ssh_calls(platform_name, method_call_sym)
|
589
595
|
host = make_host('name', {
|
590
596
|
:platform => platform_name,
|
591
597
|
:ssh_env_file => 'ssh_env_file',
|
592
598
|
:is_cygwin => true,
|
593
|
-
|
599
|
+
} )
|
594
600
|
opts = {
|
595
|
-
|
596
|
-
|
601
|
+
:env1_key => :env1_value,
|
602
|
+
:env2_key => :env2_value
|
597
603
|
}
|
598
604
|
|
599
605
|
expect( subject ).to receive( :construct_env ).and_return( opts )
|
600
|
-
|
601
|
-
expect( Beaker::Command ).to receive( :new ).with( command ).once
|
602
|
-
end
|
603
|
-
|
604
|
-
expect( Beaker::Command ).to receive( :new ).with( "mkdir -p #{Pathname.new(host[:ssh_env_file]).dirname}" ).once
|
605
|
-
expect( Beaker::Command ).to receive( :new ).with( "chmod 0600 #{Pathname.new(host[:ssh_env_file]).dirname}" ).once
|
606
|
-
expect( Beaker::Command ).to receive( :new ).with( "touch #{host[:ssh_env_file]}" ).once
|
607
|
-
expect_any_instance_of( Class ).to receive( :extend ).and_return( double( 'class' ).as_null_object )
|
608
|
-
expect( Beaker::Command ).to receive( :new ).with( "cat #{host[:ssh_env_file]}" ).once
|
609
|
-
expect( host ).to receive( :add_env_var ).with( 'PATH', '$PATH' ).once
|
610
|
-
opts.each_pair do |key, value|
|
611
|
-
expect( host ).to receive( :add_env_var ).with( key, value ).once
|
612
|
-
end
|
613
|
-
expect( host ).to receive( :add_env_var ).with( 'CYGWIN', 'nodosfilewarning' ).once if platform_name =~ /windows/
|
614
|
-
expect( host ).to receive( :exec ).exactly( host_specific_commands_array.length + 4 ).times
|
606
|
+
expect( host ).to receive( method_call_sym )
|
615
607
|
|
616
608
|
subject.set_env(host, options.merge( opts ))
|
617
609
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.29.
|
4
|
+
version: 2.29.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -360,6 +360,20 @@ dependencies:
|
|
360
360
|
- - ! '>='
|
361
361
|
- !ruby/object:Gem::Version
|
362
362
|
version: '0'
|
363
|
+
- !ruby/object:Gem::Dependency
|
364
|
+
name: mime-types
|
365
|
+
requirement: !ruby/object:Gem::Requirement
|
366
|
+
requirements:
|
367
|
+
- - ~>
|
368
|
+
- !ruby/object:Gem::Version
|
369
|
+
version: '2.99'
|
370
|
+
type: :runtime
|
371
|
+
prerelease: false
|
372
|
+
version_requirements: !ruby/object:Gem::Requirement
|
373
|
+
requirements:
|
374
|
+
- - ~>
|
375
|
+
- !ruby/object:Gem::Version
|
376
|
+
version: '2.99'
|
363
377
|
- !ruby/object:Gem::Dependency
|
364
378
|
name: fog-google
|
365
379
|
requirement: !ruby/object:Gem::Requirement
|
@@ -505,6 +519,7 @@ files:
|
|
505
519
|
- acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb
|
506
520
|
- acceptance/tests/base/dsl/install_utils/clone_git_repo_on_test.rb
|
507
521
|
- acceptance/tests/base/dsl/structure_test.rb
|
522
|
+
- acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb
|
508
523
|
- acceptance/tests/base/host_test.rb
|
509
524
|
- acceptance/tests/base/packages.rb
|
510
525
|
- acceptance/tests/base/packages_unix.rb
|