File: //usr/lib/fm-agent/library/__pycache__/pickle_database.cpython-39.pyc
a
��i_ � @ s, d dl Z d dlZd dlZG dd� de�ZdS )� Nc @ s@ e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dS )�PickleDatabasez�This object is a wrapper to access and handle our
local pickle file. We'll use this pickle file as a sort of
database for storing schedules and other info for the agent.c C sv || _ zt�t|d��| _W nT typ t�| jj �}|�
d�| j �� i | _t| j d� |�d| j � Y n0 d S )N�rbz1Unable to open database {}, creating an empty one�wbzDatabase created: %s)
� file_path�pickle�load�open�data� Exception�logging� getLogger� __class__�__name__�warn�format�info)�selfr �log� r �,/usr/lib/fm-agent/library/pickle_database.py�__init__ s ��zPickleDatabase.__init__c C s t �| jt| jd�� d S )Nr )r �dumpr r r �r r r r �save s zPickleDatabase.savec C s
| j | S �N�r �r �keyr r r �__getitem__ s zPickleDatabase.__getitem__c C s || j |<