beaker 2.33.0 → 2.34.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/HISTORY.md +173 -2
- data/README.md +5 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb +0 -5
- data/acceptance/tests/base/dsl/helpers/host_helpers/install_package_test.rb +0 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +0 -4
- data/docs/Beaker-Libraries.md +8 -0
- data/docs/Beaker-Recipes.md +13 -0
- data/docs/Docker-Support.md +19 -0
- data/docs/README.md +2 -0
- data/docs/hosts/cisco.md +60 -0
- data/docs/hosts/eos.md +2 -2
- data/lib/beaker/command.rb +4 -45
- data/lib/beaker/dsl/helpers/host_helpers.rb +14 -9
- data/lib/beaker/dsl/install_utils/foss_utils.rb +32 -32
- data/lib/beaker/host.rb +7 -3
- data/lib/beaker/host/cisco.rb +124 -0
- data/lib/beaker/host/pswindows/exec.rb +11 -0
- data/lib/beaker/host/pswindows/user.rb +1 -1
- data/lib/beaker/host/unix.rb +9 -2
- data/lib/beaker/host/unix/exec.rb +43 -0
- data/lib/beaker/host/unix/file.rb +19 -4
- data/lib/beaker/host/windows/exec.rb +13 -0
- data/lib/beaker/host/windows/user.rb +1 -1
- data/lib/beaker/hypervisor/docker.rb +9 -0
- data/lib/beaker/network_manager.rb +3 -1
- data/lib/beaker/test_case.rb +2 -0
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/command_spec.rb +17 -27
- data/spec/beaker/dsl/helpers/host_helpers_spec.rb +13 -1
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +24 -15
- data/spec/beaker/dsl/install_utils/module_utils_spec.rb +2 -1
- data/spec/beaker/host/cisco_spec.rb +182 -0
- data/spec/beaker/host/pswindows/exec_spec.rb +54 -0
- data/spec/beaker/host/pswindows/user_spec.rb +70 -0
- data/spec/beaker/host/unix/exec_spec.rb +30 -0
- data/spec/beaker/host/unix/file_spec.rb +11 -4
- data/spec/beaker/host/unix/pkg_spec.rb +0 -1
- data/spec/beaker/host/unix_spec.rb +9 -0
- data/spec/beaker/host/windows/exec_spec.rb +17 -24
- data/spec/beaker/host/windows/user_spec.rb +70 -0
- data/spec/beaker/host_spec.rb +21 -0
- data/spec/beaker/hypervisor/docker_spec.rb +35 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmU2OTY2MTQ3ZWU5Y2U4NDk1ZjRlYTY3MWRiYWZkZmVlMWUyODhlOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTlkNzcxYjc0YTMxMzgwODhiOGZhZDQ3Mzg5NjZlNTViMTFkZDI5YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmI5N2ViNjA2MWU4M2VkNzJlNzJhMjU5NWFjMGJjNTM2ZTI4MGU4Mzc5YWEx
|
10
|
+
OGVkMjM1NDlhOGI1Y2Q0OTYwNjBiNGQ3NWE1Nzg2M2IxNmJmM2NhYzNjOWU4
|
11
|
+
MzRlNGVmZDkwNWFlYTFmODM4NTAyY2RmZjkyNmYxNDQ3MjY3MmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWU3MmI2ZjM0OWQ4M2M3NTQ1OTg4MTcyYTg0Nzc1MjBjMGQzZjdkZWVhN2Fm
|
14
|
+
NDkxMjJjNjg3NWVmZTQzMWRmZTBjOTgyMWU3YWY3ODM1YmQ4YjY4N2ExNGE0
|
15
|
+
ZDVjMjRiZGVhODU2MDBiMWU4Y2FmY2Y4YmQ2N2U5ZTllYWVmYjE=
|
data/HISTORY.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# default - History
|
2
2
|
## Tags
|
3
|
-
* [LATEST -
|
3
|
+
* [LATEST - 10 Feb, 2016 (78b7dd79)](#LATEST)
|
4
|
+
* [2.33.0 - 27 Jan, 2016 (0dd8505a)](#2.33.0)
|
4
5
|
* [2.32.1 - 14 Jan, 2016 (8c394fdb)](#2.32.1)
|
5
6
|
* [2.32.0 - 12 Jan, 2016 (80e153cc)](#2.32.0)
|
6
7
|
* [2.31.0 - 16 Dec, 2015 (54b1801d)](#2.31.0)
|
@@ -108,7 +109,177 @@
|
|
108
109
|
* [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
|
109
110
|
|
110
111
|
## Details
|
111
|
-
### <a name = "LATEST">LATEST -
|
112
|
+
### <a name = "LATEST">LATEST - 10 Feb, 2016 (78b7dd79)
|
113
|
+
|
114
|
+
* (GEM) update beaker version to 2.34.0 (78b7dd79)
|
115
|
+
|
116
|
+
* Merge pull request #1064 from kevpl/maint_cisco_docadd (ecdbafbc)
|
117
|
+
|
118
|
+
|
119
|
+
```
|
120
|
+
Merge pull request #1064 from kevpl/maint_cisco_docadd
|
121
|
+
|
122
|
+
(MAINT) added cisco platform doc
|
123
|
+
```
|
124
|
+
* Merge pull request #1062 from kevpl/bkr667_cisco7_provision (1b662ddf)
|
125
|
+
|
126
|
+
|
127
|
+
```
|
128
|
+
Merge pull request #1062 from kevpl/bkr667_cisco7_provision
|
129
|
+
|
130
|
+
(BKR-667) added wrlinux7 provisioning support
|
131
|
+
```
|
132
|
+
* (MAINT) added cisco platform doc (8ffb6f07)
|
133
|
+
|
134
|
+
* Merge pull request #1056 from objectverbobject/BKR-513 (3bc8c548)
|
135
|
+
|
136
|
+
|
137
|
+
```
|
138
|
+
Merge pull request #1056 from objectverbobject/BKR-513
|
139
|
+
|
140
|
+
Revert "(BKR-358) get ubuntu 15.04 builds green"
|
141
|
+
```
|
142
|
+
* Merge pull request #1055 from cowofevil/doc/master/update_readme (3c7d6fdc)
|
143
|
+
|
144
|
+
|
145
|
+
```
|
146
|
+
Merge pull request #1055 from cowofevil/doc/master/update_readme
|
147
|
+
|
148
|
+
(MAINT) Add README Information for Beaker Libraries
|
149
|
+
```
|
150
|
+
* (BKR-667) refactor cisco specific code into its own host object (eadc206c)
|
151
|
+
|
152
|
+
* Merge pull request #1061 from kevpl/bkr695_puppetconf_windows (eae84239)
|
153
|
+
|
154
|
+
|
155
|
+
```
|
156
|
+
Merge pull request #1061 from kevpl/bkr695_puppetconf_windows
|
157
|
+
|
158
|
+
(BKR-695) fix configure_puppet_on for windows
|
159
|
+
```
|
160
|
+
* Merge pull request #1051 from kevpl/bkr668_wrlinux5_puppetagentinstall (52ad675d)
|
161
|
+
|
162
|
+
|
163
|
+
```
|
164
|
+
Merge pull request #1051 from kevpl/bkr668_wrlinux5_puppetagentinstall
|
165
|
+
|
166
|
+
(BKR-668) wrlinux5 puppet-agent install support added
|
167
|
+
```
|
168
|
+
* Merge pull request #1058 from Iristyle/maint/fix-windows-user_list (6260d231)
|
169
|
+
|
170
|
+
|
171
|
+
```
|
172
|
+
Merge pull request #1058 from Iristyle/maint/fix-windows-user_list
|
173
|
+
|
174
|
+
(maint) Fix Windows user_list functionality
|
175
|
+
```
|
176
|
+
* (BKR-695) fix configure_puppet_on for windows (27661d96)
|
177
|
+
|
178
|
+
* (maint) Fix Windows user_list functionality (fe15bcfe)
|
179
|
+
|
180
|
+
|
181
|
+
```
|
182
|
+
(maint) Fix Windows user_list functionality
|
183
|
+
|
184
|
+
- Existing functionality used an overly restrictive regex that didn't
|
185
|
+
account for characters like - or . in Windows user names, which are
|
186
|
+
completely valid.
|
187
|
+
|
188
|
+
Use a less restrictive regex to capture the value correctly. The
|
189
|
+
results of wmic always include the username immediately after the
|
190
|
+
= in the Name= string
|
191
|
+
```
|
192
|
+
* Revert "(BKR-358) get ubuntu 15.04 builds green" (53cfea20)
|
193
|
+
|
194
|
+
|
195
|
+
```
|
196
|
+
Revert "(BKR-358) get ubuntu 15.04 builds green"
|
197
|
+
|
198
|
+
This reverts commit 9d400ef4e08aa89f6174af7fdef3c6b160fbe620.
|
199
|
+
```
|
200
|
+
* Merge pull request #1053 from nhemingway/neilh/BKR-637-docker-volumes (d4da4aaa)
|
201
|
+
|
202
|
+
|
203
|
+
```
|
204
|
+
Merge pull request #1053 from nhemingway/neilh/BKR-637-docker-volumes
|
205
|
+
|
206
|
+
(BKR-637) Support mounting volumes with docker
|
207
|
+
```
|
208
|
+
* Merge pull request #1054 from er0ck/task/master/move_recipes_from_confluence (ad8122f3)
|
209
|
+
|
210
|
+
|
211
|
+
```
|
212
|
+
Merge pull request #1054 from er0ck/task/master/move_recipes_from_confluence
|
213
|
+
|
214
|
+
(maint) move recipes from confluence
|
215
|
+
```
|
216
|
+
* Merge pull request #1052 from samwoods1/teardown_info_log (a640b3f6)
|
217
|
+
|
218
|
+
|
219
|
+
```
|
220
|
+
Merge pull request #1052 from samwoods1/teardown_info_log
|
221
|
+
|
222
|
+
Add info log when teardown begins
|
223
|
+
```
|
224
|
+
* (BKR-668) used specific command to set env var for cisco-5 (7308c4ff)
|
225
|
+
|
226
|
+
* (BKR-668) fixed non-root SCP issue for cisco-5 (c5913ac0)
|
227
|
+
|
228
|
+
* (MAINT) Add README Information for Beaker Libraries (bd9619c3)
|
229
|
+
|
230
|
+
|
231
|
+
```
|
232
|
+
(MAINT) Add README Information for Beaker Libraries
|
233
|
+
|
234
|
+
Update the Beaker docs README to point to the public Beaker libraries.
|
235
|
+
```
|
236
|
+
* (maint) move recipes from confluence (26af5654)
|
237
|
+
|
238
|
+
|
239
|
+
```
|
240
|
+
(maint) move recipes from confluence
|
241
|
+
|
242
|
+
This change adds a document containing some recipes for solving common
|
243
|
+
problems with Beaker. It is currently housed on confluence.
|
244
|
+
```
|
245
|
+
* (BKR-668) fixed SCP to root owned files for cisco-5 (b2dd3185)
|
246
|
+
|
247
|
+
* (BKR-637) Rename options to be clearer (8b8f2ce4)
|
248
|
+
|
249
|
+
* (BKR-637) Support mounting volumes with docker (aa2847ed)
|
250
|
+
|
251
|
+
* (BKR-668) dealt with on / puppet issue (details below): (f78c2db4)
|
252
|
+
|
253
|
+
|
254
|
+
```
|
255
|
+
(BKR-668) dealt with on / puppet issue (details below):
|
256
|
+
|
257
|
+
if you executed this code
|
258
|
+
|
259
|
+
on( host, puppet( 'status' ) )
|
260
|
+
|
261
|
+
on a cisco host, you would get double prefixing. Thats because if
|
262
|
+
you pass the method a Beaker::Command object, it would reverse
|
263
|
+
it to the command string & re-build the Command object again. This
|
264
|
+
change makes it so that if a Command object is passed, it gets used,
|
265
|
+
since the reason for creating a Command object is to pass in other
|
266
|
+
arguments youd like to be a part of execution.
|
267
|
+
```
|
268
|
+
* (BKR-667) added wrlinux7 provisioning support (bb06c9a4)
|
269
|
+
|
270
|
+
* (MAINT) Add info log when teardown begins (d24f5b47)
|
271
|
+
|
272
|
+
* (BKR-668) guarding against 'vsh' usage on cisco platforms (3e1d7690)
|
273
|
+
|
274
|
+
* (BKR-668) install_puppet_agent_dev_repo_on support added for cisco-5 (a6f3c67d)
|
275
|
+
|
276
|
+
* (BKR-668) refactored host-based commands into host objects (f548df7b)
|
277
|
+
|
278
|
+
* (BKR-668) install_puppet_agent_on cisco-5 support added (0ab82acb)
|
279
|
+
|
280
|
+
### <a name = "2.33.0">2.33.0 - 27 Jan, 2016 (0dd8505a)
|
281
|
+
|
282
|
+
* (HISTORY) update beaker history for gem release 2.33.0 (0dd8505a)
|
112
283
|
|
113
284
|
* (GEM) update beaker version to 2.33.0 (abf7e410)
|
114
285
|
|
data/README.md
CHANGED
@@ -10,6 +10,11 @@ See [Beaker Installation](https://github.com/puppetlabs/beaker/wiki/Beaker-Insta
|
|
10
10
|
|
11
11
|
Documentation for Beaker can be found in this repository in [the docs/ folder](docs/README.md).
|
12
12
|
|
13
|
+
#Beaker Libraries
|
14
|
+
|
15
|
+
Beaker functionality has been extended through the use of libraries available as gems. See the
|
16
|
+
[complete list](docs/Beaker-Libraries.md) for more details.
|
17
|
+
|
13
18
|
#Beaker API
|
14
19
|
|
15
20
|
[RubyDoc Beaker Documentation Server](http://rubydoc.info/github/puppetlabs/beaker/frames)
|
@@ -16,11 +16,6 @@ end
|
|
16
16
|
|
17
17
|
test_name "dsl::helpers::host_helpers #check_for_package" do
|
18
18
|
|
19
|
-
# NOTE: vivid packages are not ready on nightlies.puppetlabs.com,
|
20
|
-
# see: https://tickets.puppetlabs.com/browse/CPR-173
|
21
|
-
# also: https://tickets.puppetlabs.com/browse/BKR-513
|
22
|
-
confine :except, :platform => /ubuntu.*15/
|
23
|
-
|
24
19
|
# NOTE: there does not appear to be a way to confine just to cygwin hosts
|
25
20
|
confine_block :to, :platform => /windows/ do
|
26
21
|
|
@@ -1,10 +1,6 @@
|
|
1
1
|
require "helpers/test_helper"
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #install_package" do
|
4
|
-
# NOTE: vivid packages are not ready on nightlies.puppetlabs.com,
|
5
|
-
# see: https://tickets.puppetlabs.com/browse/CPR-173
|
6
|
-
# also: https://tickets.puppetlabs.com/browse/BKR-513
|
7
|
-
confine :except, :platform => /ubuntu.*15/
|
8
4
|
|
9
5
|
# NOTE: there does not appear to be a way to confine just to cygwin hosts
|
10
6
|
confine_block :to, :platform => /windows/ do
|
@@ -1,10 +1,6 @@
|
|
1
1
|
require "helpers/test_helper"
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #upgrade_package" do
|
4
|
-
# NOTE: vivid packages are not ready on nightlies.puppetlabs.com,
|
5
|
-
# see: https://tickets.puppetlabs.com/browse/CPR-173
|
6
|
-
# also: https://tickets.puppetlabs.com/browse/BKR-513
|
7
|
-
confine :except, :platform => /ubuntu.*15/
|
8
4
|
|
9
5
|
# NOTE: there does not appear to be a way to confine just to cygwin hosts
|
10
6
|
confine_block :to, :platform => /windows/ do
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Beaker Libraries
|
2
|
+
The QA team at Puppet Labs has written several libraries that extends the functionality provided
|
3
|
+
by Beaker.
|
4
|
+
|
5
|
+
| Name | Description | Docs |
|
6
|
+
|:-------------------|:--------------------------------------------------------------------|:----------------------------------------------------------------|
|
7
|
+
| Master Manipulator | A Beaker library for changing configuration on a Puppet Master | [Github Repo](https://github.com/puppetlabs/master_manipulator) |
|
8
|
+
| beaker_windows | A Beaker library that provides helpers for testing on Windows hosts | [Github Repo](https://github.com/puppetlabs/beaker_windows) |
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# What is This?
|
2
|
+
|
3
|
+
Patterns for best-use solutions to (not so) common problems
|
4
|
+
|
5
|
+
## How do i set persistent environment variables on a SUT, such as PATH?
|
6
|
+
host.add_env_var('PATH', '/opt/puppetlabs/bin:$PATH')
|
7
|
+
|
8
|
+
## How do i run commands on a SUT as a non-root user?
|
9
|
+
(warning) this should be abstracted into a beaker helper, or part of on(): BKR-168 - Beaker::DSL::Helpers needs "as" method READY FOR ENGINEERING
|
10
|
+
|
11
|
+
###create the user, then su with --command:
|
12
|
+
on(host, puppet("resource user #{username} ensure=present managehome-true"))
|
13
|
+
on(host, "su #{username} --command '#{command}'")
|
data/docs/Docker-Support.md
CHANGED
@@ -79,6 +79,25 @@ ssh:
|
|
79
79
|
auth_methods: ["password"]
|
80
80
|
```
|
81
81
|
|
82
|
+
### Mounting volumes into your docker container ###
|
83
|
+
You can mount folders into a docker container:
|
84
|
+
|
85
|
+
HOSTS:
|
86
|
+
ubuntu-12-10:
|
87
|
+
platform: ubuntu-12.10-x64
|
88
|
+
image: ubuntu:12.10
|
89
|
+
hypervisor: docker
|
90
|
+
mount_folders:
|
91
|
+
name1:
|
92
|
+
host_path: host_path1
|
93
|
+
container_path: container_path1
|
94
|
+
name2:
|
95
|
+
host_path: host_path2
|
96
|
+
container_path: container_path2
|
97
|
+
opts: rw
|
98
|
+
CONFIG:
|
99
|
+
type: foss
|
100
|
+
|
82
101
|
### Example Output
|
83
102
|
|
84
103
|
For this example made a new docker nodeset file in the [puppetlabs-inifile](https://github.com/puppetlabs/puppetlabs-inifile) repo and ran the ini_setting_spec.rb spec:
|
data/docs/README.md
CHANGED
@@ -30,8 +30,10 @@
|
|
30
30
|
* [Let's Write a Test!](Lets-Write-a-Test.md)
|
31
31
|
* [Access The Live Test Console with Pry](Access-the-Live-Test-Console-with-Pry.md)
|
32
32
|
* [Test Tagging](Beaker-Test-Tagging.md)
|
33
|
+
* [Recipes](Beaker-Recipes.md)
|
33
34
|
* [Beaker vs. Beaker-rspec](beaker-vs.-beaker-rspec.md)
|
34
35
|
* [How to Write a Beaker Test for a Module Using beaker-rspec](How-to-Write-a-Beaker-Test-for-a-Module.md)
|
36
|
+
* [Beaker Libraries](Beaker-Libraries.md)
|
35
37
|
|
36
38
|
## Other Resources
|
37
39
|
|
data/docs/hosts/cisco.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Wind River Linux
|
2
|
+
|
3
|
+
Wind River Linux is an embedded systems OS from Wind, an Intel Company. You
|
4
|
+
can get more details on this from their
|
5
|
+
[product page](http://www.windriver.com/products/linux/).
|
6
|
+
|
7
|
+
Wind River Linux support came to Beaker through testing Cisco network
|
8
|
+
devices, so our platform codename for this OS is `cisco`.
|
9
|
+
|
10
|
+
Beaker currently can install puppet on WRLinux NXOS (5) and EXR (7).
|
11
|
+
|
12
|
+
# Host Requirements
|
13
|
+
|
14
|
+
WRLinux hosts validate their setup once created, and will fail if not
|
15
|
+
setup correctly. There are two conditions that are validated specifically
|
16
|
+
on WRLinux hosts. These conditions are listed below.
|
17
|
+
|
18
|
+
A. All WRLinux hosts will need a `:vrf` value, which determines their
|
19
|
+
virtual routing framework for networking purposes. For our purposes,
|
20
|
+
we tend to use the value `management`, so there is always a hosts
|
21
|
+
file line that looks like this in our configuration:
|
22
|
+
|
23
|
+
HOSTS:
|
24
|
+
<hostname>:
|
25
|
+
...
|
26
|
+
vrf: management
|
27
|
+
|
28
|
+
B. WRLinux NXOS (5) hosts will also require a user to be set on the
|
29
|
+
hosts. This is because they don't allow ssh'ing as the root user,
|
30
|
+
which is one of the main assumptions that Beaker operates under in
|
31
|
+
the usual case. In order to specify a user to ssh with, add this
|
32
|
+
block to a host:
|
33
|
+
|
34
|
+
HOSTS:
|
35
|
+
<hostname>:
|
36
|
+
...
|
37
|
+
ssh:
|
38
|
+
user: <username>
|
39
|
+
|
40
|
+
# Hypervisors
|
41
|
+
|
42
|
+
WRLinux has only been developed and tested as a
|
43
|
+
[vmpooler](https://github.com/puppetlabs/vmpooler) host.
|
44
|
+
|
45
|
+
This doesn't mean that it can't be used in another hypervisor, but that
|
46
|
+
Beaker doesn't specifically deal with the details of that hypervisor in creating
|
47
|
+
WRLinux hosts, if there is anything specific to WRLinux that will need to be done in
|
48
|
+
provisioning steps.
|
49
|
+
|
50
|
+
# Installation Methods
|
51
|
+
|
52
|
+
## Open Source
|
53
|
+
|
54
|
+
In order to install a puppet-agent against a WRLinux host, you'll have to use the
|
55
|
+
[`install_puppet_agent_on`](blob/master/lib/beaker/dsl/install_utils/foss_utils.rb#L327)
|
56
|
+
method.
|
57
|
+
|
58
|
+
It reaches out to the WRLinux-specific host code for any information that it needs.
|
59
|
+
You can check out [these methods](blob/master/lib/beaker/host/cisco.rb) if you
|
60
|
+
need more information about this.
|
data/docs/hosts/eos.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
EOS is the network device OS from Arista. You can get more details from their
|
4
4
|
[product page](https://www.arista.com/en/products/eos).
|
5
5
|
|
6
|
-
#
|
6
|
+
# Hypervisors
|
7
7
|
|
8
8
|
EOS has only been developed and tested as a
|
9
9
|
[vmpooler](https://github.com/puppetlabs/vmpooler) host.
|
@@ -13,7 +13,7 @@ Beaker doesn't specifically deal with the details of that hypervisor in creating
|
|
13
13
|
EOS hosts, if there is anything specific to EOS that will need to be done in
|
14
14
|
provisioning steps.
|
15
15
|
|
16
|
-
#
|
16
|
+
# Installation Methods
|
17
17
|
|
18
18
|
## Puppet Enterprise
|
19
19
|
|
data/lib/beaker/command.rb
CHANGED
@@ -70,12 +70,12 @@ module Beaker
|
|
70
70
|
#
|
71
71
|
# @return [String] This returns the fully formed command line invocation.
|
72
72
|
def cmd_line host, cmd = @command, env = @environment, pc = @prepend_cmds
|
73
|
-
env_string =
|
74
|
-
|
75
|
-
cygwin = ((host['platform'] =~ /windows/) and host.is_cygwin? and @cmdexe) ? 'cmd.exe /c' : nil
|
73
|
+
env_string = host.environment_string( env )
|
74
|
+
prepend_commands = host.prepend_commands( cmd, pc, :cmd_exe => @cmdexe )
|
76
75
|
|
77
76
|
# This will cause things like `puppet -t -v agent` which is maybe bad.
|
78
|
-
[env_string,
|
77
|
+
cmd_line_array = [env_string, prepend_commands, cmd, options_string, args_string]
|
78
|
+
cmd_line_array.compact.reject( &:empty? ).join( ' ' )
|
79
79
|
end
|
80
80
|
|
81
81
|
# @param [Hash] opts These are the options that the command takes
|
@@ -120,48 +120,7 @@ module Beaker
|
|
120
120
|
args.flatten.compact.join(' ')
|
121
121
|
end
|
122
122
|
|
123
|
-
# Construct the environment string for this command
|
124
|
-
#
|
125
|
-
# @param [Host] host A Host object
|
126
|
-
# @param [Hash{String=>String}] env An optional Hash containing
|
127
|
-
# key-value pairs to be treated
|
128
|
-
# as environment variables that
|
129
|
-
# should be set for the duration
|
130
|
-
# of the puppet command.
|
131
|
-
#
|
132
|
-
# @return [String] Returns a string containing command line arguments that
|
133
|
-
# will ensure the environment is correctly set for the
|
134
|
-
# given host.
|
135
|
-
#
|
136
|
-
# @note I dislike the principle of this method. There is host specific
|
137
|
-
# knowledge contained here. Really the relationship should be
|
138
|
-
# reversed where a host is asked for an appropriate Command when
|
139
|
-
# given a generic Command.
|
140
|
-
def environment_string_for host, env
|
141
|
-
return '' if env.empty?
|
142
|
-
env_array = []
|
143
|
-
env.each_key do |key|
|
144
|
-
val = env[key]
|
145
|
-
if val.is_a?(Array)
|
146
|
-
val = val.join(':')
|
147
|
-
else
|
148
|
-
val = val.to_s
|
149
|
-
end
|
150
|
-
env_array << "#{key.to_s.upcase}=\"#{val}\""
|
151
|
-
end
|
152
123
|
|
153
|
-
if not host.is_powershell?
|
154
|
-
environment_string = env_array.join(' ')
|
155
|
-
"env #{environment_string}"
|
156
|
-
else
|
157
|
-
environment_string = ''
|
158
|
-
env_array.each_with_index do |env|
|
159
|
-
environment_string += "set #{env} && "
|
160
|
-
end
|
161
|
-
environment_string
|
162
|
-
end
|
163
|
-
|
164
|
-
end
|
165
124
|
|
166
125
|
end
|
167
126
|
|