from .Framework import ExecutableService
from subprocess import Popen, PIPE


class LfdCheck(ExecutableService):

    def __init__(self):

        self.command = 'service lfd status'
        ExecutableService.__init__(self)

    def _get_raw_data(self, stderr=False):
        """
        Get raw data from executed command
        :return: <list>
        """
        try:
            p = Popen(self.command_list, stdout=PIPE, stderr=PIPE)
        except Exception as error:
            # self.error('Executing command {command} resulted in error: {error}'.format(command=self.command,
            #                                                                            error=error))
            # return None
            raise
        p.communicate()

        return p.returncode

    def _get_data(self):
        return self._get_raw_data()
