PATCH: add logging to the CSR submit attempts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

please consider applying the following two patches. The first outputs
the actual certmaster hostname upon error, so that we know where that
minion tries to connect to.

The second adds logging of CSR submits and timeouts, to
/var/log/func/func.log.

commit fede40ee9f80d5626e6b356233dfc63241182b5d
Author: Jan Pazdziora <adelton@xxxxxxxxxxxxxxxxx>
Date:   Wed Jan 16 21:24:04 2008 +0100

    Show the actual certmaster hostname.

diff --git a/func/minion/utils.py b/func/minion/utils.py
index bab4051..a53bdb5 100755
--- a/func/minion/utils.py
+++ b/func/minion/utils.py
@@ -106,7 +106,7 @@ def create_minion_keys():
 	    log.debug("submitting CSR to certmaster %s" % master_uri)
             result, cert_string, ca_cert_string = submit_csr_to_master(csr_file, master_uri)
         except socket.gaierror, e:
-            raise codes.FuncException, "Could not locate certmaster at: http://certmaster:51235/";
+            raise codes.FuncException, "Could not locate certmaster at %s" % master_uri
 
         if not result:
             log.warning("no response from certmaster %s, sleeping 10 seconds" % master_uri)

commit 9a4a5de7660e212b3841ac56acf396cdd6cdc253
Author: Jan Pazdziora <adelton@xxxxxxxxxxxxxxxxx>
Date:   Wed Jan 16 21:23:01 2008 +0100

    Add logging of the CSR submit progress.

diff --git a/func/minion/utils.py b/func/minion/utils.py
index 1ae6e88..bab4051 100755
--- a/func/minion/utils.py
+++ b/func/minion/utils.py
@@ -24,6 +24,7 @@ import codes
 from func import certs
 from func.config import read_config
 from func.commonconfig import FuncdConfig
+from func import logger
 
 # "localhost" is a lame hostname to use for a key, so try to get
 # a more meaningful hostname. We do this by connecting to the certmaster
@@ -99,18 +100,22 @@ def create_minion_keys():
         raise codes.FuncException, "Could not create local keypair or csr for minion funcd session"
 
     result = False
+    log = logger.Logger().logger
     while not result:
         try:
+	    log.debug("submitting CSR to certmaster %s" % master_uri)
             result, cert_string, ca_cert_string = submit_csr_to_master(csr_file, master_uri)
         except socket.gaierror, e:
             raise codes.FuncException, "Could not locate certmaster at: http://certmaster:51235/";
 
-        # logging here would be nice
         if not result:
+            log.warning("no response from certmaster %s, sleeping 10 seconds" % master_uri)
             time.sleep(10)
 
 
     if result:
+        log.debug("received certificate from certmaster %s, storing" % master_uri)
+
         cert_fd = os.open(cert_file, os.O_RDWR|os.O_CREAT, 0644)
         os.write(cert_fd, cert_string)
         os.close(cert_fd)

-- 
Jan Pazdziora

_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux