common.external package

Submodules

common.external.dcache_srmclient module

Interface for calling methods of d-cache

exception common.external.dcache_srmclient.DcacheSrmClientError

Bases: Exception

common.external.dcache_srmclient.get_debug_arg(verbose)

return debug command line argument

common.external.dcache_srmclient.srmcp(uri, path, verbose=False, srm_version=2)

run srmcp, if the target is local then specify as file:///filename

common.external.dcache_srmclient.srmls(uri, verbose=False, srm_version=2, long_format=True, recursion_depth=0, offset=None, count=None, _std={})

run srmls

common.external.dcache_srmclient.srmls_parser(uri, verbose=False, srm_version=2, recursion_depth=0)

parse the outcome of the srmls command into a dict

common.external.dcache_srmclient.srmmkdir(uri, verbose=False)

run srmmkdir

common.external.dcache_srmclient.srmrm(uri, verbose=False)

run srmrm

common.external.jlite module

Interface for calling jlite scripts

Besides a VO (mandatory) a group and role can be defined for proxy-init. These should be given as follows:

proxy-init.sh myvo:/myvo/mygroup/Role=myrole

Where myvo, mygroup and myrole are defined by the user. The following calls should be ok:

  1. proxy-init.sh myvo
  2. proxy-init.sh myvo:/myvo
  3. proxy-init.sh myvo:/myvo/mygroup
  4. proxy-init.sh myvo:/myvo/Role=myrole
  5. proxy-init.sh myvo:/myvo/mygroup/Role=myrole

1 and 2 result in a default proxy. 3 explicitly requests a certain group 4 requests a specific role 5 combines a group and a role

common.external.jlite.get_debug_arg(verbose)

return debug command line argument

common.external.jlite.get_proxy_filepath()

get the default proxy filepath

common.external.jlite.proxy_VO(verbose=False)

extract the VO from the proxy_info script

common.external.jlite.proxy_destroy(verbose=False)

destroy the current proxy certificate

common.external.jlite.proxy_info(verbose=False)

run the proxy_info script

common.external.jlite.proxy_info_parser(verbose=False)

parse the output of proxy-info and return as dictionary

common.external.jlite.proxy_init(valid=None, verbose=False, use_proxy=False, vo=None, usercert=None, userkey=None, password=None)

Run the proxy_init script input : valid, time in hours the proxy will be valid (timedelta or str) use_proxy : if set use a proxy as input

otherwise certificate and key are used

Grid password is taken from the Env, and asked for the first time Virtual organisation and optionally a group are also taken from the Env

common.external.jlite.proxy_time_left(verbose=False)

extract the time left from the proxy_info script

common.external.ldapsearch module

Interface for calling ldapsearch from ldap

common.external.ldapsearch.get_debug_arg(verbose)

return debug command line argument

common.external.ldapsearch.ldapsearch(search_filter, search_attribute, verbose=False)

run ldapsearch

common.external.ldapsearch.ldapsearch_grep(keywords, verbose=False)

run ldapsearch

common.external.myproxy module

Interface for calling myproxy functions from myproxy tool

Methods defined to be used :
myproxy myproxy_upload myproxy_retrieve myproxy_info myproxy_version
The following os.environ variables are picked up by myproxyClient.jar, with defaults :
MYPROXY_SERVER px.grid.sara.nl MYPROXY_PORT 7512 MYPROXY_LIFETIME 12 * 3600 (seconds)

An alternative is to use dpu.myproxyinit() to initialize and upload a myproxy

common.external.myproxy.myproxy(arg, verbose=False, _std=None)

run myproxy

common.external.myproxy.myproxy_info(verbose=False)

show info on proxy certificate

common.external.myproxy.myproxy_info_parser(verbose=False)

parse the output of myproxy info and return as dictionary

common.external.myproxy.myproxy_retrieve(verbose=False)

retrieve a proxy certificate

common.external.myproxy.myproxy_upload(verbose=False)

upload the proxy certificate

common.external.myproxy.myproxy_version()

run myproxy to find out (print) the version

common.external.run_command module

Envelop method run for Pythons subprocess

common.external.run_command.run(cmd, verbose=True, stdout=-1, stderr=-1, input_str=None, _std=None, env=None, cmd4log=None)

run the given command input :

_std, dict in which the (string) stdout and stderr will be set input_str, string will be used as input (stdin) verbose, be verbose or not env, dictionary with key,value pairs which will be set in the environment cmd4log, cmd to use in logs (useful if cmdn contains password, etc …)
output :
return code

common.external.voms_clients module

Interface for calling voms-clients scripts: * voms-proxy-destroy * voms-proxy-info * voms-proxy-init

Besides a VO (mandatory) a group and role can be defined for proxy-init. These should be given as follows:

voms-proxy-init –voms myvo:/myvo/mygroup/Role=myrole

Where myvo, mygroup and myrole are defined by the user. The following calls should be ok:

  1. voms-proxy-init –voms myvo
  2. voms-proxy-init –voms myvo:/myvo
  3. voms-proxy-init –voms myvo:/myvo/mygroup
  4. voms-proxy-init –voms myvo:/myvo/Role=myrole
  5. voms-proxy-init –voms myvo:/myvo/mygroup/Role=myrole

1 and 2 result in a default proxy. 3 explicitly requests a certain group 4 requests a specific role 5 combines a group and a role

Furthermore, an interface for fetch-crl is also included. This script can be used to fetch/update the certificate revocation lists. This has to be done every few days in order to keep the CRLs up-to-date and valid.

common.external.voms_clients.check_crls(func)

decorator function that checks whether the CRLs are up-to-date

common.external.voms_clients.fetchcrl(verbose=False)

retrieve certificate revocation lists for the trust anchors in X509_CERT_DIR

common.external.voms_clients.get_debug_arg(verbose)

return debug command line argument

common.external.voms_clients.get_grid_certificate_pass()

If the user has put his certificate pass in the Env -> use it, otherwise ask for it and store (temporary) in the Env

common.external.voms_clients.get_proxy_filepath()

get the default proxy filepath

common.external.voms_clients.proxy_VO(verbose=False)

extract the VO from the proxy_info script

common.external.voms_clients.proxy_destroy(verbose=False)

destroy the current proxy certificate

common.external.voms_clients.proxy_info(verbose=False)

run the proxy_info script

common.external.voms_clients.proxy_info_parser(verbose=False)

parse the output of proxy-info and return as dictionary

common.external.voms_clients.proxy_init(valid=None, verbose=False, use_proxy=False, vo=None, usercert=None, userkey=None, password=None)

Run the proxy_init script input : valid, time in hours the proxy will be valid (timedelta or str) use_proxy : if set use a proxy as input

otherwise certificate and key are used

Grid password is taken from the Env, and asked for the first time Virtual organisation and optionally a group are also taken from the Env

common.external.voms_clients.proxy_time_left(verbose=False)

extract the time left from the proxy_info script

common.external.voms_clients.start_fetchcrl_daemon()

start a thread in the background that will run the fetchcrl() function once per default_crl_update_interval

Module contents

Wrappers for External modules