Commit 1e030326 authored by Matthew David Pitkin's avatar Matthew David Pitkin
Browse files

knope_automation_script.py: allow user to specify a kerberos certificate in the configuration file

parent ba12fd34
......@@ -130,6 +130,11 @@ A configuration .ini file is required.
if cp.has_option('configuration', 'cronid'):
cronid = cp.get('configuration', 'cronid')
# check for kerberos certificate
kerberos = None
if cp.has_option('configuration', 'kerberos'):
kerberos = cp.get('configuration', 'kerberos')
cprun = ConfigParser()
try:
cprun.read(runconfig)
......@@ -493,6 +498,13 @@ A configuration .ini file is required.
print("Error... no profile file is given", file=sys.stderr)
sys.exit(1)
if kerberos is not None:
krbcert = "export KRB5CCNAME={}".format(kerberos)
ligoproxyinit = "/usr/bin/ligo-proxy-init -k"
else:
krbcert = ""
ligoproxyinit = ""
# output wrapper script
try:
# set the cron wrapper script (which will re-run this script)
......@@ -500,11 +512,13 @@ A configuration .ini file is required.
cronwrapper = """#!/bin/bash
source {0} # source profile
{1} # enable virtual environment (assumes you have virtualenvwrapper.sh)
%s {2} # re-run this script
{2} # export kerberos certificate location (if required)
{3} # create proxy (if required)
%s {4} # re-run this script
""" % sys.argv[0]
fp = open(cronwrapperscript, 'w')
fp.write(cronwrapper.format(profile, wov, inifile))
fp.write(cronwrapper.format(profile, wov, krbcert, ligoproxyinit, inifile))
fp.close()
os.chmod(cronwrapperscript, stat.S_IRWXU | stat.S_IRWXG | stat.S_IXOTH) # make executable
except:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment