Skip to content

Commit b1e726b

Browse files
authored
Merge pull request #5900 from TaykYoku/8.0_fixOAuth-4
[8.0][OAuth 2] use dirac-login instead of dirac-proxy-init for tests
2 parents 9bc3d76 + b1cf785 commit b1e726b

File tree

13 files changed

+54
-46
lines changed

13 files changed

+54
-46
lines changed

dirac.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ Registry
241241
# Just for normal users:
242242
JobShare = 200
243243

244-
# Controls automatic Proxy upload by dirac-proxy-init:
244+
# Controls automatic Proxy upload:
245245
AutoUploadProxy = True
246246

247-
# Controls automatic Proxy upload by dirac-proxy-init for Pilot groups:
247+
# Controls automatic Proxy upload for Pilot groups:
248248
AutoUploadPilotProxy = True
249249

250-
# Controls automatic addition of VOMS extension by dirac-proxy-init:
250+
# Controls automatic addition of VOMS extension:
251251
AutoAddVOMS = True
252252
}
253253

src/DIRAC/FrameworkSystem/scripts/dirac_login.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def registerCLISwitches(self):
149149
Script.registerSwitch("T:", "lifetime=", "set access lifetime in hours", self.setLifetime)
150150
Script.registerSwitch(
151151
"O:",
152-
"save-output=",
152+
"out=",
153153
"where to save the authorization result(e.g: proxy or tokens). By default we will try to find a standard place.",
154154
self.setOutputFile,
155155
)
@@ -248,9 +248,10 @@ def loginWithCertificate(self):
248248
chain = X509Chain()
249249
# Load user cert and key
250250
if (result := chain.loadChainFromFile(self.certLoc))["OK"]:
251-
result = chain.loadKeyFromFile(
252-
self.keyLoc, password=prompt("Enter Certificate password: ", is_password=True)
253-
)
251+
# We try to download the key first without a password
252+
if not (result := chain.loadKeyFromFile(self.keyLoc))["OK"]:
253+
password = prompt("Enter Certificate password: ", is_password=True)
254+
result = chain.loadKeyFromFile(self.keyLoc, password=password)
254255
if not result["OK"]:
255256
return result
256257

tests/Integration/Framework/Test_Proxy.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ echo
1919
echo
2020

2121
echo "================================"
22-
echo "=== dirac-proxy-init $PARAMS"
22+
echo "=== dirac-login $PARAMS"
2323
echo
24-
dirac-proxy-init $PARAMS
24+
dirac-login $PARAMS
2525
if [[ "${?}" -ne 0 ]]; then
2626
exit 1
2727
fi
2828
echo
2929

3030
echo "====================="
31-
echo "=== dirac-proxy-info"
31+
echo "=== dirac-login --status"
3232
echo
3333
dirac-proxy-info
3434
if [[ "${?}" -ne 0 ]]; then
@@ -64,9 +64,9 @@ fi
6464
echo
6565

6666
echo "==============================================="
67-
echo "=== dirac-proxy-init -g dirac_admin $PARAMS"
67+
echo "=== dirac-login dirac_admin $PARAMS"
6868
echo
69-
dirac-proxy-init -g dirac_admin $PARAMS
69+
dirac-login dirac_admin $PARAMS
7070
if [[ "${?}" -ne 0 ]]; then
7171
exit 1
7272
fi

tests/Integration/all_integration_client_tests.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1212
echo -e "THIS_DIR=${THIS_DIR}" |& tee -a clientTestOutputs.txt
1313

1414
echo -e "*** $(date -u) Getting a non privileged user\n" |& tee -a clientTestOutputs.txt
15-
dirac-proxy-init -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt; (( ERR |= "${?}" ))
15+
dirac-login -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt; (( ERR |= "${?}" ))
1616

1717
#-------------------------------------------------------------------------------#
1818
echo -e "*** $(date -u) **** Accounting TESTS ****\n"
@@ -24,13 +24,13 @@ pytest "${THIS_DIR}/AccountingSystem/Test_ReportsClient.py" |& tee -a clientTest
2424
echo -e "*** $(date -u) **** RMS TESTS ****\n"
2525

