Skip to content

Commit e04676f

Browse files
committed
fix: removed some deprecated methods
1 parent f2747f5 commit e04676f

File tree

5 files changed

+2
-79
lines changed

5 files changed

+2
-79
lines changed

src/DIRAC/Core/Base/Script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __call__(self, func=None):
6969
"Invalid dirac- console_scripts entry_point: "
7070
+ repr(entrypoint)
7171
+ "\n"
72-
+ "All dirac- console_scripts should be wrapped in the DiracScript "
72+
+ "All dirac- console_scripts should be wrapped in the Script "
7373
+ "decorator to ensure extension overlays are applied correctly."
7474
)
7575
return entrypointFunc._func()

src/DIRAC/Core/Security/m2crypto/X509Chain.py

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from DIRAC import S_OK, S_ERROR
2222
from DIRAC.Core.Utilities import DErrno
23-
from DIRAC.Core.Utilities.Decorators import executeOnlyIf, deprecated
23+
from DIRAC.Core.Utilities.Decorators import executeOnlyIf
2424
from DIRAC.ConfigurationSystem.Client.Helpers import Registry
2525
from DIRAC.Core.Security.m2crypto import PROXY_OID, LIMITED_PROXY_OID, DIRAC_GROUP_OID, DEFAULT_PROXY_STRENGTH
2626
from DIRAC.Core.Security.m2crypto.X509Certificate import X509Certificate
@@ -165,22 +165,6 @@ def __init__(self, certList=False, keyObj=False):
165165
if keyObj:
166166
self._keyObj = keyObj
167167

168-
@classmethod
169-
@deprecated("Use loadChainFromFile instead", onlyOnce=True)
170-
def instanceFromFile(cls, chainLocation):
171-
"""Class method to generate a X509Chain from a file
172-
173-
:param chainLocation: path to the file
174-
175-
:returns: S_OK(X509Chain)
176-
"""
177-
chain = cls()
178-
result = chain.loadChainFromFile(chainLocation)
179-
if not result["OK"]:
180-
return result
181-
182-
return S_OK(chain)
183-
184168
@staticmethod
185169
def generateX509ChainFromSSLConnection(sslConnection):
186170
"""Returns an instance of X509Chain from the SSL connection
@@ -393,24 +377,6 @@ def getIssuerCert(self):
393377
return S_OK(self._certList[self.__firstProxyStep + 1])
394378
return S_OK(self._certList[-1])
395379

396-
@deprecated("Only here for compatibility reason", onlyOnce=True)
397-
@needPKey
398-
def getPKeyObj(self):
399-
"""
400-
Get the pkey obj
401-
402-
:returns: ~M2Crypto.EVP.PKey object
403-
"""
404-
return S_OK(self._keyObj)
405-
406-
@deprecated("Only here for compatibility reason")
407-
@needCertList
408-
def getCertList(self):
409-
"""
410-
Get the cert list
411-
"""
412-
return S_OK(self._certList)
413-
414380
@needCertList
415381
def getNumCertsInChain(self):
416382
"""

src/DIRAC/Core/Security/test/Test_X509Chain.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -155,33 +155,13 @@ def test_loadChainFromString_non_pem(get_X509Chain_class):
155155
assert res["Errno"] == EX509
156156

157157

158-
@parametrize("key_file", CERTKEYS)
159-
def test_init_with_key(key_file, get_X509Chain_class):
160-
"""Test init with key object as argument and check the content"""
161-
162-
chain1 = get_X509Chain_class()
163-
chain1.loadKeyFromFile(key_file)
164-
165-
# Get the key and check the number of bits
166-
keyObj = chain1.getPKeyObj()["Value"]
167-
168-
chain2 = get_X509Chain_class(keyObj=keyObj)
169-
assert chain1.dumpPKeyToString() == chain2.dumpPKeyToString()
170-
# Careful ! The two keys are the same object
171-
assert chain2.getPKeyObj()["Value"] is keyObj
172-
173-
174158
@parametrize("key_file", CERTKEYS)
175159
def test_privatekey_without_password(key_file, get_X509Chain_class):
176160
"""Test loading a key from a file, retrieve the object and check the content"""
177161

178162
X509Chain = get_X509Chain_class()
179163
res = X509Chain.loadKeyFromFile(key_file)
180164
assert res["OK"]
181-
# Get the key and check the number of bits
182-
res = X509Chain.getPKeyObj()
183-
assert res["OK"]
184-
assert res["Value"].size() == 512
185165

186166
# Check that the content of the object is correct.
187167
# CAUTION ! The object is PKCS8, while the file contains PKCS1.
@@ -195,10 +175,6 @@ def test_privatekey_with_password(get_X509Chain_class):
195175
X509Chain = get_X509Chain_class()
196176
res = X509Chain.loadKeyFromFile(ENCRYPTEDKEY, password=ENCRYPTEDKEYPASS)
197177
assert res["OK"]
198-
# Get the key and check the number of bits
199-
res = X509Chain.getPKeyObj()
200-
assert res["OK"]
201-
assert res["Value"].size() == 512
202178

203179

204180
def test_privatekey_with_wrong_password(get_X509Chain_class):
@@ -233,17 +209,6 @@ def test_getCertInChain_too_far(get_X509Chain_class):
233209
x509Chain.getCertInChain(1)
234210

235211

236-
@parametrize("cert_file", CERTS)
237-
def test_getCertList(cert_file, get_X509Chain_class):
238-
""" " Load a chain, and get its length."""
239-
x509Chain = get_X509Chain_class()
240-
x509Chain.loadChainFromFile(cert_file)
241-
# For a certificate, there should be only 1 certificate in the chain
242-
243-
assert len(x509Chain.getCertList()["Value"]) == 1
244-
assert len(x509Chain.getCertList()["Value"]) == x509Chain.getNumCertsInChain()["Value"]
245-
246-
247212
@parametrize("cert_file", CERTS)
248213
def test_certProperties(cert_file, get_X509Chain_class):
249214
"""Try on a certificate if it is a proxy, limited proxy, VOMS, valid proxy, rfc"""

src/DIRAC/Core/Utilities/Os.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
by default on Error they return None
44
"""
55
import os
6-
import shutil
76

87
import DIRAC
9-
from DIRAC.Core.Utilities.Decorators import deprecated
108
from DIRAC.Core.Utilities.Subprocess import shellCall, systemCall
119
from DIRAC.Core.Utilities import List
1210

@@ -145,8 +143,3 @@ def sourceEnv(timeout, cmdTuple, inputEnv=None):
145143
result["stderr"] = stderr
146144

147145
return result
148-
149-
150-
@deprecated("Will be removed in DIRAC 8.1", onlyOnce=True)
151-
def which(executable):
152-
return shutil.which(executable)

src/DIRAC/Resources/ProxyProvider/test/Test_DIRACCAProxyProvider.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def check(proxyStr, proxyProvider, name):
105105
for result in [
106106
chain.getRemainingSecs(),
107107
chain.getIssuerCert(),
108-
chain.getPKeyObj(),
109108
chain.getCertList(),
110109
chain.getNumCertsInChain(),
111110
chain.generateProxyToString(3600),

0 commit comments

Comments
 (0)