beaker-google 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,12 +1,52 @@
1
1
  # Changelog
2
2
 
3
- ## [1.0.0](https://github.com/voxpupuli/beaker-google/tree/1.0.0) (2022-10-31)
3
+ ## [1.2.0](https://github.com/voxpupuli/beaker-google/tree/1.2.0) (2024-06-07)
4
+
5
+ [Full Changelog](https://github.com/voxpupuli/beaker-google/compare/1.1.0...1.2.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - CI: Run on Ruby 3.2 and 3.3 as well [\#52](https://github.com/voxpupuli/beaker-google/pull/52) ([bastelfreak](https://github.com/bastelfreak))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - Fix call to Google::Apis::ComputeV1::Instance.new\(\) to work on Ruby 3 [\#51](https://github.com/voxpupuli/beaker-google/pull/51) ([silug](https://github.com/silug))
14
+
15
+ **Merged pull requests:**
16
+
17
+ - CI: build gem with --strict & --verbose [\#53](https://github.com/voxpupuli/beaker-google/pull/53) ([bastelfreak](https://github.com/bastelfreak))
18
+ - Cleanup for rubocop [\#50](https://github.com/voxpupuli/beaker-google/pull/50) ([silug](https://github.com/silug))
19
+
20
+ ## [1.1.0](https://github.com/voxpupuli/beaker-google/tree/1.1.0) (2024-05-22)
21
+
22
+ [Full Changelog](https://github.com/voxpupuli/beaker-google/compare/1.0.0...1.1.0)
23
+
24
+ **Implemented enhancements:**
25
+
26
+ - Move timestamp in firewall name to a different value [\#45](https://github.com/voxpupuli/beaker-google/issues/45)
27
+ - Add ability to configure the firewall [\#40](https://github.com/voxpupuli/beaker-google/pull/40) ([jaevans](https://github.com/jaevans))
28
+ - Add ability to set custom hostname [\#39](https://github.com/voxpupuli/beaker-google/pull/39) ([Andy-Adrian](https://github.com/Andy-Adrian))
29
+
30
+ **Closed issues:**
31
+
32
+ - Add ability to set custom hostname [\#38](https://github.com/voxpupuli/beaker-google/issues/38)
33
+ - network ports should be configurable [\#34](https://github.com/voxpupuli/beaker-google/issues/34)
34
+
35
+ **Merged pull requests:**
36
+
37
+ - Fix name conflicts [\#48](https://github.com/voxpupuli/beaker-google/pull/48) ([jaevans](https://github.com/jaevans))
38
+ - Bump actions/checkout from 2 to 4 [\#43](https://github.com/voxpupuli/beaker-google/pull/43) ([dependabot[bot]](https://github.com/apps/dependabot))
39
+ - Bump github/codeql-action from 1 to 2 [\#42](https://github.com/voxpupuli/beaker-google/pull/42) ([dependabot[bot]](https://github.com/apps/dependabot))
40
+ - dependabot: check for github actions and bundler [\#41](https://github.com/voxpupuli/beaker-google/pull/41) ([bastelfreak](https://github.com/bastelfreak))
41
+ - Update fakefs requirement from ~\> 1.8 to ~\> 2.4 [\#37](https://github.com/voxpupuli/beaker-google/pull/37) ([dependabot[bot]](https://github.com/apps/dependabot))
42
+
43
+ ## [1.0.0](https://github.com/voxpupuli/beaker-google/tree/1.0.0) (2022-11-02)
4
44
 
5
45
  [Full Changelog](https://github.com/voxpupuli/beaker-google/compare/0.5.0...1.0.0)
6
46
 
7
47
  **Fixed bugs:**
8
48
 
9
- - exec sysprep commands in child processes [\#31](https://github.com/voxpupuli/beaker-google/pull/31) ([AndyAdrian-OP](https://github.com/AndyAdrian-OP))
49
+ - exec sysprep commands in child processes [\#31](https://github.com/voxpupuli/beaker-google/pull/31) ([Andy-Adrian](https://github.com/Andy-Adrian))
10
50
 
11
51
  ## [0.5.0](https://github.com/voxpupuli/beaker-google/tree/0.5.0) (2022-10-04)
12
52
 
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source ENV.fetch('GEM_SOURCE', 'https://rubygems.org')
2
4
 
3
5
  gemspec
@@ -18,6 +20,7 @@ group :acceptance_testing do
18
20
  gem 'beaker', *location_for(ENV.fetch('BEAKER_VERSION', '~> 4.0'))
19
21
  end
20
22
 
21
- group :release do
22
- gem 'github_changelog_generator', require: false
23
+ group :release, optional: true do
24
+ gem 'faraday-retry', '~> 2.1', require: false
25
+ gem 'github_changelog_generator', '~> 1.16.4', require: false
23
26
  end
data/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  Beaker library to use the Google hypervisor
12
12
 
13
- # How to use this wizardry
13
+ # How to use this module
14
14
 
15
15
  This is a gem that allows you to use hosts with [Google Compute](https://cloud.google.com/compute) hypervisor with [Beaker](https://github.com/voxpupuli/beaker).
16
16
 
@@ -46,6 +46,7 @@ The behavior of this library can be configured using either the beaker host conf
46
46
  | gce_zone | true | | The zone to place compute instances in. The region is calculated from the zone name. |
47
47
  | gce_network | false | Default | The name of the network to attach to instances. If the project uses the default network, this and `gce_subnetwork` can be left empty. |
48
48
  | gce_subnetwork | false | Default | The name of the subnetwork to attach to the instances network interface. If the Default network is not used, this must be supplied. |
49
+ | gce_ports | false | `[ ]` | A comma separated list of ports to add to the external firewall. Each port is specified in the format `number/protocol` where protocol is one of `tcp`, `udp`, `icmp`, `esp`, `ah`, `ipip`, or `sctp`. **NOTE:** Port `22/tcp` is required for beaker to function and is automatically added to the firewall. |
49
50
  | gce_ssh_private_key | false | $HOME/.ssh/google_compute_engine | The file path of the private key to use to connect to instances. If using the key created by the gcloud tool, this can be left blank. |
50
51
  | gce_ssh_public_key | false | <gce_ssh_private_key>.pub | The file path of the public key to upload to the instance. If left blank, attempt to use the file at `gce_ssh_private_key` with a `.pub` extension. |
51
52
  | gce_machine_type | false | e2-standard-4 | The machine type to use for the instance. If the `BEAKER_gce_machine_type` environment variable is set, it will be used for all hosts. |
@@ -55,14 +56,24 @@ The behavior of this library can be configured using either the beaker host conf
55
56
 
56
57
  All the variables in the list can be set in the Beaker host configuration file, or the ones starting with `gce_` can be overridden by environment variables in the form `BEAKER_gce_...`. i.e. To override the `gce_machine_type` setting in the environment, set `BEAKER_gce_machine_type`.
57
58
 
59
+ ## Networking
60
+
61
+ Each run of beaker creates a pair of firewalls to protect the hosts, and internal host-to-host firewall, and an external firewall between the hosts and the internet.
62
+
63
+ The internal firewall allows all communication between hosts in the node set, while keeping them isolated from any other Beaker jobs that may be running in the same environment. This firewall is attached to all hosts in the test set, and allows all `tcp`, `udp`, and `icmp` traffic.
64
+
65
+ The external firewall allows outside communication from the internet into the hosts in the test. Due to constrains of the Beaker system, the firewall accepts any source IP (`0.0.0.0/0`) and the SSH port (`22/tcp`) is always allowed. Other ports may be added by using the `gce_ports` configuration option or the `BEAKER_gce_ports` environment variable as a comma separated list of `port/proto` values where `port` is the port number or range, and proto is one of `tcp`, `udp`, `icmp`, `esp`, `ah`, `ipip`, or `sctp`. The port number is only used for `tcp`, `udp`, and `sctp` protocols. Any value, such as `-1` can be used for the other protocols.
66
+
67
+ VM Instances created during this process will by default use the automatically-generated instance name as the hostname in the VM OS. Set the `BEAKER_set_gce_hostname` environment variable to `1` to override this behavior and configure the VM OS with the name defined in the nodeset as the hostname.
68
+
58
69
  # Cleanup
59
70
 
60
71
  In cases where the beaker process is killed before finishing, it may leave resources in GCP. These resources will need to be manually deleted.
61
72
 
62
73
  | Resource Type | Name Pattern | Count |
63
74
  | ------------- | ------------------- | ------------------------------------------- |
64
- | Firewall | `beaker-<number>-*` | 1 |
65
- | Instance | `beaker-*` | One or more depending on test configuration |
75
+ | Firewall | `beaker-<number>-*` | 2 |
76
+ | Instance | `beaker-<number>-*` | One or more depending on test configuration |
66
77
 
67
78
  # Contributing
68
79
 
data/Rakefile CHANGED
@@ -1,5 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/core/rake_task'
2
4
 
5
+ begin
6
+ require 'voxpupuli/rubocop/rake'
7
+ rescue LoadError
8
+ # the voxpupuli-rubocop gem is optional
9
+ end
10
+
3
11
  ###########################################################
4
12
  #
5
13
  # Documentation Tasks
@@ -13,12 +21,12 @@ def running?(cmdline)
13
21
  found = ps.lines.grep(/#{Regexp.quote(cmdline)}/)
14
22
  raise StandardError, "Found multiple YARD Servers. Don't know what to do." if found.length > 1
15
23
 
16
- yes = found.empty? ? false : true
24
+ yes = !found.empty?
17
25
  [yes, found.first]
18
26
  end
19
27
 
20
28
  def pid_from(output)
21
- output.squeeze(' ').strip.split(' ')[1]
29
+ output.squeeze(' ').strip.split[1]
22
30
  end
23
31
 
24
32
  desc 'Start the documentation server in the foreground'
@@ -44,7 +52,7 @@ namespace :docs do
44
52
  Dir.chdir(__dir__)
45
53
  output = `bundle exec yard doc`
46
54
  puts output
47
- raise 'Errors/Warnings during yard documentation generation' if output =~ /\[warn\]|\[error\]/
55
+ raise 'Errors/Warnings during yard documentation generation' if /\[warn\]|\[error\]/.match?(output)
48
56
 
49
57
  Dir.chdir(original_dir)
50
58
  end
@@ -63,6 +71,7 @@ namespace :docs do
63
71
  end
64
72
  end
65
73
 
74
+ desc 'Alias for `background`'
66
75
  task(:bg) { Rake::Task['docs:background'].invoke }
67
76
 
68
77
  desc 'Check the status of the documentation server'
@@ -84,10 +93,10 @@ namespace :docs do
84
93
  puts "Found a YARD Server running with pid #{pid}"
85
94
  `kill #{pid}`
86
95
  puts 'Stopping...'
87
- yes, output = running?(DOCS_DAEMON)
96
+ yes, = running?(DOCS_DAEMON)
88
97
  if yes
89
98
  `kill -9 #{pid}`
90
- yes, output = running?(DOCS_DAEMON)
99
+ yes, = running?(DOCS_DAEMON)
91
100
  if yes
92
101
  puts 'Could not Stop Server!'
93
102
  else
@@ -106,9 +115,10 @@ begin
106
115
  require 'rubygems'
107
116
  require 'github_changelog_generator/task'
108
117
  rescue LoadError
118
+ # the github_changelog_generator gem is optional
109
119
  else
110
120
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
111
- config.exclude_labels = %w{duplicate question invalid wontfix wont-fix skip-changelog}
121
+ config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog]
112
122
  config.user = 'voxpupuli'
113
123
  config.project = 'beaker-google'
114
124
  gem_version = Gem::Specification.load("#{config.project}.gemspec").version
@@ -1,35 +1,36 @@
1
- # -*- encoding: utf-8 -*-
2
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
3
4
  require 'beaker-google/version'
4
5
 
5
6
  Gem::Specification.new do |s|
6
- s.name = "beaker-google"
7
+ s.name = 'beaker-google'
7
8
  s.version = BeakerGoogle::VERSION
8
- s.authors = ["Puppet", "Voxpupuli"]
9
- s.email = ["voxpupuli@groups.io"]
10
- s.homepage = "https://github.com/voxpupuli/beaker-google"
11
- s.summary = %q{Beaker DSL Extension Helpers!}
12
- s.description = %q{Google Compute Engine support for the Beaker acceptance testing tool.}
13
- s.license = 'Apache2'
9
+ s.authors = %w[Puppet Voxpupuli]
10
+ s.email = ['voxpupuli@groups.io']
11
+ s.homepage = 'https://github.com/voxpupuli/beaker-google'
12
+ s.summary = 'Beaker DSL Extension Helpers!'
13
+ s.description = 'Google Compute Engine support for the Beaker acceptance testing tool.'
14
+ s.license = 'Apache-2.0'
14
15
 
15
16
  s.files = `git ls-files`.split("\n")
16
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
- s.require_paths = ["lib"]
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
18
+ s.require_paths = ['lib']
19
19
 
20
- s.required_ruby_version = Gem::Requirement.new('>= 2.4')
20
+ s.required_ruby_version = Gem::Requirement.new('>= 2.7')
21
21
 
22
22
  # Testing dependencies
23
- s.add_development_dependency 'rspec', '~> 3.0'
24
- s.add_development_dependency 'rspec-its'
25
- s.add_development_dependency 'fakefs', '~> 1.8'
26
- s.add_development_dependency 'rake', '~> 13.0'
27
- s.add_development_dependency 'simplecov'
23
+ s.add_development_dependency 'fakefs', '~> 2.4'
28
24
  s.add_development_dependency 'pry', '~> 0.10'
25
+ s.add_development_dependency 'rake', '~> 13.0'
26
+ s.add_development_dependency 'rspec', '~> 3.0'
27
+ s.add_development_dependency 'rspec-its', '~> 1.3'
28
+ s.add_development_dependency 'simplecov', '~> 0.22.0'
29
+ s.add_development_dependency 'voxpupuli-rubocop', '~> 2.7.0'
29
30
 
30
31
  # Documentation dependencies
31
- s.add_development_dependency 'yard'
32
- s.add_development_dependency 'thin'
32
+ s.add_development_dependency 'thin', '~> 1.8', '>= 1.8.2'
33
+ s.add_development_dependency 'yard', '~> 0.9.36'
33
34
 
34
35
  # Run time dependencies
35
36
  s.add_runtime_dependency 'stringify-hash', '~> 0.0.0'
data/bin/beaker-google CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'rubygems' unless defined?(Gem)
4
5
  require 'beaker-google'
@@ -1,4 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'beaker/hypervisor/google_compute'
2
4
 
3
- class Beaker::Google < Beaker::GoogleCompute
5
+ module Beaker
6
+ class Google < Beaker::GoogleCompute
7
+ end
4
8
  end
@@ -1,12 +1,13 @@
1
- require 'time'
1
+ # frozen_string_literal: true
2
+
3
+ require 'securerandom'
2
4
 
3
5
  module Beaker
4
6
  # Beaker support for the Google Compute Engine.
5
7
  class GoogleCompute < Beaker::Hypervisor
6
8
  SLEEPWAIT = 5
7
9
 
8
- # Hours before an instance is considered a zombie
9
- ZOMBIE = 3
10
+ WINDOWS_IMAGE_PROJECT = %w[windows-cloud windows-sql-cloud].freeze
10
11
 
11
12
  # Do some reasonable sleuthing on the SSH public key for GCE
12
13
 
@@ -18,9 +19,12 @@ module Beaker
18
19
  # @raise [Error] if the private key can not be found
19
20
  def find_google_ssh_private_key
20
21
  private_keyfile = ENV.fetch('BEAKER_gce_ssh_public_key',
21
- File.join(ENV.fetch('HOME', nil), '.ssh', 'google_compute_engine'))
22
- private_keyfile = @options[:gce_ssh_private_key] if @options[:gce_ssh_private_key] && !File.exist?(private_keyfile)
22
+ File.join(Dir.home, '.ssh', 'google_compute_engine'))
23
+ if @options[:gce_ssh_private_key] && !File.exist?(private_keyfile)
24
+ private_keyfile = @options[:gce_ssh_private_key]
25
+ end
23
26
  raise("Could not find GCE Private SSH key at '#{keyfile}'") unless File.exist?(private_keyfile)
27
+
24
28
  @options[:gce_ssh_private_key] = private_keyfile
25
29
  private_keyfile
26
30
  end
@@ -36,6 +40,7 @@ module Beaker
36
40
  public_keyfile = private_keyfile << '.pub'
37
41
  public_keyfile = @options[:gce_ssh_public_key] if @options[:gce_ssh_public_key] && !File.exist?(public_keyfile)
38
42
  raise("Could not find GCE Public SSH key at '#{keyfile}'") unless File.exist?(public_keyfile)
43
+
39
44
  @options[:gce_ssh_public_key] = public_keyfile
40
45
  public_keyfile
41
46
  end
@@ -79,32 +84,53 @@ module Beaker
79
84
  @options = options
80
85
  @logger = options[:logger]
81
86
  @hosts = google_hosts
82
- @firewall = ''
87
+ @external_firewall_name = ''
88
+ @internal_firewall_name = ''
83
89
  @gce_helper = GoogleComputeHelper.new(options)
84
90
  end
85
91
 
86
92
  # Create and configure virtual machines in the Google Compute Engine,
87
93
  # including their associated disks and firewall rules
88
94
  def provision
89
- start = Time.now
90
- test_group_identifier = "beaker-#{start.to_i}-"
95
+ test_group_identifier = "beaker-#{SecureRandom.hex(4)}"
91
96
 
92
97
  # set firewall to open pe ports
93
98
  network = @gce_helper.get_network
94
99
 
95
- @firewall = test_group_identifier + generate_host_name
100
+ @external_firewall_name = "#{test_group_identifier}-external"
96
101
 
97
- @gce_helper.create_firewall(@firewall, network)
102
+ # Always allow ssh from anywhere as it's needed for Beaker to run
103
+ @gce_helper.create_firewall(
104
+ @external_firewall_name,
105
+ network,
106
+ allow: @options[:gce_ports] + ['22/tcp'],
107
+ source_ranges: ['0.0.0.0/0'],
108
+ target_tags: [test_group_identifier],
109
+ )
98
110
 
99
- @logger.debug("Created Google Compute firewall #{@firewall}")
111
+ @logger.debug("Created External Google Compute firewall #{@external_firewall_name}")
100
112
 
101
- @hosts.each do |host|
113
+ # Create a firewall that opens everything between all the hosts in this test group
114
+ @internal_firewall_name = "#{test_group_identifier}-internal"
115
+ internal_ports = ['1-65535/tcp', '1-65535/udp', '-1/icmp']
116
+ @gce_helper.create_firewall(
117
+ @internal_firewall_name,
118
+ network,
119
+ allow: internal_ports,
120
+ source_tags: [test_group_identifier],
121
+ target_tags: [test_group_identifier],
122
+ )
123
+ @logger.debug("Created test group Google Compute firewall #{@internal_firewall_name}")
102
124
 
125
+ @hosts.each do |host|
103
126
  machine_type_name = ENV.fetch('BEAKER_gce_machine_type', host['gce_machine_type'])
104
127
  raise "Must provide a machine type name in 'gce_machine_type'." if machine_type_name.nil?
128
+
105
129
  # Get the GCE machine type object for this host
106
130
  machine_type = @gce_helper.get_machine_type(machine_type_name)
107
- raise "Unable to find machine type named #{machine_type_name} in region #{@compute.default_zone}" if machine_type.nil?
131
+ if machine_type.nil?
132
+ raise "Unable to find machine type named #{machine_type_name} in region #{@compute.default_zone}"
133
+ end
108
134
 
109
135
  # Find the image to use to create the new VM.
110
136
  # Either `image` or `family` must be set in the configuration. Accepted formats
@@ -119,7 +145,7 @@ module Beaker
119
145
  if host[:image]
120
146
  image_selector = host[:image]
121
147
  # Do we have a project name?
122
- if %r{/}.match?(image_selector)
148
+ if image_selector.include?('/')
123
149
  image_project, image_name = image_selector.split('/')[0..1]
124
150
  else
125
151
  image_project = @gce_helper.options[:gce_project]
@@ -130,7 +156,7 @@ module Beaker
130
156
  elsif host[:family]
131
157
  image_selector = host[:family]
132
158
  # Do we have a project name?
133
- if %r{/}.match?(image_selector)
159
+ if image_selector.include?('/')
134
160
  image_project, family_name = image_selector.split('/')
135
161
  else
136
162
  image_project = @gce_helper.options[:gce_project]
@@ -142,7 +168,7 @@ module Beaker
142
168
  raise('You must specify either :image or :family')
143
169
  end
144
170
 
145
- unique_host_id = test_group_identifier + generate_host_name
171
+ unique_host_id = "#{test_group_identifier}-#{generate_host_name}"
146
172
 
147
173
  boot_size = host['volume_size'] || img.disk_size_gb
148
174
 
@@ -155,19 +181,29 @@ module Beaker
155
181
  host['vmhostname'] = unique_host_id
156
182
 
157
183
  # add a new instance of the image
158
- operation = @gce_helper.create_instance(host['vmhostname'], img, machine_type, boot_size)
184
+ operation = @gce_helper.create_instance(host['vmhostname'], img, machine_type, boot_size, host.name)
159
185
  unless operation.error.nil?
160
- raise "Unable to create Google Compute Instance #{host.name}: [#{operation.error.errors[0].code}] #{operation.error.errors[0].message}"
186
+ raise "Unable to create Google Compute Instance #{
187
+ host.name
188
+ }: [#{
189
+ operation.error.errors[0].code
190
+ }] #{
191
+ operation.error.errors[0].message
192
+ }"
161
193
  end
194
+
162
195
  @logger.debug("Created Google Compute instance for #{host.name}: #{host['vmhostname']}")
163
196
  instance = @gce_helper.get_instance(host['vmhostname'])
164
197
 
198
+ @gce_helper.add_instance_tag(host['vmhostname'], test_group_identifier)
199
+ @logger.debug("Added network tag #{test_group_identifier} to instance")
200
+
165
201
  # Make sure we have a non root/Adminsitor user to log in as
166
- if host['user'] == "root" || host['user'] == "Administrator" || host['user'].empty?
167
- initial_user = 'google_compute'
168
- else
169
- initial_user = host['user']
170
- end
202
+ initial_user = if host['user'] == 'root' || host['user'] == 'Administrator' || host['user'].empty?
203
+ 'google_compute'
204
+ else
205
+ host['user']
206
+ end
171
207
 
172
208
  # add metadata to instance, if there is any to set
173
209
  # mdata = format_metadata
@@ -175,18 +211,18 @@ module Beaker
175
211
  mdata = [
176
212
  {
177
213
  key: 'ssh-keys',
178
- value: "#{initial_user}:#{File.read(find_google_ssh_public_key).strip}"
214
+ value: "#{initial_user}:#{File.read(find_google_ssh_public_key).strip}",
179
215
  },
180
216
  # For now oslogin needs to be disabled as there's no way to log in as root and it would
181
217
  # take too much work on beaker to add sudo support to everything
182
218
  {
183
219
  key: 'enable-oslogin',
184
- value: 'FALSE'
220
+ value: 'FALSE',
185
221
  },
186
222
  ]
187
-
223
+
188
224
  # Check for google's default windows images and turn on ssh if found
189
- if image_project == "windows-cloud" || image_project == "windows-sql-cloud"
225
+ if WINDOWS_IMAGE_PROJECT.include?(image_project)
190
226
  # Turn on SSH on GCP's default windows images
191
227
  mdata << {
192
228
  key: 'enable-windows-ssh',
@@ -194,12 +230,12 @@ module Beaker
194
230
  }
195
231
  mdata << {
196
232
  key: 'sysprep-specialize-script-cmd',
197
- value: 'start /wait googet -noconfirm=true update && start /wait googet -noconfirm=true install google-compute-engine-ssh',
233
+ value: 'start /wait googet -noconfirm=true update && start /wait googet -noconfirm=true install google-compute-engine-ssh', # rubocop:disable Layout/LineLength
198
234
  }
199
235
  # Some versions of windows don't seem to add the OpenSSH directory to the path which prevents scp from working
200
236
  mdata << {
201
237
  key: 'sysprep-specialize-script-ps1',
202
- value: '[Environment]::SetEnvironmentVariable( "PATH", "$ENV:PATH;C:\Program Files\OpenSSH", [EnvironmentVariableTarget]::Machine )',
238
+ value: '[Environment]::SetEnvironmentVariable( "PATH", "$ENV:PATH;C:\Program Files\OpenSSH", [EnvironmentVariableTarget]::Machine )', # rubocop:disable Layout/LineLength
203
239
  }
204
240
  end
205
241
  unless mdata.empty?
@@ -210,9 +246,6 @@ module Beaker
210
246
 
211
247
  host['ip'] = instance.network_interfaces[0].access_configs[0].nat_ip
212
248
 
213
- # Add the new host to the firewall
214
- @gce_helper.add_firewall_tag(@firewall, host['vmhostname'])
215
-
216
249
  if host['disable_root_ssh'] == true
217
250
  @logger.info('Not enabling root ssh as disable_root_ssh is true')
218
251
  else
@@ -235,7 +268,8 @@ module Beaker
235
268
  # Shutdown and destroy virtual machines in the Google Compute Engine,
236
269
  # including their associated disks and firewall rules
237
270
  def cleanup
238
- @gce_helper.delete_firewall(@firewall)
271
+ @gce_helper.delete_firewall(@external_firewall_name)
272
+ @gce_helper.delete_firewall(@internal_firewall_name)
239
273
 
240
274
  @hosts.each do |host|
241
275
  # TODO: Delete any other disks attached during the instance creation