2626
echo -e "*** $(date -u) Getting a non privileged user\n" |& tee -a clientTestOutputs.txt
27-
dirac-proxy-init -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
27+
dirac-login -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
2828

2929
echo -e "*** $(date -u) Starting RMS Client test as a non privileged user\n" |& tee -a clientTestOutputs.txt
3030
pytest "${THIS_DIR}/RequestManagementSystem/Test_Client_Req.py" |& tee -a clientTestOutputs.txt; (( ERR |= "${?}" ))
3131

3232
echo -e "*** $(date -u) getting the prod role again\n" |& tee -a clientTestOutputs.txt
33-
dirac-proxy-init -g prod -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
33+
dirac-login prod -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
3434
echo -e "*** $(date -u) Starting RMS Client test as an admin user\n" |& tee -a clientTestOutputs.txt
3535
pytest "${THIS_DIR}/RequestManagementSystem/Test_Client_Req.py" |& tee -a clientTestOutputs.txt; (( ERR |= "${?}" ))
3636

@@ -56,7 +56,7 @@ python "${THIS_DIR}/WorkloadManagementSystem/Test_SandboxStoreClient.py" --cfg "
5656
pytest "${THIS_DIR}/WorkloadManagementSystem/Test_JobWrapper.py" |& tee -a clientTestOutputs.txt; (( ERR |= "${?}" ))
5757
pytest "${THIS_DIR}/WorkloadManagementSystem/Test_PilotsClient.py" |& tee -a clientTestOutputs.txt; (( ERR |= "${?}" ))
5858
# Make sure we have the prod role for these tests to get the VmRpcOperator permission
59-
dirac-proxy-init -g prod -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
59+
dirac-login prod -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
6060
pytest "${THIS_DIR}/WorkloadManagementSystem/Test_VirtualMachineManagerClient.py" |& tee -a clientTestOutputs.txt; (( ERR |= "${?}" ))
6161

6262
## no real tests
@@ -88,14 +88,14 @@ echo -e "*** $(date -u) **** DataManager TESTS ****\n"
8888

8989

9090
echo -e "*** $(date -u) Getting a non privileged user to find its VO dynamically\n" |& tee -a clientTestOutputs.txt
91-
dirac-proxy-init -g jenkins_user -C $SERVERINSTALLDIR/user/client.pem -K $SERVERINSTALLDIR/user/client.key $DEBUG |& tee -a clientTestOutputs.txt
91+
dirac-login jenkins_user -C $SERVERINSTALLDIR/user/client.pem -K $SERVERINSTALLDIR/user/client.key $DEBUG |& tee -a clientTestOutputs.txt
9292

9393
userVO=$(python -c "import DIRAC; DIRAC.initialize(); from DIRAC.Core.Security.ProxyInfo import getVOfromProxyGroup; print(getVOfromProxyGroup().get('Value',''))")
9494
userVO="${userVO:-Jenkins}"
9595
echo -e "*** $(date -u) VO is "${userVO}"\n" |& tee -a clientTestOutputs.txt
9696

9797
echo -e "*** $(date -u) Getting a privileged user\n" |& tee -a clientTestOutputs.txt
98-
dirac-proxy-init -g jenkins_fcadmin -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
98+
dirac-login jenkins_fcadmin -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
9999

100100
cat >> dataManager_create_folders <<EOF
101101
@@ -111,7 +111,7 @@ EOF
111111
dirac-dms-filecatalog-cli -f FileCatalog < dataManager_create_folders
112112

113113
echo -e "*** $(date -u) Getting a non privileged user\n" |& tee -a clientTestOutputs.txt
114-
dirac-proxy-init -g jenkins_user -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
114+
dirac-login jenkins_user -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
115115

116116
pytest "${THIS_DIR}/DataManagementSystem/Test_DataManager.py" |& tee -a clientTestOutputs.txt; (( ERR |= "${?}" ))
117117

@@ -121,7 +121,7 @@ pytest "${THIS_DIR}/DataManagementSystem/Test_DataManager.py" |& tee -a clientTe
121121
# respectively.
122122

