source/code/plugins/agent_maintenance_script.rb
# Load necessary configuration values from omsadmin.conf
Load necessary configuration values from omsadmin.conf
Load necessary configuration values from omsadmin . conf
def load_config
      if !File.exist?(@omsadmin_conf_path)
        log_error("Missing configuration file: #{@omsadmin_conf_path}")
        return MISSING_CONFIG_FILE
      end
      File.open(@omsadmin_conf_path, "r").each_line do |line|
        if line =~ /^WORKSPACE_ID/
          @WORKSPACE_ID = line.sub("WORKSPACE_ID=","").strip
        elsif line =~ /^AGENT_GUID/
          @AGENT_GUID = line.sub("AGENT_GUID=","").strip
        elsif line =~ /^URL_TLD/
          @URL_TLD = line.sub("URL_TLD=","").strip
          if !@URL_TLD.end_with?(".com")
            @URL_TLD.concat(".com")  
          end
        elsif line =~ /^LOG_FACILITY/
          @LOG_FACILITY = line.sub("LOG_FACILITY=","").strip
        elsif line =~ /^CERTIFICATE_UPDATE_ENDPOINT/
          @CERTIFICATE_UPDATE_ENDPOINT = line.sub("CERTIFICATE_UPDATE_ENDPOINT=","").strip
        end
      end
      return 0
    end
def load_config if ! File . exist? ( @omsadmin_conf_path ) log_error ( "Missing configuration file: #{@omsadmin_conf_path}" ) return MISSING_CONFIG_FILE end File . open ( @omsadmin_conf_path , "r" ) . each_line do | line | if line =~ / ^WORKSPACE_ID / @WORKSPACE_ID = line . sub ( "WORKSPACE_ID=" , "" ) . strip elsif line =~ / ^AGENT_GUID / @AGENT_GUID = line . sub ( "AGENT_GUID=" , "" ) . strip elsif line =~ / ^URL_TLD / @URL_TLD = line . sub ( "URL_TLD=" , "" ) . strip if ! @URL_TLD . end_with? ( ".com" ) @URL_TLD . concat ( ".com" ) end elsif line =~ / ^LOG_FACILITY / @LOG_FACILITY = line . sub ( "LOG_FACILITY=" , "" ) . strip elsif line =~ / ^CERTIFICATE_UPDATE_ENDPOINT / @CERTIFICATE_UPDATE_ENDPOINT = line . sub ( "CERTIFICATE_UPDATE_ENDPOINT=" , "" ) . strip end end return 0 end
Load necessary configuration values from omsadmin.conf
Load necessary configuration values from omsadmin . conf
# Ensure URL_TLD is backwards-compatible