Browse Source

Improve kt_renewer logging for Kerberos Ticket Renewal Failures

Athithyaa Selvam 6 tháng trước cách đây
mục cha
commit
77001070ad
2 tập tin đã thay đổi với 10 bổ sung5 xóa
  1. 5 0
      desktop/core/src/desktop/conf.py
  2. 5 5
      desktop/core/src/desktop/kt_renewer.py

+ 5 - 0
desktop/core/src/desktop/conf.py

@@ -1042,6 +1042,11 @@ KERBEROS = ConfigSection(
       help=_("Frequency in seconds with which Hue will renew its keytab."),
       type=int,
       default=60 * 60),  # 1h
+    KT_RENEWER_TIMEOUT=Config(
+      key='kt_renewer_timeout',
+      help=_("kt-renewer sleep timeout in seconds"),
+      type=int,
+      default=10),  # 10 secs
     CCACHE_PATH=Config(
       key='ccache_path',
       help=_("Path to keep Kerberos credentials cached."),

+ 5 - 5
desktop/core/src/desktop/kt_renewer.py

@@ -15,10 +15,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import sys
-import time
 import logging
 import subprocess
+import sys
+import time
 
 from desktop.conf import KERBEROS as CONF
 from desktop.supervisor import DjangoCommandSupervisee
@@ -50,15 +50,15 @@ def renew_from_kt():
       subp_stdout = subp.stdout.readlines()
       subp_stderr = subp.stderr.readlines()
 
-      subp_stdout = [line.decode() for line in subp.stdout.readlines()]
-      subp_stderr = [line.decode() for line in subp.stderr.readlines()]
+      subp_stdout = [line.decode() for line in subp_stdout]
+      subp_stderr = [line.decode() for line in subp_stderr]
 
       LOG.error("Couldn't reinit from keytab! `kinit' exited with %s.\n%s\n%s" % (
                 subp.returncode, "\n".join(subp_stdout), "\n".join(subp_stderr)))
       if retries >= max_retries:
         LOG.error("FATAL: max_retries of %s reached. Exiting..." % max_retries)
         sys.exit(subp.returncode)
-      time.sleep(3)
+      time.sleep(CONF.KT_RENEWER_TIMEOUT.get())
     elif CONF.ENABLE_RENEWLIFETIME.get() and max_retries == 0:
       break