123123
# normal user proxy
124-
dirac-proxy-init -g jenkins_user -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
124+
dirac-login jenkins_user -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}" |& tee -a clientTestOutputs.txt
125125
echo -e "*** $(date -u) **** MultiVO User Metadata TESTS ****\n"
126126
python -m pytest "${THIS_DIR}/DataManagementSystem/Test_UserMetadata.py" |& tee -a clientTestOutputs.txt; (( ERR |= "${?}" ))
127127

tests/Integration/all_integration_server_tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ dirac-restart-component Tornado Tornado "${DEBUG}" |& tee -a "${SERVER_TEST_OUTP
7070

7171
echo -e "*** $(date -u) Run the DFC client tests as user without admin privileges" |& tee -a "${SERVER_TEST_OUTPUT}"
7272
echo -e "*** $(date -u) Getting a non privileged user\n" |& tee -a "${SERVER_TEST_OUTPUT}"
73-
dirac-proxy-init -C "${WORKSPACE}/ServerInstallDIR/user/client.pem" -K "${WORKSPACE}/ServerInstallDIR/user/client.key" "${DEBUG}"
73+
dirac-login -C "${WORKSPACE}/ServerInstallDIR/user/client.pem" -K "${WORKSPACE}/ServerInstallDIR/user/client.key" "${DEBUG}"
7474
python "${THIS_DIR}/DataManagementSystem/Test_Client_DFC.py" |& tee -a "${SERVER_TEST_OUTPUT}"; (( ERR |= "${?}" ))
7575
diracDFCDB |& tee -a "${SERVER_TEST_OUTPUT}"
7676
python "${THIS_DIR}/DataManagementSystem/Test_FileCatalogDB.py" |& tee -a "${SERVER_TEST_OUTPUT}"; (( ERR |= "${?}" ))
@@ -84,7 +84,7 @@ dirac-restart-component Tornado Tornado "${DEBUG}" |& tee -a "${SERVER_TEST_OUTP
8484

8585
echo -e "*** $(date -u) Run it with the admin privileges" |& tee -a "${SERVER_TEST_OUTPUT}"
8686
echo -e "*** $(date -u) getting the prod role again\n" |& tee -a "${SERVER_TEST_OUTPUT}"
87-
dirac-proxy-init -g prod -C "${WORKSPACE}/ServerInstallDIR/user/client.pem" -K "${WORKSPACE}/ServerInstallDIR/user/client.key" "${DEBUG}" |& tee -a "${SERVER_TEST_OUTPUT}"
87+
dirac-login prod -C "${WORKSPACE}/ServerInstallDIR/user/client.pem" -K "${WORKSPACE}/ServerInstallDIR/user/client.key" "${DEBUG}" |& tee -a "${SERVER_TEST_OUTPUT}"
8888
python "${THIS_DIR}/DataManagementSystem/Test_Client_DFC.py" |& tee -a "${SERVER_TEST_OUTPUT}"; (( ERR |= "${?}" ))
8989
diracDFCDB |& tee -a "${SERVER_TEST_OUTPUT}"
9090
python "${THIS_DIR}/DataManagementSystem/Test_FileCatalogDB.py" |& tee -a "${SERVER_TEST_OUTPUT}"; (( ERR |= "${?}" ))

tests/Jenkins/utilities.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,8 @@ diracCredentials() {
607607
echo '==> [diracCredentials]'
608608

609609
sed -i 's/commitNewData = CSAdministrator/commitNewData = authenticated/g' "${SERVERINSTALLDIR}/etc/Configuration_Server.cfg"
610-
if ! dirac-proxy-init -g dirac_admin -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}"; then
611-
echo 'ERROR: dirac-proxy-init failed' >&2
610+
if ! dirac-login dirac_admin --nocs -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}"; then
611+
echo 'ERROR: dirac-login failed' >&2
612612
exit 1
613613
fi
614614
sed -i 's/commitNewData = authenticated/commitNewData = CSAdministrator/g' "${SERVERINSTALLDIR}/etc/Configuration_Server.cfg"
@@ -685,13 +685,13 @@ diracUserAndGroup() {
685685
diracProxies() {
686686
echo '==> [diracProxies]'
687687
# User proxy, should be uploaded anyway
688-
if ! dirac-proxy-init -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}"; then
689-
echo 'ERROR: dirac-proxy-init failed' >&2
688+
if ! dirac-login -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}"; then
689+
echo 'ERROR: dirac-login failed' >&2
690690
exit 1
691691
fi
692692
# group proxy, will be uploaded explicitly
693-
if ! dirac-proxy-init -g prod -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}"; then
694-
echo 'ERROR: dirac-proxy-init failed' >&2
693+
if ! dirac-login prod -C "${SERVERINSTALLDIR}/user/client.pem" -K "${SERVERINSTALLDIR}/user/client.key" "${DEBUG}"; then
694+
echo 'ERROR: dirac-login failed' >&2
695695
exit 1
696696
fi
697697
}

