diff options
author | Pranav <prprakas@redhat.com> | 2020-07-10 11:44:53 +0530 |
---|---|---|
committer | Bala Konda Reddy M <bala12352@gmail.com> | 2020-07-10 07:11:53 +0000 |
commit | cea7339f60f23996fa33ea9ce0fdf57a55f1ad83 (patch) | |
tree | 53f61980de1da5d9ddc1e238142299c4e864b5f6 /glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py | |
parent | c6814acfc8e6db87e4b0be2a09f50b71a37a48aa (diff) |
[Libfix] Fix rpyc dependency for NFS-Ganesha libs
Problem:
The rpyc connection fails in envs where the python
versions are different, resulting in test failures
Fix:
Replace rpyc with standard ssh approach to overcome
this issue
Change-Id: Iee4bb968b8b94a6ab3e0fe0d16babacad914a92d
Signed-off-by: Pranav <prprakas@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py')
-rw-r--r-- | glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py b/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py index 19e98408e..92d22a8a4 100644 --- a/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py +++ b/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py @@ -100,24 +100,25 @@ class NfsGaneshaClusterSetupClass(GlusterBaseClass): "healthy state") ganesha_ha_file = ("/var/run/gluster/shared_storage/" "nfs-ganesha/ganesha-ha.conf") + g_node = cls.servers_in_nfs_ganesha_cluster[0] g.log.info("Collecting server details of existing " "nfs ganesha cluster") - conn = g.rpyc_get_connection( - cls.servers_in_nfs_ganesha_cluster[0], user="root") - if not conn: - tmp_node = cls.servers_in_nfs_ganesha_cluster[0] - g.log.error("Unable to get connection to 'root' of node" - " %s", tmp_node) - return False - if not conn.modules.os.path.exists(ganesha_ha_file): + # Check whether ganesha ha file exists + cmd = "[ -f {} ]".format(ganesha_ha_file) + ret, _, _ = g.run(g_node, cmd) + if ret: g.log.error("Unable to locate %s", ganesha_ha_file) return False - with conn.builtin.open(ganesha_ha_file, "r") as fhand: - ganesha_ha_contents = fhand.read() - g.rpyc_close_connection( - host=cls.servers_in_nfs_ganesha_cluster[0], user="root") + + # Read contents of ganesha_ha_file + cmd = "cat {}".format(ganesha_ha_file) + ret, ganesha_ha_contents, _ = g.run(g_node, cmd) + if ret: + g.log.error("Failed to read %s", ganesha_ha_file) + return False + servers_in_existing_cluster = re.findall(r'VIP_(.*)\=.*', ganesha_ha_contents) |