def facter_info(): """Returns data from facter. """ with suppress(FileNotFoundError): # facter may not be installed proc = subprocess.Popen(['facter', '--yaml'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = proc.communicate() if not proc.returncode: data = serializer.load(stdout) return {'facter': data}
def data(self): try: return load(self.filename.read_text()) except FileNotFoundError: return {}