Sha256: 099ad8061d76d878a3452ff46b145b397ccc5750fc84a71e33ceb8c997301676

Contents?: true

Size: 982 Bytes

Versions: 14

Compression:

Stored size: 982 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
					$config.is_aws = Utils::VitalSigns.is_aws?
					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

14 entries across 14 versions & 1 rubygems

Version Path
cloud66_agent-1.1.1 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.1.1.beta1 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.1.0 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.1.0.beta4 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.1.0.beta3 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.1.0.beta2 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.1.0.beta1 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.0.12 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.0.12.pre1 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.0.11 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.0.10 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.0.9 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.0.8 lib/cloud66_agent/commands/configure.rb
cloud66_agent-1.0.8.pre1 lib/cloud66_agent/commands/configure.rb