# Path: muranoagent/bunch.py
# class Bunch(dict):
#     def __getattr__(self, item):
#     def __setattr__(self, key, value):
#     def __delattr__(self, key):
# 
# Path: muranoagent/common/config.py
# CONF = cfg.CONF
# def parse_args(args=None, usage=None, default_config_files=None):
# 
# Path: muranoagent/util.py
# def _to_bytes(string):
# def b64encode(string):
# def b64decode(string):


import json
import os
import shutil
import time
from cryptography.hazmat import backends
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serialization
from oslo_log import log as logging
from muranoagent import bunch
from muranoagent.common import config
from muranoagent import util
                LOG.exception(ex)
                self.remove(timestamp)

    def _verify_signature(self, data, signature):
        if not signature:
            raise ValueError("Required signature was not found")
        self._key.verify(
            signature,
            CONF.rabbitmq.input_queue + data,
            padding.PKCS1v15(), hashes.SHA256())

    def put_execution_result(self, result, execution_plan):
        timestamp = execution_plan['_timestamp']
        if 'ReplyTo' in execution_plan:
            result['ReplyTo'] = execution_plan.get('ReplyTo')
        path = os.path.join(
            self._plans_folder, timestamp,
            ExecutionPlanQueue.result_filename)
        with open(path, 'w') as out_file:
            out_file.write(json.dumps(result))

    def remove(self, timestamp):
        path = os.path.join(self._plans_folder, timestamp)
        shutil.rmtree(path)

    def get_execution_plan_result(self):
        return self._get_first_file(
            ExecutionPlanQueue.result_filename)

    def _load_stamp(self):

# Path: muranoagent/bunch.py
# class Bunch(dict):
#     def __getattr__(self, item):
#     def __setattr__(self, key, value):
#     def __delattr__(self, key):
# 
# Path: muranoagent/common/config.py
# CONF = cfg.CONF
# def parse_args(args=None, usage=None, default_config_files=None):
# 
# Path: muranoagent/util.py
# def _to_bytes(string):
# def b64encode(string):
# def b64decode(string):


# Path: muranoagent/execution_plan_queue.py
import json
import os
import shutil
import time
from cryptography.hazmat import backends
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serialization
from oslo_log import log as logging
from muranoagent import bunch
from muranoagent.common import config
from muranoagent import util

                LOG.exception(ex)
                self.remove(timestamp)

    def _verify_signature(self, data, signature):
        if not signature:
            raise ValueError("Required signature was not found")
        self._key.verify(
            signature,
            CONF.rabbitmq.input_queue + data,
            padding.PKCS1v15(), hashes.SHA256())

    def put_execution_result(self, result, execution_plan):
        timestamp = execution_plan['_timestamp']
        if 'ReplyTo' in execution_plan:
            result['ReplyTo'] = execution_plan.get('ReplyTo')
        path = os.path.join(
            self._plans_folder, timestamp,
            ExecutionPlanQueue.result_filename)
        with open(path, 'w') as out_file:
            out_file.write(json.dumps(result))

    def remove(self, timestamp):
        path = os.path.join(self._plans_folder, timestamp)
        shutil.rmtree(path)

    def get_execution_plan_result(self):
        return self._get_first_file(
            ExecutionPlanQueue.result_filename)

    def _load_stamp(self):

        plan_file_path = os.path.join(