Skip to content

Commit 3d0ba8f

Browse files
author
Paul Cornell
committed
Cleaned up remaining Ruby code examples for Amazon EC2. Added tests.
1 parent a0a6635 commit 3d0ba8f

10 files changed

+816
-239
lines changed

ruby/example_code/ec2/ec2-ruby-example-manage-instances.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def instance_detailed_monitoring_enabled?(ec2_client, instance_id)
122122
puts "Detailed monitoring state: #{result.instance_monitorings[0].monitoring.state}"
123123
return true
124124
rescue Aws::EC2::Errors::InvalidState
125-
puts "The instance is not in a monitorable state. Continuing on..."
125+
puts "The instance is not in a monitorable state. Skipping this step."
126126
return false
127127
rescue StandardError => e
128128
puts "Error enabling detailed monitoring: #{e.message}"
@@ -191,25 +191,25 @@ def run_me
191191
puts 'Attempting to stop the instance. ' \
192192
'This might take a few minutes...'
193193
unless instance_stopped?(ec2_client, instance_id)
194-
puts 'Cannot stop the instance. Continuing anyway...'
194+
puts 'Cannot stop the instance. Skipping this step.'
195195
end
196196

197197
puts "\nAttempting to restart the instance. " \
198198
'This might take a few minutes...'
199199
unless instance_restarted?(ec2_client, instance_id)
200-
puts 'Cannot restart the instance. Continuing anyway...'
200+
puts 'Cannot restart the instance. Skipping this step.'
201201
end
202202

203203
puts "\nAttempting to reboot the instance. " \
204204
'This might take a few minutes...'
205205
unless instance_rebooted?(ec2_client, instance_id)
206-
puts 'Cannot reboot the instance. Continuing anyway...'
206+
puts 'Cannot reboot the instance. Skipping this step.'
207207
end
208208

209209
puts "\nAttempting to enable detailed monitoring for the instance..."
210210
unless instance_detailed_monitoring_enabled?(ec2_client, instance_id)
211211
puts 'Cannot enable detailed monitoring for the instance. ' \
212-
'Continuing anyway...'
212+
'Skipping this step.'
213213
end
214214

215215
puts "\nInformation about available instances:"

0 commit comments

Comments
 (0)