lib/liberty_buildpack/framework/dynatrace_appmon_agent.rb
#------------------------------------------------------------------------------------------
# Determines if the dynatrace service is included in VCAP_SERVICES based on whether the
# service entry has valid entries.
#
# @return [Boolean] true if the app is bound to a dynatrace service
#------------------------------------------------------------------------------------------
Determines if the dynatrace service is included in VCAP_SERVICES based on whether the
service entry has valid entries.
Determines if the dynatrace service is included in VCAP_SERVICES based on whether the service entry has valid entries .
def dt_service_exist?
      pattern = /#{DT_SERVICE_NAME}/
      candidates = @services.select do |candidate|
        (
          (candidate['label'] == 'user-provided' && candidate['name'] =~ pattern) ||
          candidate['label'] =~ pattern ||
          (!candidate['tags'].nil? && candidate['tags'].any? { |tag| tag =~ pattern })
        ) &&
        !candidate[CREDENTIALS_KEY].nil? &&
        candidate[CREDENTIALS_KEY][SERVER_KEY] &&
        !candidate[CREDENTIALS_KEY]['environmentid']
      end
      raise 'Multiple valid dynatrace services exist.' if candidates.length > 1
      candidates.one?
    end
def dt_service_exist? pattern = / #{ DT_SERVICE_NAME } / candidates = @services . select do | candidate | ( ( candidate [ 'label' ] == 'user-provided' && candidate [ 'name' ] =~ pattern ) || candidate [ 'label' ] =~ pattern || ( ! candidate [ 'tags' ] . nil? && candidate [ 'tags' ] . any? { | tag | tag =~ pattern } ) ) && ! candidate [ CREDENTIALS_KEY ] . nil? && candidate [ CREDENTIALS_KEY ] [ SERVER_KEY ] && ! candidate [ CREDENTIALS_KEY ] [ 'environmentid' ] end raise 'Multiple valid dynatrace services exist.' if candidates . length > 1 candidates . one? end
Determines if the dynatrace service is included in VCAP_SERVICES based on whether the
service entry has valid entries.
Determines if the dynatrace service is included in VCAP_SERVICES based on whether the service entry has valid entries .
true if the app is bound to a dynatrace service
true if the app is bound to a dynatrace service
Boolean