Changeset 1294


Ignore:
Timestamp:
01/15/07 10:37:00 (6 years ago)
Author:
ckb6
Message:

Changed where the rrdbot certs are kept (now services/rrdbot/certs). Removed extra fields the rrdbot service doubled up on for template generation and added the port to cfengine so any service can use it.

Location:
ccsd/trunk/crcnetd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ccsd/trunk/crcnetd/_utils/ccsd_cfengine.py

    r1264 r1294  
    408408        variables["domain"] = config_get_required("network", "domain") 
    409409        variables["site_name"] = config_get_required("network", "site_name") 
     410        variables["port"] = config_get_required(None, "port") 
    410411        variables["server_name"] = config_get_required("network", "server_name") 
    411412        ip = getIP(variables["server_name"]) 
  • ccsd/trunk/crcnetd/modules/ccs_rrdbot.py

    r1284 r1294  
    345345    # Get a list of hosts running the rrdbot service 
    346346    rrdbot = getServiceInstance(session_id, ccs_rrdbot.serviceName) 
    347     hosts = rrdbot.getHostList() 
    348347 
    349348    ca = ccs_ca() 
    350349 
    351     # Loop through each host and ensure that the certs/ directory is populated 
    352     for host in hosts: 
    353         try: 
    354             # Check basic path existance 
    355             hostdir = "%s/hosts/%s" % (outputDir, host) 
    356             if not os.path.isdir(hostdir): 
    357                 # Host does not exist in the revision 
    358                 continue 
    359             rrdbotdir = "%s/rrdbot" % (hostdir) 
    360             if not os.path.isdir(rrdbotdir): 
    361                 log_warn("Host '%s' does not have rrdbot templates!" % host) 
    362                 continue 
    363             # Now check for the certs directory and the certificates 
    364             certsdir = "%s/certs" % (rrdbotdir) 
    365             ensureDirExists(certsdir) 
    366             if not os.path.exists("%s/key.pem" % certsdir): 
    367                 key = ca.getFile("ca/rrdbot-key.pem") 
    368                 fp = open("%s/key.pem" % certsdir, "w") 
    369                 fp.write(key) 
    370                 fp.close() 
    371             if not os.path.exists("%s/cert.pem" % certsdir): 
    372                 cert = ca.getFile("ca/rrdbot-cert.pem") 
    373                 fp = open("%s/cert.pem" % certsdir, "w") 
    374                 fp.write(cert) 
    375                 fp.close() 
    376         except: 
    377             log_error("Could not setup rrdbot certificates for %s" % host, \ 
    378                     sys.exc_info()) 
     350    try: 
     351        certsdir = "%s/services/rrdbot/certs" % (outputDir) 
     352        ensureDirExists(certsdir) 
     353        if not os.path.exists("%s/key.pem" % certsdir): 
     354            key = ca.getFile("ca/rrdbot-key.pem") 
     355            fp = open("%s/key.pem" % certsdir, "w") 
     356            fp.write(key) 
     357            fp.close() 
     358        if not os.path.exists("%s/cert.pem" % certsdir): 
     359            cert = ca.getFile("ca/rrdbot-cert.pem") 
     360            fp = open("%s/cert.pem" % certsdir, "w") 
     361            fp.write(cert) 
     362            fp.close() 
     363    except: 
     364        log_error("Could not setup rrdbot certificates for %s" % host, \ 
     365                sys.exc_info()) 
    379366     
    380367class ccs_rrdbot(ccsd_service): 
     
    412399        variables['classes'] = classes 
    413400 
    414         # Include a list of hosts that the service is enabled on 
    415         variables["hosts"] = self.getEnabledHostList() 
    416         variables["server"] = config_get_required("network", "server_name") 
    417         variables["port"] = config_get("ccsd", "port", DEFAULT_SERVER_PORT) 
    418401        variables["graphport"] = config_get("graphs", "port", "80") 
    419402        return variables 
Note: See TracChangeset for help on using the changeset viewer.