lib/agent/server/am_agent.rb in apminsight-1.8.3 vs lib/agent/server/am_agent.rb in apminsight-1.8.6
- old
+ new
@@ -37,20 +37,23 @@
else
agentInfo = @obj.config.getAgentInfo
resp = nil
if @obj.config.alreadyconnected
@obj.log.debug "[doConnect] Already Connected - Make Contact - Instance id = #{@obj.config.instance_id}"
- if @obj.config.site24x7
- resp = startConnect "?license.key="+@obj.config.license_key+"&instance_id="+@obj.config.instance_id,agentInfo
- else
- resp = startConnect "?instance_id="+@obj.config.instance_id,agentInfo
- end
+ resp = startConnect "?license.key="+@obj.config.license_key+"&instance_id="+@obj.config.instance_id,agentInfo
else
@obj.log.debug "[doConnect] Going to connect - New "
- if @obj.config.site24x7
- resp = startConnect "?license.key="+@obj.config.license_key,agentInfo
+# if @obj.config.site24x7
+# resp = startConnect "?license.key="+@obj.config.license_key,agentInfo
+# else
+# resp = startConnect "",agentInfo
+# end
+ # Checking the license pattern for APM as per team requirement
+ if !@obj.config.site24x7 && !@obj.config.license_key.match?("APMI_[A-Fa-f0-9]{64}")
+ @obj.log.info "Invalid license key for App Manager, aborting agent init"
+ @obj.shutdown=true
else
- resp = startConnect "",agentInfo
+ resp = startConnect "?license.key="+@obj.config.license_key,agentInfo
end
end
if (resp == nil || !resp.has_key?("instance-info"))
@obj.log.info "[doConnect] [ Problem in connecting server] [ Going to shutdown ]"