source/code/plugins/agent_maintenance_script.rb
# Updates the CERTIFICATE_UPDATE_ENDPOINT variable and renews certificate if requested
Updates the CERTIFICATE_UPDATE_ENDPOINT variable and renews certificate if requested
Updates the CERTIFICATE_UPDATE_ENDPOINT variable and renews certificate if requested
def apply_certificate_update_endpoint(server_resp, check_for_renew_request = true)
      update_attr = ""
      cert_update_endpoint = ""
      endpoint_tag_regex = /\<CertificateUpdateEndpoint.*updateCertificate=\"(?<update_cert>(true|false))\".*(?<cert_update_endpoint>https.*RenewCertificate).*CertificateUpdateEndpoint\>/
      endpoint_tag_regex.match(server_resp) { |match|
        cert_update_endpoint = match["cert_update_endpoint"]
        update_attr = match["update_cert"]
      }
      if cert_update_endpoint.empty?
        log_error("Could not extract the update certificate endpoint.")
        return MISSING_CERT_UPDATE_ENDPOINT
      elsif update_attr.empty?
        log_error("Could not find the updateCertificate tag in the heartbeat response")
        return ERROR_EXTRACTING_ATTRIBUTES
      end
      @CERTIFICATE_UPDATE_ENDPOINT = cert_update_endpoint
      update_config("CERTIFICATE_UPDATE_ENDPOINT", cert_update_endpoint)
      if update_attr == "true" and check_for_renew_request
        renew_certs_ret = renew_certs
        if renew_certs_ret != 0
          return renew_certs_ret
        end
      end
      return cert_update_endpoint
    end
def apply_certificate_update_endpoint ( server_resp , check_for_renew_request = true ) update_attr = "" cert_update_endpoint = "" endpoint_tag_regex = / \< CertificateUpdateEndpoint.*updateCertificate= \" (?<update_cert>(true|false)) \" .*(?<cert_update_endpoint>https.*RenewCertificate).*CertificateUpdateEndpoint \> / endpoint_tag_regex . match ( server_resp ) { | match | cert_update_endpoint = match [ "cert_update_endpoint" ] update_attr = match [ "update_cert" ] } if cert_update_endpoint . empty? log_error ( "Could not extract the update certificate endpoint." ) return MISSING_CERT_UPDATE_ENDPOINT elsif update_attr . empty? log_error ( "Could not find the updateCertificate tag in the heartbeat response" ) return ERROR_EXTRACTING_ATTRIBUTES end @CERTIFICATE_UPDATE_ENDPOINT = cert_update_endpoint update_config ( "CERTIFICATE_UPDATE_ENDPOINT" , cert_update_endpoint ) if update_attr == "true" and check_for_renew_request renew_certs_ret = renew_certs if renew_certs_ret != 0 return renew_certs_ret end end return cert_update_endpoint end
Updates the CERTIFICATE_UPDATE_ENDPOINT variable and renews certificate if requested
Updates the CERTIFICATE_UPDATE_ENDPOINT variable and renews certificate if requested
# Extract the certificate update endpoint from the server response # Update omsadmin.conf with cert_update_endpoint variable # When apply_dsc_endpoint is called from onboarding, dsc_endpoint will be returned in file # Check in the response if the certs should be renewed
server_resp
<not_specific>
check_for_renew_request
<not_specific>