Sha256: effcf932ebac5802dd383def42ef8cd548a6cee63af10e0a7724c6b2a4e98612

Contents?: true

Size: 934 Bytes

Versions: 3

Compression:

Stored size: 934 Bytes

Contents

require 'cloud66_agent/utils/vital_signs'
require 'cloud66_agent/utils/version'
require 'cloud66_agent/utils/server'

module Cloud66
	module Commands
		class Configure
			def self.perform(server_uid)
				begin
					address_info = Utils::VitalSigns.address_info
					data = {
						:timezone => Time.new.zone,
						:server_uid => server_uid,
						:ext_ipv4 => address_info[:ext_ipv4],
						:int_ipv4 => address_info[:int_ipv4],
						:ext_ipv6 => address_info[:ext_ipv6],
						:int_ipv6 => address_info[:int_ipv6],
						:version => Utils::Version.current,
						:system => Utils::VitalSigns.system_info }
				rescue => exc
					data = { error: exc.message }
				end
				result = Utils::Server.send_configure data
				$config.agent_uid = result['agent_uid']
				$config.disabled = false
				$config.save
				exit 0
			rescue => exc
				$logger.error "Command \"configure\" failed: #{exc.message}"
				exit -1
			end

		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cloud66_agent-1.0.7.pre1 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.0.7 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.0.6 lib/cloud66_agent/commands/configure.rb