Change in osmo-gsm-tester[master]: remote: Add more helpers to operate on remote hosts

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Feb 11 15:09:04 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17127 )

Change subject: remote: Add more helpers to operate on remote hosts
......................................................................

remote: Add more helpers to operate on remote hosts

Change-Id: I034314839675038762e00750b069eee8fcb70a5c
---
M src/osmo_gsm_tester/remote.py
A utils/osmo-gsm-tester_setcap_netsys_admin.sh
2 files changed, 35 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



diff --git a/src/osmo_gsm_tester/remote.py b/src/osmo_gsm_tester/remote.py
index 65c621e..42a7981 100644
--- a/src/osmo_gsm_tester/remote.py
+++ b/src/osmo_gsm_tester/remote.py
@@ -151,3 +151,36 @@
 
     def scp(self, name, local_path, remote_path):
         process.run_local_sync(self.run_dir, name, ('scp', '-r', local_path, '%s@%s:%s' % (self.user(), self.host(), remote_path)))
+
+    def scpfrom(self, name, remote_path, local_path):
+        process.run_local_sync(self.run_dir, name, ('scp', '-r', '%s@%s:%s' % (self.user(), self.host(), remote_path), local_path))
+
+    def setcap_net_admin(self, binary_path):
+        '''
+        This functionality requires specific setup on the host running
+        osmo-gsm-tester. See osmo-gsm-tester manual for more information.
+        '''
+        SETCAP_NET_ADMIN_BIN = 'osmo-gsm-tester_setcap_net_admin.sh'
+        self.run_remote_sync('setcap-netadm', ('sudo', SETCAP_NET_ADMIN_BIN, binary_path))
+
+    def setcap_netsys_admin(self, binary_path):
+        '''
+        This functionality requires specific setup on the host running
+        osmo-gsm-tester. See osmo-gsm-tester manual for more information.
+        '''
+        SETCAP_NETSYS_ADMIN_BIN = 'osmo-gsm-tester_setcap_netsys_admin.sh'
+        self.run_remote_sync('setcap-netsysadm', ('sudo', SETCAP_NETSYS_ADMIN_BIN, binary_path))
+
+    def change_elf_rpath(self, binary_path, paths):
+        '''
+        Change RPATH field in ELF executable binary.
+        This feature can be used to tell the loaded to load the trial libraries, as
+        LD_LIBRARY_PATH is disabled for paths with modified capabilities.
+        '''
+        patchelf_bin = self.remote_env.get('PATCHELF_BIN', None)
+        if not patchelf_bin:
+            patchelf_bin = 'patchelf'
+        else:
+            self.dbg('Using specific patchelf from %s', patchelf_bin)
+
+        self.run_remote_sync('patchelf', (patchelf_bin, '--set-rpath', paths, binary_path))
diff --git a/utils/osmo-gsm-tester_setcap_netsys_admin.sh b/utils/osmo-gsm-tester_setcap_netsys_admin.sh
new file mode 100755
index 0000000..c432e1a
--- /dev/null
+++ b/utils/osmo-gsm-tester_setcap_netsys_admin.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+/sbin/setcap cap_net_admin,cap_sys_admin+ep "$1"

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17127
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I034314839675038762e00750b069eee8fcb70a5c
Gerrit-Change-Number: 17127
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200211/8c934daa/attachment.htm>


More information about the gerrit-log mailing list