tests/System/client_core.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ echo " ########################## REAL BASICS #############################"
1010
echo " "
1111
echo " "
1212

13-
echo "dirac-proxy-init"
14-
dirac-proxy-init
13+
echo "dirac-login"
14+
dirac-login
15+
if [[ "${?}" -ne 0 ]]; then
16+
exit 1
17+
fi
18+
19+
echo " "
20+
echo "====== dirac-login --status"
21+
dirac-login --status
1522
if [[ "${?}" -ne 0 ]]; then
1623
exit 1
1724
fi
@@ -52,8 +59,8 @@ if [[ "${?}" -eq 0 ]]; then
5259
fi
5360

5461
echo " "
55-
echo "dirac-proxy-init"
56-
dirac-proxy-init
62+
echo "dirac-login"
63+
dirac-login
5764
if [[ "${?}" -ne 0 ]]; then
5865
exit 1
5966
fi

tests/System/client_dms.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ echo " ########################## BEGIN OF USER FILES TEST #####################
66
echo " "
77
echo " "
88

9-
echo "====== dirac-proxy-init -g dteam_user" #this is necesary to upload user files
10-
dirac-proxy-init -g dteam_user
9+
echo "====== dirac-login -g dteam_user" #this is necesary to upload user files
10+
dirac-login dteam_user
1111

1212
dirac_user=$( dirac-proxy-info | awk '/^username / {print $3}' )
1313
#userdir="/dteam/user/$( echo "$USER" | cut -c 1)/$USER"

tests/System/client_multivo.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ echo -e "\nTesting first VO: gridpp"
3535
# just writing the proxy to a different file causes this command to fail
3636
# need to tell DIRAC beforehand where the user proxy will be
3737
export X509_USER_PROXY="${testdir}/gridpp.proxy"
38-
echo "dirac-proxy-init -g gridpp_user --out ${testdir}/gridpp.proxy"
39-
dirac-proxy-init -g gridpp_user --out "${testdir}/gridpp.proxy"
38+
echo "dirac-login gridpp_user --out ${testdir}/gridpp.proxy"
39+
dirac-login gridpp_user --out "${testdir}/gridpp.proxy"
4040
if [[ "${?}" -ne 0 ]]; then
4141
echo "Could not acquire gridpp proxy. Giving up."
4242
exit 1
@@ -58,8 +58,8 @@ dirac-dms-remove-files "/gridpp/diraccert/testfile.${MYDATE}.txt"
5858

5959
export X509_USER_PROXY="${testdir}/dteam.proxy"
6060
echo -e "\nChanging VO to dteam."
61-
echo "dirac-proxy-init -g dteam_user --out ${testdir}/dteam.proxy"
62-
dirac-proxy-init -g dteam_user --out "${testdir}/dteam.proxy"
61+
echo "dirac-login dteam_user --out ${testdir}/dteam.proxy"
62+
dirac-login dteam_user --out "${testdir}/dteam.proxy"
6363
if [[ "${?}" -ne 0 ]]; then
6464
echo "Could not acquire dteam proxy. Giving up."
6565
exit 1

tests/System/client_scripts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ echo " ########################## Getting a proxy #############################"
99
echo " "
1010
echo " "
1111

12-
echo "dirac-proxy-init -g dirac_prod"
13-
dirac-proxy-init -g dirac_prod
12+
echo "dirac-login dirac_prod"
13+
dirac-login dirac_prod
1414
if [[ "${?}" -ne 0 ]]; then
1515
exit 1
1616
fi

0 commit comments

Comments
 (0)