Sha256: 9993a9329a00b1d50d278db499460d433a76b7754cb29b363667408fd0eebdaf
Contents?: true
Size: 955 Bytes
Versions: 2
Compression:
Stored size: 955 Bytes
Contents
require 'chef/knife/profitbricks_base' class Chef class Knife class ProfitbricksServerReboot < Knife include Knife::ProfitbricksBase banner 'knife profitbricks server reboot SERVER_ID [SERVER_ID] (options)' option :datacenter_id, short: '-D DATACENTER_ID', long: '--datacenter-id DATACENTER_ID', description: 'ID of the data center', proc: proc { |datacenter_id| Chef::Config[:knife][:datacenter_id] = datacenter_id }, required: true def run connection @name_args.each do |server_id| begin server = ProfitBricks::Server.get(config[:datacenter_id], server_id) rescue Excon::Errors::NotFound ui.error("Server ID #{server_id} not found. Skipping.") next end server.reboot ui.warn("Server #{server.id} is rebooting") end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
knife-profitbricks-1.2.0 | lib/chef/knife/profitbricks_server_reboot.rb |
knife-profitbricks-1.1.2 | lib/chef/knife/profitbricks_server_reboot.rb |