# Path: mcm/librouteros/exceptions.py
# class CmdError( LibError ):
#     '''
#     Commend execution errors.
#     '''
# 
# Path: mcm/exceptions.py
# class ReadError(Exception):
#     '''
#     Exception raised when reading from master or slave occured.
#     '''
# 
# class WriteError(Exception):
#     '''
#     Exception raised when writing to master or slave occured.
#     '''


from posixpath import join as pjoin
from mcm.librouteros import CmdError
from mcm.exceptions import ReadError, WriteError


class StaticConfig:


    def __init__(self, data):
        self.data = data


    def read(self, path):
        for section in self.data:
            if section['path'] == path:
                return section['rules']


    def close(self):
        pass


class ReadOnlyRouterOS:


    def __init__(self, api):
        self.api = api


    def read(self, path):
        cmd = self.cmd_action_join(path=path, action='GET')
        try:
            data = self.api.run(cmd=cmd)

# Path: mcm/librouteros/exceptions.py
# class CmdError( LibError ):
#     '''
#     Commend execution errors.
#     '''
# 
# Path: mcm/exceptions.py
# class ReadError(Exception):
#     '''
#     Exception raised when reading from master or slave occured.
#     '''
# 
# class WriteError(Exception):
#     '''
#     Exception raised when writing to master or slave occured.
#     '''


# Path: mcm/iodevices.py
from posixpath import join as pjoin
from mcm.librouteros import CmdError
from mcm.exceptions import ReadError, WriteError



class StaticConfig:


    def __init__(self, data):
        self.data = data


    def read(self, path):
        for section in self.data:
            if section['path'] == path:
                return section['rules']


    def close(self):
        pass


class ReadOnlyRouterOS:


    def __init__(self, api):
        self.api = api


    def read(self, path):
        cmd = self.cmd_action_join(path=path, action='GET')
        try:
            data = self.api.run(cmd=cmd)

        except CmdError as error: