rucio-clients 1.30.4__tar.gz → 1.30.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rucio-clients might be problematic. Click here for more details.
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/AUTHORS.rst +1 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/PKG-INFO +1 -1
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/etc/rucio.cfg.template +0 -2
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/baseclient.py +5 -60
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/exception.py +5 -105
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/extra.py +0 -3
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/schema/cms.py +23 -10
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/utils.py +2 -2
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/vcsversion.py +3 -3
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/ChangeLog +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/LICENSE +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/MANIFEST.in +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/README.rst +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/bin/rucio +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/bin/rucio-admin +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/etc/rse-accounts.cfg.template +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/etc/rucio.cfg.atlas.client.template +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/__init__.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/alembicrevision.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/__init__.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/accountclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/accountlimitclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/client.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/configclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/credentialclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/didclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/diracclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/downloadclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/exportclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/fileclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/importclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/lifetimeclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/lockclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/metaclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/pingclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/replicaclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/requestclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/rseclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/ruleclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/scopeclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/subscriptionclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/touchclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/client/uploadclient.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/__init__.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/cache.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/config.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/constants.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/constraints.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/didtype.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/logging.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/pcache.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/policy.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/schema/__init__.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/schema/atlas.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/schema/belleii.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/schema/domatpc.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/schema/escape.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/schema/generic.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/schema/generic_multi_vo.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/schema/icecube.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/schema/lsst.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/stomp_utils.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/stopwatch.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/test_rucio_server.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/common/types.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/__init__.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/__init__.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/cache.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/dummy.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/gfal.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/globus.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/gsiftp.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/http_cache.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/mock.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/ngarc.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/posix.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/protocol.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/rclone.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/rfio.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/srm.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/ssh.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/storm.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/webdav.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/protocols/xrootd.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/rse/rsemanager.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio/version.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/lib/rucio_clients.egg-info/SOURCES.txt +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/pylintrc +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/pyproject.toml +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/requirements.txt +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/setup.cfg +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/setup.py +0 -0
- {rucio-clients-1.30.4 → rucio-clients-1.30.6}/setuputil.py +0 -0
|
@@ -43,6 +43,7 @@ Individual contributors to the source code
|
|
|
43
43
|
- Ruturaj Gujar <ruturaj.gujar23@gmail.com> 2019
|
|
44
44
|
- Andrew Lister <andrew.lister@stfc.ac.uk>, 2019
|
|
45
45
|
- Aristeidis Fkiaras <aristeidis.fkiaras@cern.ch>, 2019
|
|
46
|
+
- Matt Snyder <msnyder@bnl.gov>, 2019
|
|
46
47
|
- Benedikt Ziemons <benedikt.ziemons@cern.ch>, 2020
|
|
47
48
|
- Muhammad Aditya Hilmy <mhilmy@hey.com>, 2020
|
|
48
49
|
- Eli Chadwick <eli.chadwick@stfc.ac.uk>, 2020
|
|
@@ -23,17 +23,13 @@ import os
|
|
|
23
23
|
import random
|
|
24
24
|
import sys
|
|
25
25
|
import time
|
|
26
|
-
import socket
|
|
27
|
-
import ssl
|
|
28
|
-
from datetime import datetime, timedelta
|
|
29
|
-
from re import search
|
|
30
26
|
from os import environ, fdopen, path, makedirs, geteuid
|
|
31
27
|
from shutil import move
|
|
32
28
|
from tempfile import mkstemp
|
|
33
29
|
|
|
34
30
|
from dogpile.cache import make_region
|
|
35
31
|
from requests import Session, Response
|
|
36
|
-
from requests.exceptions import ConnectionError
|
|
32
|
+
from requests.exceptions import ConnectionError
|
|
37
33
|
from requests.status_codes import codes
|
|
38
34
|
from configparser import NoOptionError, NoSectionError
|
|
39
35
|
from urllib.parse import urlparse
|
|
@@ -43,16 +39,14 @@ from rucio.common import exception
|
|
|
43
39
|
from rucio.common.config import config_get, config_get_bool, config_get_int
|
|
44
40
|
from rucio.common.exception import (CannotAuthenticate, ClientProtocolNotSupported,
|
|
45
41
|
NoAuthInformation, MissingClientParameter,
|
|
46
|
-
MissingModuleException, ServerConnectionException
|
|
42
|
+
MissingModuleException, ServerConnectionException)
|
|
47
43
|
from rucio.common.extra import import_extras
|
|
48
|
-
from rucio.common.utils import build_url, get_tmp_dir, my_key_generator, parse_response, ssh_sign, setup_logger
|
|
44
|
+
from rucio.common.utils import build_url, get_tmp_dir, my_key_generator, parse_response, ssh_sign, setup_logger
|
|
49
45
|
|
|
50
|
-
EXTRA_MODULES = import_extras(['requests_kerberos'
|
|
46
|
+
EXTRA_MODULES = import_extras(['requests_kerberos'])
|
|
51
47
|
|
|
52
48
|
if EXTRA_MODULES['requests_kerberos']:
|
|
53
49
|
from requests_kerberos import HTTPKerberosAuth # pylint: disable=import-error
|
|
54
|
-
if EXTRA_MODULES['cryptography']:
|
|
55
|
-
from cryptography import x509 # pylint: disable=import-error
|
|
56
50
|
|
|
57
51
|
LOG = setup_logger(module_name=__name__)
|
|
58
52
|
|
|
@@ -141,8 +135,6 @@ class BaseClient(object):
|
|
|
141
135
|
self.auth_oidc_refresh_active = config_get_bool('client', 'auth_oidc_refresh_active', False, False)
|
|
142
136
|
# defining how many minutes before token expires, oidc refresh (if active) should start
|
|
143
137
|
self.auth_oidc_refresh_before_exp = config_get_int('client', 'auth_oidc_refresh_before_exp', False, 20)
|
|
144
|
-
self.sslexpiry_warnlimit_weeks: int = config_get_int('client', 'sslexpiry_warnlimit_weeks', False, 2)
|
|
145
|
-
self.sslexpiry_warnclient: bool = config_get_bool('client', 'sslexpiry_warnclient', False, True)
|
|
146
138
|
|
|
147
139
|
if auth_type is None:
|
|
148
140
|
self.logger.debug('No auth_type passed. Trying to get it from the environment variable RUCIO_AUTH_TYPE and config file.')
|
|
@@ -398,7 +390,6 @@ class BaseClient(object):
|
|
|
398
390
|
self.logger.debug("Request data (length=%d): [%s]" % (len(data), text))
|
|
399
391
|
|
|
400
392
|
result = None
|
|
401
|
-
SSLvalid: bool = False
|
|
402
393
|
for retry in range(self.AUTH_RETRIES + 1):
|
|
403
394
|
try:
|
|
404
395
|
if type_ == 'GET':
|
|
@@ -419,13 +410,6 @@ class BaseClient(object):
|
|
|
419
410
|
if result.status_code // 100 != 2 and result.text:
|
|
420
411
|
# do not do this for successful requests because the caller may be expecting streamed response
|
|
421
412
|
self.logger.debug("Response text (length=%d): [%s]" % (len(result.text), result.text))
|
|
422
|
-
SSLvalid = True
|
|
423
|
-
except SSLError as error:
|
|
424
|
-
# SSLError is a subclass of ConnectionError
|
|
425
|
-
self.logger.error(f'SSLError: {error}')
|
|
426
|
-
if retry > self.request_retries:
|
|
427
|
-
raise
|
|
428
|
-
continue
|
|
429
413
|
except ConnectionError as error:
|
|
430
414
|
self.logger.error('ConnectionError: ' + str(error))
|
|
431
415
|
if retry > self.request_retries:
|
|
@@ -448,18 +432,8 @@ class BaseClient(object):
|
|
|
448
432
|
else:
|
|
449
433
|
break
|
|
450
434
|
|
|
451
|
-
ssl_expirydate = self.__check_ssl_expiry()
|
|
452
|
-
|
|
453
|
-
# something within the request has failed, do error handling
|
|
454
435
|
if result is None:
|
|
455
|
-
|
|
456
|
-
raise ServerSSLCertificateExpiredException(date_to_str(ssl_expirydate))
|
|
457
|
-
else:
|
|
458
|
-
raise ServerConnectionException
|
|
459
|
-
|
|
460
|
-
# check if ssl expires soon and if client warning is requested
|
|
461
|
-
if ssl_expirydate < datetime.now() + timedelta(weeks=self.sslexpiry_warnlimit_weeks) and self.sslexpiry_warnclient:
|
|
462
|
-
self.logger.warning(f'Server SSL Certificate will expire in less than {self.sslexpiry_warnlimit_weeks} weeks on {date_to_str(ssl_expirydate)}.')
|
|
436
|
+
raise ServerConnectionException
|
|
463
437
|
return result
|
|
464
438
|
|
|
465
439
|
def __get_token_userpass(self):
|
|
@@ -953,32 +927,3 @@ class BaseClient(object):
|
|
|
953
927
|
|
|
954
928
|
if not self.__read_token():
|
|
955
929
|
self.__get_token()
|
|
956
|
-
|
|
957
|
-
def __check_ssl_expiry(self) -> datetime:
|
|
958
|
-
context = ssl.create_default_context()
|
|
959
|
-
# override context so that it can get expired cert
|
|
960
|
-
context.check_hostname = False
|
|
961
|
-
context.verify_mode = ssl.CERT_NONE
|
|
962
|
-
|
|
963
|
-
# strip https:// and possibly :443
|
|
964
|
-
# this assumes hostnames are always like https://rucio:443 or https://rucio
|
|
965
|
-
regexpr = '(?<=://)(.+(?=:)|.+(?=$))'
|
|
966
|
-
match = search(regexpr, self.host) # type: ignore
|
|
967
|
-
if not match:
|
|
968
|
-
raise ValueError(f"Could not extract hostname from {self.host}")
|
|
969
|
-
hostname = str(match[0])
|
|
970
|
-
|
|
971
|
-
with socket.create_connection((hostname, 443)) as sock:
|
|
972
|
-
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
|
|
973
|
-
# get cert in DER format
|
|
974
|
-
data: bytes = ssock.getpeercert(True) # type: ignore
|
|
975
|
-
|
|
976
|
-
# convert cert to PEM format
|
|
977
|
-
pem_data = ssl.DER_cert_to_PEM_cert(data)
|
|
978
|
-
|
|
979
|
-
# pem_data in string. convert to bytes using str.encode()
|
|
980
|
-
# extract cert info from PEM format
|
|
981
|
-
cert_data = x509.load_pem_x509_certificate(str.encode(pem_data))
|
|
982
|
-
|
|
983
|
-
# assuming no certificates fail because they are not valid YET
|
|
984
|
-
return cert_data.not_valid_after
|