chef-provisioning-vsphere 2.2.2 → 2.3.0
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/.travis.yml +4 -2
- data/CHANGELOG.md +10 -1
- data/Gemfile +1 -1
- data/Rakefile +53 -19
- data/chef-provisioning-vsphere.gemspec +26 -26
- data/examples/ubuntu-provision.rb +21 -20
- data/examples/win-provision.rb +25 -26
- data/lib/chef/provisioning/driver_init/vsphere.rb +2 -2
- data/lib/chef/provisioning/vsphere_driver.rb +2 -2
- data/lib/chef/provisioning/vsphere_driver/clone_spec_builder.rb +12 -12
- data/lib/chef/provisioning/vsphere_driver/driver.rb +89 -88
- data/lib/chef/provisioning/vsphere_driver/version.rb +1 -1
- data/lib/chef/provisioning/vsphere_driver/vm_helper.rb +4 -4
- data/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb +37 -37
- data/lib/chef/provisioning/vsphere_driver/vsphere_url.rb +13 -13
- data/lib/kitchen/driver/vsphere.rb +13 -13
- data/spec/integration_tests/vsphere_driver_spec.rb +46 -46
- data/spec/spec_helper.rb +3 -2
- data/spec/unit_tests/VsphereDriver_spec.rb +98 -60
- data/spec/unit_tests/VsphereUrl_spec.rb +24 -24
- data/spec/unit_tests/clone_spec_builder_spec.rb +48 -48
- data/spec/unit_tests/support/vsphere_helper_stub.rb +4 -4
- data/spec/unit_tests/vsphere_helpers_spec.rb +46 -46
- metadata +2 -5
- data/.rubocop.yml +0 -10
- data/.rubocop_todo.yml +0 -135
- data/Jenkinsfile +0 -82
@@ -6,7 +6,7 @@ module ChefProvisioningVsphereStubs
|
|
6
6
|
def network_device_changes(_action_handler, _vm_template, _options)
|
7
7
|
[
|
8
8
|
[RbVmomi::VIM::VirtualDeviceConfigSpec.new],
|
9
|
-
[RbVmomi::VIM::VirtualDeviceConfigSpec.new]
|
9
|
+
[RbVmomi::VIM::VirtualDeviceConfigSpec.new],
|
10
10
|
]
|
11
11
|
end
|
12
12
|
|
@@ -34,7 +34,7 @@ module RbVmomi
|
|
34
34
|
class VIM::HostSystem
|
35
35
|
attr_reader :parent
|
36
36
|
|
37
|
-
def parent
|
37
|
+
def parent # rubocop:disable Lint/DuplicateMethods
|
38
38
|
@parent ||= RbVmomi::VIM::ComputeResource.new
|
39
39
|
end
|
40
40
|
end
|
@@ -44,8 +44,8 @@ module RbVmomi
|
|
44
44
|
class VIM::ComputeResource
|
45
45
|
attr_reader :resourcePool
|
46
46
|
|
47
|
-
def resourcePool
|
48
|
-
@resourcePool ||= RbVmomi::VIM::ResourcePool.new(nil, nil)
|
47
|
+
def resourcePool # rubocop:disable Lint/DuplicateMethods
|
48
|
+
@resourcePool ||= RbVmomi::VIM::ResourcePool.new(nil, nil) # rubocop:disable Naming/VariableName
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -1,44 +1,45 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "chef/provisioning/vsphere_driver"
|
2
3
|
|
3
4
|
describe ChefProvisioningVsphere::VsphereHelper do
|
4
5
|
let(:subject) do
|
5
6
|
connection_opts = {
|
6
|
-
host:
|
7
|
-
port: 443
|
7
|
+
host: "fake.host.com",
|
8
|
+
port: 443,
|
8
9
|
}
|
9
|
-
ChefProvisioningVsphere::VsphereHelper.new(connection_opts,
|
10
|
+
ChefProvisioningVsphere::VsphereHelper.new(connection_opts, "fake datacenter")
|
10
11
|
end
|
11
|
-
let(:vm) { vm = double(
|
12
|
-
let(:task) { double(
|
12
|
+
let(:vm) { vm = double("vm") } # rubocop:disable Lint/UselessAssignment
|
13
|
+
let(:task) { double("task", wait_for_completion: true) }
|
13
14
|
|
14
|
-
describe
|
15
|
+
describe "#set_additional_disks_for" do
|
15
16
|
before do
|
16
|
-
allow(vm).to receive(:disks).and_return([
|
17
|
+
allow(vm).to receive(:disks).and_return(["root_disk"], %w{root_disk first_disk})
|
17
18
|
end
|
18
19
|
|
19
|
-
context
|
20
|
+
context "when datastore is missing" do
|
20
21
|
let(:datastore) { nil }
|
21
|
-
it
|
22
|
+
it "and no extra disks, nothing is raised" do
|
22
23
|
additional_disk_size_gb = nil
|
23
24
|
expect { subject.set_additional_disks_for vm, datastore, additional_disk_size_gb }.not_to raise_error
|
24
25
|
end
|
25
26
|
|
26
|
-
it
|
27
|
+
it "and has 1 disk, error is raised" do
|
27
28
|
additional_disk_size_gb = 1
|
28
29
|
expect { subject.set_additional_disks_for vm, datastore, additional_disk_size_gb }.to raise_error(RuntimeError)
|
29
30
|
end
|
30
31
|
|
31
|
-
it
|
32
|
+
it "and has multiple disks, error is raised" do
|
32
33
|
additional_disk_size_gb = [1, 2]
|
33
34
|
expect { subject.set_additional_disks_for vm, datastore, additional_disk_size_gb }.to raise_error(RuntimeError)
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
|
-
context
|
38
|
-
let(:datastore) {
|
38
|
+
context "when datastore is present" do
|
39
|
+
let(:datastore) { "some datastore" }
|
39
40
|
let(:disk_1) do
|
40
41
|
{
|
41
|
-
|
42
|
+
spec: RbVmomi::VIM.VirtualMachineConfigSpec(
|
42
43
|
deviceChange: [
|
43
44
|
RbVmomi::VIM::VirtualDeviceConfigSpec(
|
44
45
|
operation: :add,
|
@@ -47,22 +48,22 @@ describe ChefProvisioningVsphere::VsphereHelper do
|
|
47
48
|
key: 1,
|
48
49
|
backing: RbVmomi::VIM.VirtualDiskFlatVer2BackingInfo(
|
49
50
|
fileName: "[#{datastore}]",
|
50
|
-
diskMode:
|
51
|
+
diskMode: "persistent",
|
51
52
|
thinProvisioned: true
|
52
53
|
),
|
53
54
|
capacityInKB: 1 * 1024 * 1024,
|
54
55
|
controllerKey: 1000,
|
55
56
|
unitNumber: 1
|
56
57
|
)
|
57
|
-
)
|
58
|
+
),
|
58
59
|
]
|
59
|
-
)
|
60
|
+
),
|
60
61
|
}
|
61
62
|
end
|
62
63
|
|
63
64
|
let(:disk_2) do
|
64
65
|
{
|
65
|
-
|
66
|
+
spec: RbVmomi::VIM.VirtualMachineConfigSpec(
|
66
67
|
deviceChange: [
|
67
68
|
RbVmomi::VIM::VirtualDeviceConfigSpec(
|
68
69
|
operation: :add,
|
@@ -71,50 +72,50 @@ describe ChefProvisioningVsphere::VsphereHelper do
|
|
71
72
|
key: 2,
|
72
73
|
backing: RbVmomi::VIM.VirtualDiskFlatVer2BackingInfo(
|
73
74
|
fileName: "[#{datastore}]",
|
74
|
-
diskMode:
|
75
|
+
diskMode: "persistent",
|
75
76
|
thinProvisioned: true
|
76
77
|
),
|
77
78
|
capacityInKB: 2 * 1024 * 1024,
|
78
79
|
controllerKey: 1000,
|
79
80
|
unitNumber: 2
|
80
81
|
)
|
81
|
-
)
|
82
|
+
),
|
82
83
|
]
|
83
|
-
)
|
84
|
+
),
|
84
85
|
}
|
85
86
|
end
|
86
87
|
|
87
|
-
it
|
88
|
+
it "and no extra disks, nothing is created" do
|
88
89
|
additional_disk_size_gb = nil
|
89
90
|
expect(vm).not_to receive(:ReconfigVM_Task)
|
90
91
|
subject.set_additional_disks_for vm, datastore, additional_disk_size_gb
|
91
92
|
end
|
92
93
|
|
93
|
-
it
|
94
|
-
additional_disk_size_gb = [
|
94
|
+
it "and disk is a string, nothing is created" do
|
95
|
+
additional_disk_size_gb = ["not a number"]
|
95
96
|
expect(vm).not_to receive(:ReconfigVM_Task)
|
96
97
|
subject.set_additional_disks_for vm, datastore, additional_disk_size_gb
|
97
98
|
end
|
98
99
|
|
99
|
-
it
|
100
|
+
it "and has 0 GB, nothing is created" do
|
100
101
|
additional_disk_size_gb = [0]
|
101
102
|
expect(vm).not_to receive(:ReconfigVM_Task)
|
102
103
|
subject.set_additional_disks_for vm, datastore, additional_disk_size_gb
|
103
104
|
end
|
104
105
|
|
105
|
-
it
|
106
|
+
it "and has -1 GB, nothing is created" do
|
106
107
|
additional_disk_size_gb = [-1]
|
107
108
|
expect(vm).not_to receive(:ReconfigVM_Task)
|
108
109
|
subject.set_additional_disks_for vm, datastore, additional_disk_size_gb
|
109
110
|
end
|
110
111
|
|
111
|
-
it
|
112
|
+
it "and has 1 x 1 GB, create disk" do
|
112
113
|
additional_disk_size_gb = 1
|
113
114
|
expect(vm).to receive(:ReconfigVM_Task).with(disk_1).and_return(task)
|
114
115
|
subject.set_additional_disks_for vm, datastore, additional_disk_size_gb
|
115
116
|
end
|
116
117
|
|
117
|
-
it
|
118
|
+
it "and has 2 disks, create 2 disks" do
|
118
119
|
additional_disk_size_gb = [1, 2]
|
119
120
|
|
120
121
|
expect(vm).to receive(:ReconfigVM_Task).with(disk_1).and_return(task)
|
@@ -122,7 +123,7 @@ describe ChefProvisioningVsphere::VsphereHelper do
|
|
122
123
|
subject.set_additional_disks_for vm, datastore, additional_disk_size_gb
|
123
124
|
end
|
124
125
|
|
125
|
-
it
|
126
|
+
it "and has 3 disks, including 1 of 0 size, create 2 disks" do
|
126
127
|
additional_disk_size_gb = [0, 1, 2]
|
127
128
|
expect(vm).to receive(:ReconfigVM_Task).with(disk_1).and_return(task)
|
128
129
|
expect(vm).to receive(:ReconfigVM_Task).with(disk_2).and_return(task)
|
@@ -132,52 +133,51 @@ describe ChefProvisioningVsphere::VsphereHelper do
|
|
132
133
|
end
|
133
134
|
end
|
134
135
|
|
135
|
-
describe
|
136
|
+
describe "#set_initial_iso" do
|
136
137
|
let(:cd_rom) do
|
137
|
-
double(
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
)
|
138
|
+
double("cd_rom",
|
139
|
+
class: RbVmomi::VIM::VirtualCdrom,
|
140
|
+
key: "some key",
|
141
|
+
controllerKey: "some controller key")
|
142
142
|
end
|
143
143
|
|
144
144
|
let(:fake_backing) do
|
145
|
-
RbVmomi::VIM::VirtualCdromIsoBackingInfo(fileName:
|
145
|
+
RbVmomi::VIM::VirtualCdromIsoBackingInfo(fileName: "some_iso.iso")
|
146
146
|
end
|
147
147
|
|
148
148
|
let(:iso_spec) do
|
149
|
-
{
|
149
|
+
{
|
150
150
|
spec: RbVmomi::VIM.VirtualMachineConfigSpec(
|
151
151
|
deviceChange: [
|
152
152
|
operation: :edit,
|
153
153
|
device: RbVmomi::VIM::VirtualCdrom(
|
154
154
|
backing: fake_backing,
|
155
|
-
key:
|
156
|
-
controllerKey:
|
155
|
+
key: "some key",
|
156
|
+
controllerKey: "some controller key",
|
157
157
|
connectable: RbVmomi::VIM::VirtualDeviceConnectInfo(
|
158
158
|
startConnected: true,
|
159
159
|
connected: true,
|
160
160
|
allowGuestControl: true
|
161
161
|
)
|
162
|
-
)
|
162
|
+
),
|
163
163
|
]
|
164
|
-
)
|
164
|
+
),
|
165
165
|
}
|
166
166
|
end
|
167
167
|
|
168
168
|
before do
|
169
169
|
allow(vm).to receive_message_chain(:config, :hardware, :device)
|
170
|
-
|
170
|
+
.and_return([cd_rom])
|
171
171
|
end
|
172
172
|
|
173
|
-
it
|
173
|
+
it "does nothing when no iso" do
|
174
174
|
expect(vm).not_to receive(:ReconfigVM_Task)
|
175
175
|
subject.set_initial_iso vm, nil
|
176
176
|
end
|
177
177
|
|
178
|
-
it
|
178
|
+
it "sets initial iso" do
|
179
179
|
expect(vm).to receive(:ReconfigVM_Task).with(iso_spec).and_return(task)
|
180
|
-
subject.set_initial_iso vm,
|
180
|
+
subject.set_initial_iso vm, "some_iso.iso"
|
181
181
|
end
|
182
182
|
end
|
183
183
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-provisioning-vsphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CenturyLink Cloud
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-06-
|
12
|
+
date: 2018-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
@@ -217,12 +217,9 @@ files:
|
|
217
217
|
- ".github/ISSUE_TEMPLATE.md"
|
218
218
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
219
219
|
- ".gitignore"
|
220
|
-
- ".rubocop.yml"
|
221
|
-
- ".rubocop_todo.yml"
|
222
220
|
- ".travis.yml"
|
223
221
|
- CHANGELOG.md
|
224
222
|
- Gemfile
|
225
|
-
- Jenkinsfile
|
226
223
|
- LICENSE
|
227
224
|
- LICENSE-Rally
|
228
225
|
- README.md
|
data/.rubocop.yml
DELETED
data/.rubocop_todo.yml
DELETED
@@ -1,135 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2017-10-30 16:48:40 -0700 using RuboCop version 0.49.1.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# Configuration parameters: AllowSafeAssignment.
|
11
|
-
Lint/AssignmentInCondition:
|
12
|
-
Exclude:
|
13
|
-
- 'lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb'
|
14
|
-
|
15
|
-
# Offense count: 1
|
16
|
-
# Cop supports --auto-correct.
|
17
|
-
# Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
|
18
|
-
# SupportedStylesAlignWith: start_of_line, def
|
19
|
-
Lint/DefEndAlignment:
|
20
|
-
Exclude:
|
21
|
-
- 'lib/chef/provisioning/vsphere_driver/driver.rb'
|
22
|
-
|
23
|
-
# Offense count: 1
|
24
|
-
# Cop supports --auto-correct.
|
25
|
-
# Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
|
26
|
-
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
27
|
-
Lint/EndAlignment:
|
28
|
-
Exclude:
|
29
|
-
- 'lib/chef/provisioning/vsphere_driver/driver.rb'
|
30
|
-
|
31
|
-
# Offense count: 6
|
32
|
-
Lint/UselessAssignment:
|
33
|
-
Exclude:
|
34
|
-
- 'lib/chef/provisioning/vsphere_driver/clone_spec_builder.rb'
|
35
|
-
- 'lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb'
|
36
|
-
- 'lib/kitchen/driver/vsphere.rb'
|
37
|
-
|
38
|
-
# Offense count: 34
|
39
|
-
Metrics/AbcSize:
|
40
|
-
Max: 47
|
41
|
-
|
42
|
-
# Offense count: 1
|
43
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
44
|
-
Metrics/BlockLength:
|
45
|
-
Max: 29
|
46
|
-
|
47
|
-
# Offense count: 1
|
48
|
-
# Configuration parameters: CountBlocks.
|
49
|
-
Metrics/BlockNesting:
|
50
|
-
Max: 4
|
51
|
-
|
52
|
-
# Offense count: 3
|
53
|
-
# Configuration parameters: CountComments.
|
54
|
-
Metrics/ClassLength:
|
55
|
-
Max: 643
|
56
|
-
|
57
|
-
# Offense count: 11
|
58
|
-
Metrics/CyclomaticComplexity:
|
59
|
-
Max: 12
|
60
|
-
|
61
|
-
# Offense count: 140
|
62
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
63
|
-
# URISchemes: http, https
|
64
|
-
Metrics/LineLength:
|
65
|
-
Max: 189
|
66
|
-
|
67
|
-
# Offense count: 41
|
68
|
-
# Configuration parameters: CountComments.
|
69
|
-
Metrics/MethodLength:
|
70
|
-
Max: 62
|
71
|
-
|
72
|
-
# Offense count: 8
|
73
|
-
Metrics/PerceivedComplexity:
|
74
|
-
Max: 14
|
75
|
-
|
76
|
-
# Offense count: 1
|
77
|
-
Style/CaseEquality:
|
78
|
-
Exclude:
|
79
|
-
- 'lib/chef/provisioning/vsphere_driver/driver.rb'
|
80
|
-
|
81
|
-
# Offense count: 3
|
82
|
-
Style/ClassVars:
|
83
|
-
Exclude:
|
84
|
-
- 'lib/kitchen/driver/vsphere.rb'
|
85
|
-
|
86
|
-
# Offense count: 5
|
87
|
-
# Configuration parameters: AllowedVariables.
|
88
|
-
Style/GlobalVars:
|
89
|
-
Exclude:
|
90
|
-
- 'lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb'
|
91
|
-
|
92
|
-
# Offense count: 13
|
93
|
-
# Configuration parameters: MinBodyLength.
|
94
|
-
Style/GuardClause:
|
95
|
-
Exclude:
|
96
|
-
- 'lib/chef/provisioning/vsphere_driver/clone_spec_builder.rb'
|
97
|
-
- 'lib/chef/provisioning/vsphere_driver/driver.rb'
|
98
|
-
- 'lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb'
|
99
|
-
|
100
|
-
# Offense count: 1
|
101
|
-
Style/MultilineTernaryOperator:
|
102
|
-
Exclude:
|
103
|
-
- 'lib/chef/provisioning/vsphere_driver/driver.rb'
|
104
|
-
|
105
|
-
# Offense count: 1
|
106
|
-
Style/NestedTernaryOperator:
|
107
|
-
Exclude:
|
108
|
-
- 'lib/chef/provisioning/vsphere_driver/driver.rb'
|
109
|
-
|
110
|
-
# Offense count: 1
|
111
|
-
# Cop supports --auto-correct.
|
112
|
-
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
|
113
|
-
# SupportedStyles: predicate, comparison
|
114
|
-
Style/NumericPredicate:
|
115
|
-
Exclude:
|
116
|
-
- 'spec/**/*'
|
117
|
-
- 'lib/chef/provisioning/vsphere_driver/driver.rb'
|
118
|
-
|
119
|
-
# Offense count: 3
|
120
|
-
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
|
121
|
-
# NamePrefix: is_, has_, have_
|
122
|
-
# NamePrefixBlacklist: is_, has_, have_
|
123
|
-
# NameWhitelist: is_a?
|
124
|
-
Style/PredicateName:
|
125
|
-
Exclude:
|
126
|
-
- 'spec/**/*'
|
127
|
-
- 'lib/chef/provisioning/vsphere_driver/driver.rb'
|
128
|
-
|
129
|
-
# Offense count: 3
|
130
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
131
|
-
# SupportedStyles: snake_case, camelCase
|
132
|
-
Style/VariableName:
|
133
|
-
Exclude:
|
134
|
-
- 'lib/chef/provisioning/vsphere_driver/clone_spec_builder.rb'
|
135
|
-
- 'lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb'
|
data/Jenkinsfile
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
pipeline {
|
2
|
-
agent {
|
3
|
-
docker {
|
4
|
-
args "-u root"
|
5
|
-
reuseNode false
|
6
|
-
image "localhost:5000/jjkeysv5"
|
7
|
-
}
|
8
|
-
}
|
9
|
-
triggers {
|
10
|
-
pollSCM('H * * * *')
|
11
|
-
}
|
12
|
-
stages {
|
13
|
-
stage('Pull down ChefDK') {
|
14
|
-
steps {
|
15
|
-
sh '''apt-get update
|
16
|
-
apt-get install -y curl sudo git build-essential
|
17
|
-
curl -L https://chef.io/chef/install.sh | sudo bash -s -- -P chefdk -c current
|
18
|
-
if [ -d "vsphere_testing" ]; then rm -rf vsphere_testing; fi'''
|
19
|
-
}
|
20
|
-
}
|
21
|
-
stage('Bundle') {
|
22
|
-
steps {
|
23
|
-
sh 'chef exec bundle install'
|
24
|
-
}
|
25
|
-
}
|
26
|
-
stage('Checks') {
|
27
|
-
steps {
|
28
|
-
parallel(
|
29
|
-
"Unit": {
|
30
|
-
sh 'chef exec rake unit'
|
31
|
-
|
32
|
-
},
|
33
|
-
"Docs": {
|
34
|
-
sh 'chef exec rake yard'
|
35
|
-
|
36
|
-
}
|
37
|
-
)
|
38
|
-
}
|
39
|
-
}
|
40
|
-
stage('Kitchen setup') {
|
41
|
-
steps {
|
42
|
-
sh '''if [ -d "vsphere_testing" ]; then rm -rf vsphere_testing; fi
|
43
|
-
git clone https://github.com/jjasghar/vsphere_testing.git
|
44
|
-
cd vsphere_testing
|
45
|
-
for i in recipes/*; do sed -i 's/PASSWORD/Good4bye!/g' "$i"; done
|
46
|
-
sed -i 's/PASSWORD/Good4bye!/g' .kitchen.yml
|
47
|
-
sed -i 's/ORG/jj-model-t/g' recipes/windows_provision.rb
|
48
|
-
chef exec bundle install
|
49
|
-
chef exec gem install test-kitchen
|
50
|
-
chef exec bundle exec kitchen list'''
|
51
|
-
}
|
52
|
-
}
|
53
|
-
stage('Kitchen verify') {
|
54
|
-
steps {
|
55
|
-
sh '''cd vsphere_testing
|
56
|
-
chef exec bundle exec kitchen test -c 2'''
|
57
|
-
}
|
58
|
-
}
|
59
|
-
stage('chef-provisioning-vsphere create') {
|
60
|
-
steps {
|
61
|
-
parallel(
|
62
|
-
"Linux": {
|
63
|
-
sh '''cd vsphere_testing
|
64
|
-
chef exec bundle exec chef-client -z recipes/linux_provision.rb'''
|
65
|
-
},
|
66
|
-
"Windows": {
|
67
|
-
sh '''cd vsphere_testing
|
68
|
-
chef exec bundle exec chef-client -z recipes/windows_provision.rb'''
|
69
|
-
}
|
70
|
-
)
|
71
|
-
}
|
72
|
-
}
|
73
|
-
stage('chef-provisioning-vsphere delete') {
|
74
|
-
steps {
|
75
|
-
sh '''cd vsphere_testing
|
76
|
-
chef exec bundle exec chef-client -z recipes/destroy.rb
|
77
|
-
chef exec knife node delete testing-windows -y
|
78
|
-
chef exec knife client delete testing-windows -y'''
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
}
|