def _get_nfs_exports(self, ip, vapp, node): """Get the exports from remote NFS server (helper method). :param ip: (str): IP address of the NFS server :param vapp: (pyvcloud.vcd.vapp.VApp): The vApp or cluster to which node belongs :param node: (str): IP address of the NFS server :param node: (`lxml.objectify.StringElement`) object representing the vm resource. :return: (List): List of exports """ # TODO(right template) find a right way to retrieve # the template from which nfs node was created. server_config = get_server_runtime_config() template = server_config['broker']['templates'][0] script = f"#!/usr/bin/env bash\nshowmount -e {ip}" result = execute_script_in_nodes( server_config, vapp, template['admin_password'], script, nodes=[node], check_tools=False) lines = result[0][1].content.decode().split('\n') exports = [] for index in range(1, len(lines) - 1): export = lines[index].strip().split()[0] exports.append(export) return exports
def _get_nfs_exports(self, ip, vapp, vm_name): """Get the exports from remote NFS server (helper method). :param ip: (str): IP address of the NFS server :param vapp: (pyvcloud.vcd.vapp.VApp): The vApp or cluster to which node belongs :param vm_name: name of node's VM :return: (List): List of exports """ script = f"#!/usr/bin/env bash\nshowmount -e {ip}" result = execute_script_in_nodes(vapp=vapp, node_names=[vm_name], script=script, check_tools=False) lines = result[0][1].content.decode().split('\n') exports = [] for index in range(1, len(lines) - 1): export = lines[index].strip().split()[0] exports.append(export) return exports