# Path: netjsonconfig/schema.py
# X509_FILE_MODE = '0600'
# 
# Path: netjsonconfig/backends/base/backend.py
# class BaseVpnBackend(BaseBackend):
#     """
#     Shared logic between VPN backends
#     Requires setting the following attributes:
# 
#     - vpn_pattern
#     - config_suffix
#     """
# 
#     def _generate_contents(self, tar):
#         """
#         Adds configuration files to tarfile instance.
# 
#         :param tar: tarfile instance
#         :returns: None
#         """
#         text = self.render(files=False)
#         # create a list with all the packages (and remove empty entries)
#         vpn_instances = self.vpn_pattern.split(text)
#         if '' in vpn_instances:
#             vpn_instances.remove('')
#         # create a file for each VPN
#         for vpn in vpn_instances:
#             lines = vpn.split('\n')
#             vpn_name = lines[0]
#             text_contents = '\n'.join(lines[2:])
#             # do not end with double new line
#             if text_contents.endswith('\n\n'):
#                 text_contents = text_contents[0:-1]
#             self._add_file(
#                 tar=tar,
#                 name='{0}{1}'.format(vpn_name, self.config_suffix),
#                 contents=text_contents,
#             )
# 
# Path: netjsonconfig/backends/openvpn/parser.py
# class OpenVpnParser(BaseParser):
#     def parse_text(self, config):
#     def parse_tar(self, tar):
#     def _get_vpns(self, text):
#     def _get_config(self, contents):
# 
# Path: netjsonconfig/backends/openvpn/renderer.py
# class OpenVpnRenderer(BaseRenderer):
#     """
#     OpenVPN Renderer
#     """
# 
#     def cleanup(self, output):
#         # remove indentations
#         output = output.replace('    ', '')
#         # remove last newline
#         if output.endswith('\n\n'):
#             output = output[0:-1]
#         return output
# 
# Path: netjsonconfig/backends/openvpn/schema.py



from ...schema import X509_FILE_MODE
from ..base.backend import BaseVpnBackend
from . import converters
from .parser import OpenVpnParser, config_suffix, vpn_pattern
from .renderer import OpenVpnRenderer
from .schema import schema
            ca_contents,
            cert_path,
            cert_contents,
            key_path,
            key_contents,
        )
        return {'openvpn': [client], 'files': files}

    @classmethod
    def _auto_client_files(
        cls,
        client,
        ca_path=None,
        ca_contents=None,
        cert_path=None,
        cert_contents=None,
        key_path=None,
        key_contents=None,
    ):
        """
        returns a list of NetJSON extra files for automatically generated clients
        produces side effects in ``client`` dictionary
        """
        files = []
        if ca_path and ca_contents:
            client['ca'] = ca_path
            files.append(dict(path=ca_path, contents=ca_contents, mode=X509_FILE_MODE))
        if cert_path and cert_contents:
            client['cert'] = cert_path
            files.append(

# Path: netjsonconfig/schema.py
# X509_FILE_MODE = '0600'
# 
# Path: netjsonconfig/backends/base/backend.py
# class BaseVpnBackend(BaseBackend):
#     """
#     Shared logic between VPN backends
#     Requires setting the following attributes:
# 
#     - vpn_pattern
#     - config_suffix
#     """
# 
#     def _generate_contents(self, tar):
#         """
#         Adds configuration files to tarfile instance.
# 
#         :param tar: tarfile instance
#         :returns: None
#         """
#         text = self.render(files=False)
#         # create a list with all the packages (and remove empty entries)
#         vpn_instances = self.vpn_pattern.split(text)
#         if '' in vpn_instances:
#             vpn_instances.remove('')
#         # create a file for each VPN
#         for vpn in vpn_instances:
#             lines = vpn.split('\n')
#             vpn_name = lines[0]
#             text_contents = '\n'.join(lines[2:])
#             # do not end with double new line
#             if text_contents.endswith('\n\n'):
#                 text_contents = text_contents[0:-1]
#             self._add_file(
#                 tar=tar,
#                 name='{0}{1}'.format(vpn_name, self.config_suffix),
#                 contents=text_contents,
#             )
# 
# Path: netjsonconfig/backends/openvpn/parser.py
# class OpenVpnParser(BaseParser):
#     def parse_text(self, config):
#     def parse_tar(self, tar):
#     def _get_vpns(self, text):
#     def _get_config(self, contents):
# 
# Path: netjsonconfig/backends/openvpn/renderer.py
# class OpenVpnRenderer(BaseRenderer):
#     """
#     OpenVPN Renderer
#     """
# 
#     def cleanup(self, output):
#         # remove indentations
#         output = output.replace('    ', '')
#         # remove last newline
#         if output.endswith('\n\n'):
#             output = output[0:-1]
#         return output
# 
# Path: netjsonconfig/backends/openvpn/schema.py



# Path: netjsonconfig/backends/openvpn/openvpn.py
from ...schema import X509_FILE_MODE
from ..base.backend import BaseVpnBackend
from . import converters
from .parser import OpenVpnParser, config_suffix, vpn_pattern
from .renderer import OpenVpnRenderer
from .schema import schema

            ca_contents,
            cert_path,
            cert_contents,
            key_path,
            key_contents,
        )
        return {'openvpn': [client], 'files': files}

    @classmethod
    def _auto_client_files(
        cls,
        client,
        ca_path=None,
        ca_contents=None,
        cert_path=None,
        cert_contents=None,
        key_path=None,
        key_contents=None,
    ):
        """
        returns a list of NetJSON extra files for automatically generated clients
        produces side effects in ``client`` dictionary
        """
        files = []
        if ca_path and ca_contents:
            client['ca'] = ca_path
            files.append(dict(path=ca_path, contents=ca_contents, mode=X509_FILE_MODE))
        if cert_path and cert_contents:
            client['cert'] = cert_path
            files.append(

                dict(path=cert_path, contents=cert_contents, mode=X509_FILE_MODE)