source/code/plugins/agent_maintenance_script.rb
# Pass the server response from an XML file to apply_dsc_endpoint and apply_certificate_update_endpoint
# Save DSC_ENDPOINT and CERTIFICATE_UPDATE_ENDPOINT variables in file to be read outside of this script
Pass the server response from an XML file to apply_dsc_endpoint and apply_certificate_update_endpoint
Save DSC_ENDPOINT and CERTIFICATE_UPDATE_ENDPOINT variables in file to be read outside of this script
Pass the server response from an XML file to apply_dsc_endpoint and apply_certificate_update_endpoint Save DSC_ENDPOINT and CERTIFICATE_UPDATE_ENDPOINT variables in file to be read outside of this script
def apply_endpoints_file(xml_file, output_file)
      if !file_exists_nonempty(xml_file)
        return MISSING_CONFIG_FILE
      end
      server_resp = File.read(xml_file)
      cert_update_applied = apply_certificate_update_endpoint(server_resp, check_for_renew_request = false)
      dsc_applied = apply_dsc_endpoint(server_resp)
      if cert_update_applied.class != String
        return cert_update_applied
      elsif dsc_applied.class != String
        return dsc_applied
      else
        output_handle = nil
        begin
          output_handle = File.new(output_file, "w")
          chown_omsagent(output_file)
          output_handle.write("#{cert_update_applied}\n"\
                              "#{dsc_applied}\n")
        rescue => e
          log_error("Error saving endpoints to file: #{e.message}")
          return ERROR_WRITING_TO_FILE
        ensure
          if !output_handle.nil?
            output_handle.close
          end
        end
      end
      return 0
    end
def apply_endpoints_file ( xml_file , output_file ) if ! file_exists_nonempty ( xml_file ) return MISSING_CONFIG_FILE end server_resp = File . read ( xml_file ) cert_update_applied = apply_certificate_update_endpoint ( server_resp , check_for_renew_request = false ) dsc_applied = apply_dsc_endpoint ( server_resp ) if cert_update_applied . class != String return cert_update_applied elsif dsc_applied . class != String return dsc_applied else output_handle = nil begin output_handle = File . new ( output_file , "w" ) chown_omsagent ( output_file ) output_handle . write ( "#{cert_update_applied}\n" "#{dsc_applied}\n" ) rescue => e log_error ( "Error saving endpoints to file: #{e.message}" ) return ERROR_WRITING_TO_FILE ensure if ! output_handle . nil? output_handle . close end end end return 0 end
Pass the server response from an XML file to apply_dsc_endpoint and apply_certificate_update_endpoint
Save DSC_ENDPOINT and CERTIFICATE_UPDATE_ENDPOINT variables in file to be read outside of this script
Pass the server response from an XML file to apply_dsc_endpoint and apply_certificate_update_endpoint Save DSC_ENDPOINT and CERTIFICATE_UPDATE_ENDPOINT variables in file to be read outside of this script
# To return endpoint strings to onboarding script, save to file
xml_file
<not_specific>
output_file
<not_specific>