netjsonconfig/backends/openwrt/openwrt.py
def _generate_contents(self, tar):
        """
        Adds configuration files to tarfile instance.

        :param tar: tarfile instance
        :returns: None
        """
        uci = self.render(files=False)
        # create a list with all the packages (and remove empty entries)
        packages = packages_pattern.split(uci)
        if '' in packages:
            packages.remove('')
        # create an UCI file for each configuration package used
        for package in packages:
            lines = package.split('\n')
            package_name = lines[0]
            text_contents = '\n'.join(lines[2:])
            self._add_file(tar=tar,
                           name='{0}{1}'.format(config_path, package_name),
                           contents=text_contents)
def _generate_contents(self, tar):
        """
        Adds configuration files to tarfile instance.

        :param tar: tarfile instance
        :returns: None
        """
        uci = self.render(files=False)
        # create a list with all the packages (and remove empty entries)
        packages = packages_pattern.split(uci)
        if '' in packages:
            packages.remove('')
        # create an UCI file for each configuration package used
        for package in packages:
            lines = package.split('\n')
            package_name = lines[0]
            text_contents = '\n'.join(lines[2:])
            self._add_file(tar=tar,
                           name='{0}{1}'.format(config_path, package_name),
                           contents=text_contents)
def _generate_contents ( self , tar ) : uci = self . render ( files = False ) # create a list with all the packages (and remove empty entries) packages = packages_pattern . split ( uci ) if '' in packages : packages . remove ( '' ) # create an UCI file for each configuration package used for package in packages : lines = package . split ( '\n' ) package_name = lines [ 0 ] text_contents = '\n' . join ( lines [ 2 : ] ) self . _add_file ( tar = tar , name = '{0}{1}' . format ( config_path , package_name ) , contents = text_contents )
Adds configuration files to tarfile instance.

        :param tar: tarfile instance
        :returns: None
Adds configuration files to tarfile instance .