From 4bf6ce323eb0f92d2dced13c450bc5ea37e1ac3e Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 27 Oct 2022 09:33:01 +0200 Subject: [PATCH] fix(ci): when running the bare-metal pipelines, some files are already on the target side with root ownership. Copy is bypassed Signed-off-by: Raphael Defosseux --- ci-scripts/ran.py | 2 +- ci-scripts/sshconnection.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index ac123ec22d..d978539097 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -743,7 +743,7 @@ class RANManagement(): for x in os.listdir(): if x.endswith('.log') or x.endswith('.log.png'): - mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, x, self.eNBSourceCodePath + '/cmake_targets/', silent=True) + mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, x, self.eNBSourceCodePath + '/cmake_targets/', silent=True, ignorePermDenied=True) # Back to normal mySSH.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) mySSH.command('cd ' + self.eNBSourceCodePath, '\$', 5) diff --git a/ci-scripts/sshconnection.py b/ci-scripts/sshconnection.py index d4e5c1661d..c340603ba1 100644 --- a/ci-scripts/sshconnection.py +++ b/ci-scripts/sshconnection.py @@ -229,7 +229,7 @@ class SSHConnection(): else: return -1 - def copyout(self, ipaddress, username, password, source, destination, silent=False): + def copyout(self, ipaddress, username, password, source, destination, silent=False, ignorePermDenied=False): count = 0 copy_status = False if not silent: @@ -245,6 +245,10 @@ class SSHConnection(): if scp_response == 0: count = 10 copy_status = True + elif scp_response == 1 and ignorePermDenied: + logging.warning('Copy was denied but ignored!') + count = 10 + copy_status = True else: logging.warning('1 - scp_response = ' + str(scp_response)) elif scp_response == 1: @@ -253,6 +257,10 @@ class SSHConnection(): if scp_response == 0 or scp_response == 3: count = 10 copy_status = True + elif scp_response == 1 and ignorePermDenied: + logging.warning('Copy was denied but ignored!') + count = 10 + copy_status = True else: logging.warning('2 - scp_response = ' + str(scp_response)) elif scp_response == 2: