Commit a039ecc6 authored by Franco Fichtner's avatar Franco Fichtner

templates: remove +MANIFEST; closes #1236

We have manifests for packages, no need to duplicate info
about sub-packages that aren't really packages.

Approved by: @adschellevis

(cherry picked from commit e713d12a)
parent 78debc03
...@@ -614,16 +614,13 @@ ...@@ -614,16 +614,13 @@
/usr/local/opnsense/service/modules/processhandler.py /usr/local/opnsense/service/modules/processhandler.py
/usr/local/opnsense/service/modules/template.py /usr/local/opnsense/service/modules/template.py
/usr/local/opnsense/service/run_unittests.py /usr/local/opnsense/service/run_unittests.py
/usr/local/opnsense/service/templates/OPNsense/Captiveportal/+MANIFEST
/usr/local/opnsense/service/templates/OPNsense/Captiveportal/+TARGETS /usr/local/opnsense/service/templates/OPNsense/Captiveportal/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/Captiveportal/captiveportal.conf /usr/local/opnsense/service/templates/OPNsense/Captiveportal/captiveportal.conf
/usr/local/opnsense/service/templates/OPNsense/Captiveportal/lighttpd-api-dispatcher.conf /usr/local/opnsense/service/templates/OPNsense/Captiveportal/lighttpd-api-dispatcher.conf
/usr/local/opnsense/service/templates/OPNsense/Captiveportal/lighttpd-zone.conf /usr/local/opnsense/service/templates/OPNsense/Captiveportal/lighttpd-zone.conf
/usr/local/opnsense/service/templates/OPNsense/Captiveportal/rc.conf.d /usr/local/opnsense/service/templates/OPNsense/Captiveportal/rc.conf.d
/usr/local/opnsense/service/templates/OPNsense/Cron/+MANIFEST
/usr/local/opnsense/service/templates/OPNsense/Cron/+TARGETS /usr/local/opnsense/service/templates/OPNsense/Cron/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/Cron/user.cron /usr/local/opnsense/service/templates/OPNsense/Cron/user.cron
/usr/local/opnsense/service/templates/OPNsense/IDS/+MANIFEST
/usr/local/opnsense/service/templates/OPNsense/IDS/+TARGETS /usr/local/opnsense/service/templates/OPNsense/IDS/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/IDS/OPNsense.rules /usr/local/opnsense/service/templates/OPNsense/IDS/OPNsense.rules
/usr/local/opnsense/service/templates/OPNsense/IDS/classification.config /usr/local/opnsense/service/templates/OPNsense/IDS/classification.config
...@@ -633,20 +630,17 @@ ...@@ -633,20 +630,17 @@
/usr/local/opnsense/service/templates/OPNsense/IDS/rule-updater.config /usr/local/opnsense/service/templates/OPNsense/IDS/rule-updater.config
/usr/local/opnsense/service/templates/OPNsense/IDS/rules.config /usr/local/opnsense/service/templates/OPNsense/IDS/rules.config
/usr/local/opnsense/service/templates/OPNsense/IDS/suricata.yaml /usr/local/opnsense/service/templates/OPNsense/IDS/suricata.yaml
/usr/local/opnsense/service/templates/OPNsense/IPFW/+MANIFEST
/usr/local/opnsense/service/templates/OPNsense/IPFW/+TARGETS /usr/local/opnsense/service/templates/OPNsense/IPFW/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/IPFW/ipfw.conf /usr/local/opnsense/service/templates/OPNsense/IPFW/ipfw.conf
/usr/local/opnsense/service/templates/OPNsense/IPFW/ipfw.fw.conf /usr/local/opnsense/service/templates/OPNsense/IPFW/ipfw.fw.conf
/usr/local/opnsense/service/templates/OPNsense/IPFW/rc.conf.d /usr/local/opnsense/service/templates/OPNsense/IPFW/rc.conf.d
/usr/local/opnsense/service/templates/OPNsense/Macros/interface.macro /usr/local/opnsense/service/templates/OPNsense/Macros/interface.macro
/usr/local/opnsense/service/templates/OPNsense/Netflow/+MANIFEST
/usr/local/opnsense/service/templates/OPNsense/Netflow/+TARGETS /usr/local/opnsense/service/templates/OPNsense/Netflow/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/Netflow/flowd.conf /usr/local/opnsense/service/templates/OPNsense/Netflow/flowd.conf
/usr/local/opnsense/service/templates/OPNsense/Netflow/flowd.rc.conf.d /usr/local/opnsense/service/templates/OPNsense/Netflow/flowd.rc.conf.d
/usr/local/opnsense/service/templates/OPNsense/Netflow/flowd_aggregate.rc.conf.d /usr/local/opnsense/service/templates/OPNsense/Netflow/flowd_aggregate.rc.conf.d
/usr/local/opnsense/service/templates/OPNsense/Netflow/netflow.conf /usr/local/opnsense/service/templates/OPNsense/Netflow/netflow.conf
/usr/local/opnsense/service/templates/OPNsense/Netflow/rc.conf.d /usr/local/opnsense/service/templates/OPNsense/Netflow/rc.conf.d
/usr/local/opnsense/service/templates/OPNsense/Proxy/+MANIFEST
/usr/local/opnsense/service/templates/OPNsense/Proxy/+TARGETS /usr/local/opnsense/service/templates/OPNsense/Proxy/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/Proxy/ca.pem.id /usr/local/opnsense/service/templates/OPNsense/Proxy/ca.pem.id
/usr/local/opnsense/service/templates/OPNsense/Proxy/externalACLs.conf /usr/local/opnsense/service/templates/OPNsense/Proxy/externalACLs.conf
...@@ -655,7 +649,6 @@ ...@@ -655,7 +649,6 @@
/usr/local/opnsense/service/templates/OPNsense/Proxy/rc.conf.d /usr/local/opnsense/service/templates/OPNsense/Proxy/rc.conf.d
/usr/local/opnsense/service/templates/OPNsense/Proxy/squid.acl.conf /usr/local/opnsense/service/templates/OPNsense/Proxy/squid.acl.conf
/usr/local/opnsense/service/templates/OPNsense/Proxy/squid.conf /usr/local/opnsense/service/templates/OPNsense/Proxy/squid.conf
/usr/local/opnsense/service/templates/OPNsense/Sample/+MANIFEST
/usr/local/opnsense/service/templates/OPNsense/Sample/+TARGETS /usr/local/opnsense/service/templates/OPNsense/Sample/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/Sample/example_config.txt /usr/local/opnsense/service/templates/OPNsense/Sample/example_config.txt
/usr/local/opnsense/service/templates/OPNsense/Sample/example_parent.txt /usr/local/opnsense/service/templates/OPNsense/Sample/example_parent.txt
...@@ -664,7 +657,6 @@ ...@@ -664,7 +657,6 @@
/usr/local/opnsense/service/templates/OPNsense/Sample/sub1/example_sub1.txt /usr/local/opnsense/service/templates/OPNsense/Sample/sub1/example_sub1.txt
/usr/local/opnsense/service/templates/OPNsense/Sample/sub2/+TARGETS /usr/local/opnsense/service/templates/OPNsense/Sample/sub2/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/Sample/sub2/example_sub2.txt /usr/local/opnsense/service/templates/OPNsense/Sample/sub2/example_sub2.txt
/usr/local/opnsense/service/templates/OPNsense/Syslog/+MANIFEST
/usr/local/opnsense/service/templates/OPNsense/Syslog/+TARGETS /usr/local/opnsense/service/templates/OPNsense/Syslog/+TARGETS
/usr/local/opnsense/service/templates/OPNsense/Syslog/newsyslog.conf /usr/local/opnsense/service/templates/OPNsense/Syslog/newsyslog.conf
/usr/local/opnsense/service/tests/__init__.py /usr/local/opnsense/service/tests/__init__.py
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
package : configd package : configd
function: template handler, generate configuration files using templates function: template handler, generate configuration files using templates
""" """
import os import os
import os.path import os.path
import stat import stat
...@@ -41,7 +42,6 @@ import addons.template_helpers ...@@ -41,7 +42,6 @@ import addons.template_helpers
__author__ = 'Ad Schellevis' __author__ = 'Ad Schellevis'
class Template(object): class Template(object):
def __init__(self, target_root_directory="/"): def __init__(self, target_root_directory="/"):
""" constructor """ constructor
...@@ -58,21 +58,6 @@ class Template(object): ...@@ -58,21 +58,6 @@ class Template(object):
self._j2_env = jinja2.Environment(loader=jinja2.FileSystemLoader(self._template_dir), trim_blocks=True, self._j2_env = jinja2.Environment(loader=jinja2.FileSystemLoader(self._template_dir), trim_blocks=True,
extensions=["jinja2.ext.do", "jinja2.ext.loopcontrols"]) extensions=["jinja2.ext.do", "jinja2.ext.loopcontrols"])
@staticmethod
def _read_manifest(filename):
"""
:param filename: manifest filename (path/+MANIFEST)
:return: dictionary containing manifest items
"""
result = {}
for line in open(filename, 'r').read().split('\n'):
parts = line.split(':')
if len(parts) > 1:
result[parts[0]] = ':'.join(parts[1:])
return result
@staticmethod @staticmethod
def _read_targets(filename): def _read_targets(filename):
""" read raw target filename masks """ read raw target filename masks
...@@ -88,16 +73,13 @@ class Template(object): ...@@ -88,16 +73,13 @@ class Template(object):
return result return result
def list_module(self, module_name, read_manifest=False): def list_module(self, module_name):
""" list single module content """ list single module content
:param module_name: module name in dot notation ( company.module ) :param module_name: module name in dot notation ( company.module )
:param read_manifest: boolean, read manifest file if it exists
:return: dictionary with module data :return: dictionary with module data
""" """
result = {} result = {}
file_path = '%s/%s' % (self._template_dir, module_name.replace('.', '/')) file_path = '%s/%s' % (self._template_dir, module_name.replace('.', '/'))
if os.path.exists('%s/+MANIFEST' % file_path) and read_manifest:
result['+MANIFEST'] = self._read_manifest('%s/+MANIFEST' % file_path)
if os.path.exists('%s/+TARGETS' % file_path): if os.path.exists('%s/+TARGETS' % file_path):
result['+TARGETS'] = self._read_targets('%s/+TARGETS' % file_path) result['+TARGETS'] = self._read_targets('%s/+TARGETS' % file_path)
else: else:
......
name: opnsense-captiveportal
version: 0.1
origin: opnsense/captiveportal
comment: captiveportal configuration
desc: configuration templates for captiveportal
maintainer: ad at opnsense.org
www: https://opnsense.org
prefix: /
name: opnsense-cron
version: 0.1
origin: opnsense/cron
comment: OPNsense Cron configuration
desc: configuration templates for Cron
maintainer: jos at opnsense.org
www: https://opnsense.org
prefix: /
name: opnsense-ids
version: 0.1
origin: opnsense/ids
comment: IDS (suricata) configuration
desc: configuration templates for suricata
maintainer: ad at opnsense.org
www: https://opnsense.org
prefix: /
name: opnsense-ipfw
version: 0.1
origin: opnsense/ipfw
comment: IPFW configuration
desc: configuration templates for ipfw rulesets
maintainer: ad at opnsense.org
www: https://opnsense.org
prefix: /
name: opnsense-netflow
version: 1.0
origin: opnsense/netflow
comment: Netflow configuration
desc: netflow configuration templates
maintainer: ad at opnsense.org
www: https://opnsense.org
prefix: /
name: opnsense-proxy
version: 0.1
origin: opnsense/proxy
comment: Squid proxy configuration
desc: configuration templates for squid proxy
maintainer: ad at opnsense.org
www: https://opnsense.org
prefix: /
name: opnsense-sample
version: 0.1
origin: opnsense/sample
comment: OPNsense configuration template example
desc: creates some files in /tmp/.../ based on reporting definitions found in +TARGETS
maintainer: ad at opnsense.org
www: https://opnsense.org
prefix: /
name: opnsense-syslog
version: 0.1
origin: opnsense/syslog
comment: newsyslog base configuration
desc: configuration templates for syslog
maintainer: ad at opnsense.org
www: https://opnsense.org
prefix: /
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment