Exemplo n.º 1
0
    def _get_file_system(self):
        """Determines the default file system or directory for device.

        Returns:
            str: The name of the default file system or directory for the device.

        Raises:
            FileSystemNotFound: When the module is unable to determine the default file system.
        """
        raw_data = self.show("dir", raw_text=True)
        try:
            file_system = re.match(r"\s*.*?(\S+:)", raw_data).group(1)
            return file_system
        except AttributeError:
            raise FileSystemNotFoundError(hostname=self.facts.get("hostname"), command="dir")
Exemplo n.º 2
0
    def _get_file_system(self):
        """Determines the default file system or directory for device.

        Returns:
            str: The name of the default file system or directory for the device.

        Raises:
            FileSystemNotFound: When the module is unable to determine the default file system.
        """
        raw_data = self.show('dir')
        try:
            file_system = re.match(r'\s*.*?(\S+:)', raw_data).group(1)
            return file_system
        except AttributeError:
            # TODO: Get proper hostname
            raise FileSystemNotFoundError(hostname=self.host, command="dir")
Exemplo n.º 3
0
    def _get_file_system(self):
        """Determines the default file system or directory for device.

        Returns:
            str: The name of the default file system or directory for the device.

        Raises:
            FileSystemNotFound: When the module is unable to determine the default file system.
        """
        # Set variables to control while loop
        counter = 0

        # Attempt to gather file system
        while counter < SHOW_DIR_RETRY_COUNT:
            counter += 1
            raw_data = self.show("dir")
            try:
                file_system = re.match(r"\s*.*?(\S+:)", raw_data).group(1)
                return file_system
            except AttributeError:
                # Allow to continue through the loop
                continue

        raise FileSystemNotFoundError(hostname=self.hostname, command="dir")