Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
CLIMATE-772 - Update esgf with new server name and use client rather …
…than server certificate.
  • Loading branch information
MichaelArthurAnderson committed Mar 25, 2016
1 parent ef55160 commit 981c8251cc5ec886843d8769eb651a18e167ef48
Showing 4 changed files with 19 additions and 67 deletions.
@@ -21,16 +21,11 @@
# default location of ESGF user credentials
ESGF_CREDENTIALS = "~/.esg/credentials.pem"

# URL for ESGF certificate service
#CERT_SERVICE_URL = "https://localhost:8443/esgf-idp/idp/getcert.htm"
CERT_SERVICE_URL = "https://esg-datanode.jpl.nasa.gov/esgf-idp/idp/getcert.htm"

# Basic authentication realm
REALM = "ESGF"
JPL_HOSTNAME = "esgf-node.jpl.nasa.gov"

# DN of JPL MyProxy server (needs to be explicitely set somtimes)
JPL_MYPROXY_SERVER_DN = "/O=ESGF/OU=esg-datanode.jpl.nasa.gov/CN=host/esg-vm.jpl.nasa.gov"
JPL_MYPROXY_SERVER_DN = "/O=ESGF/OU=ESGF.ORG/CN=esgf-node.jpl.nasa.gov"

# URL of ESGF search service to contact
JPL_SEARCH_SERVICE_URL = "http://esg-datanode.jpl.nasa.gov/esg-search/search"
DEFAULT_ESGF_SEARCH = "http://esg-datanode.jpl.nasa.gov/esg-search/search"
JPL_SEARCH_SERVICE_URL = "http://esgf-node.jpl.nasa.gov/esg-search/search"
DEFAULT_ESGF_SEARCH = "http://esgf-node.jpl.nasa.gov/esg-search/search"
@@ -19,25 +19,28 @@
'''
RCMES module to logon onto the ESGF.
'''
import os

from pyesgf.logon import LogonManager
import os

from ocw.esgf.constants import JPL_MYPROXY_SERVER_DN
from ocw.esgf.constants import JPL_MYPROXY_SERVER_DN, JPL_HOSTNAME

def logon(openid, password):

'''
Function to retrieve a short-term X.509 certificate that can be used to authenticate with ESGF.
The certificate is written in the location ~/.esg/credentials.pem.
The trusted CA certificates are written in the directory ~/.esg/certificates.
'''

# Must configure the DN of the JPL MyProxy server if using a JPL openid
if "esg-datanode.jpl.nasa.gov" in openid:
if JPL_HOSTNAME in openid:
os.environ['MYPROXY_SERVER_DN'] = JPL_MYPROXY_SERVER_DN

lm = LogonManager()
lm.logon_with_openid(openid,password)

lm.logon_with_openid(openid, password)

return lm.is_logged_on()


This file was deleted.

@@ -22,27 +22,24 @@
'''

# constant parameters
USER_OPENID = "https://esg-datanode.jpl.nasa.gov/esgf-idp/openid/lucacinquini"
USER_PASSWORD = "*****"
DATA_DIRECTORY = "/tmp"

from ocw.esgf.logon import logon
from ocw.esgf.logon2 import logon2
from ocw.esgf.search import SearchClient
from ocw.esgf.download import download

def main():
'''Example driver program'''


username = raw_input('Enter your ESGF Username:\n')
password = raw_input('Enter your ESGF Password:\n')

# step 1: obtain short-term certificate
print 'Retrieving ESGF certificate...'
# logon using client-side MyProxy libraries
#if logon(USER_OPENID, USER_PASSWORD):
# print "...done."
# logon through server-side MyProxy service
if logon2(USER_OPENID, USER_PASSWORD):
print "...done"

if logon(username, password):
print "...done."

# step 2: execute faceted search for files
urls = main_obs4mips()
#urls = main_cmip5()

0 comments on commit 981c825

Please sign in to comment.