reload_current_os.rb
reload_current_os.rb
# Reload Current Operating System Configuration.
# It performs an OS reload and creates a transaction to it.
# *
# Important manual pages:
# http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/reloadCurrentOperatingSystemConfiguration
#
# @license <http://sldn.softlayer.com/article/License>
# @author SoftLayer Technologies, Inc. <sldn@softlayer.com>
require 'rubygems'
require 'softlayer_api'
# Set the server id.
server_id = 11498369
# Your SoftLayer API username.
SL_API_USERNAME = 'set me'
# Your SoftLayer API key.
SL_API_KEY = 'set me'
# Create a new SoftLayer client
softlayer_client = SoftLayer::Client.new(:username => SL_API_USERNAME,
:api_key => SL_API_KEY)
virtual_guest_service = softlayer_client['Virtual_Guest']
begin
# Call the reloadCurrentOperatingSystemConfiguration method from SoftLayer_Virtual_Guest.
server_ref = virtual_guest_service.object_with_id(server_id)
result = server_ref.reloadCurrentOperatingSystemConfiguration
p "The server was reload successfully: #{result}"
rescue StandardError => exception
p "Unable to reload Virtual Server Instance: #{exception}"
end