Commit fd03a625 authored by Karl Wette's avatar Karl Wette
Browse files

Merge branch 'kerberos' into 'master'

Known pulsar online pipeline kerberos authentication

See merge request !757
parents 49d47074 73414d7f
Pipeline #57849 passed with stages
in 77 minutes and 35 seconds
......@@ -131,10 +131,20 @@ 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')
# check for kerberos keytab and certificate
keytab = None
if cp.has_option('kerberos', 'keytab'):
keytab = cp.get('kerberos', 'keytab')
if cp.has_option('kerberos', 'certificate'):
certificate = cp.get('kerberos', 'certificate')
if cp.has_option('kerberos', 'auth_princ'):
authprinc = cp.get('kerberos', 'auth_princ')
else:
raise RuntimeError("No kerberos authentication principle")
else:
raise RuntimeError("Problem with kerberos certificate")
cprun = RawConfigParser()
try:
......@@ -502,11 +512,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)
if keytab is not None:
krbcert = "export KRB5CCNAME={}".format(certificate)
kinit = "/usr/bin/kinit -a -P -F -k -t {} {}".format(keytab, authprinc)
ligoproxyinit = "/usr/bin/ligo-proxy-init -k"
else:
krbcert = ""
kinit = ""
ligoproxyinit = ""
# output wrapper script
......@@ -517,12 +529,13 @@ A configuration .ini file is required.
source {0} # source profile
{1} # enable virtual environment (assumes you have virtualenvwrapper.sh/conda)
{2} # export kerberos certificate location (if required)
{3} # create proxy (if required)
%s {4} # re-run this script
{3} # generate kerberos certificate (if required)
{4} # create proxy (if required)
%s {5} # re-run this script
""" % sys.argv[0]
fp = open(cronwrapperscript, 'w')
fp.write(cronwrapper.format(profile, wov, krbcert, ligoproxyinit, inifile))
fp.write(cronwrapper.format(profile, wov, krbcert, kinit, ligoproxyinit, inifile))
fp.close()
os.chmod(cronwrapperscript, stat.S_IRWXU | stat.S_IRWXG | stat.S_IXOTH) # make executable
except:
......
......@@ -323,7 +323,7 @@ parameters = ['f0rot', 'ra', 'dec'] # a list of pulsar parameters to output (def
datastyle = "border-bottom:1px solid #000" # style for first value
for ol in outputlims:
if ol[-2:] == 'UL': # if value is an upper limit add credible region
cr = resultsdata.values()[0][ifo]['Upper limits']['credible region']
cr = list(resultsdata.values())[0][ifo]['Upper limits']['credible region']
restable.adddata(paramhtmldict[ol].format(cr), dataclass=dataclass, datastyle=datastyle, header=True)
ltable.adddata(paramlatexdict[ol].format(cr))
else:
......
......@@ -830,7 +830,7 @@ def plot_posterior_chain(poslist, param, ifos, grr=None, withhist=0, mplparams=F
ax1 = plt.subplot(gs[:-1])
ax2 = plt.subplot(gs[-1])
pos = poslist[idx]
pos = list(poslist)[idx]
# check for cosiota
if 'iota' == param:
......@@ -1390,7 +1390,7 @@ def plot_Bks_ASDs( Bkdata, delt=86400, plotpsds=True, plotfscan=False, removeout
Bkfig = plt.figure(figsize=(11,3.5), dpi=200)
Bkfig.subplots_adjust(bottom=0.15, left=0.09, right=0.94)
tms = map(lambda x: x-gpstime[0], gpstime)
tms = list(map(lambda x: x-gpstime[0], gpstime))
plt.plot(tms, Bkabs, '.', color=coldict[ifo], markersize=1)
plt.xlabel(r'GPS - %d' % int(gpstime[0]), fontsize=14, fontweight=100)
......@@ -1415,7 +1415,7 @@ def plot_Bks_ASDs( Bkdata, delt=86400, plotpsds=True, plotfscan=False, removeout
# zero pad the data and bin each point in the nearest bin
datazeropad = np.zeros(int(math.ceil(totlen/mindt))+1, dtype=complex)
idx = map(lambda x: int(math.floor((x/mindt)+0.5)), tms)
idx = list(map(lambda x: int(math.floor((x/mindt)+0.5)), tms))
for i in range(0, len(idx)):
datazeropad[idx[i]] = complex(Bk[i,1], Bk[i,2])
......
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