Comments (2)
Yes this feature will be useful as we have morethan 100 templates. Some way is required to group this templates
from netpalm.
You can load any templates you want by editing the config.json
❯ grep j2 config.json
"jinja2_config_templates": "netpalm/backend/plugins/extensibles/j2_config_templates/",
"jinja2_service_templates": "netpalm/backend/plugins/extensibles/j2_service_templates/",
"webhook_jinja2_templates": "netpalm/backend/plugins/extensibles/j2_webhook_templates/",
This can be tricky if you're using netpalm as a dependency. In our case we are cloning into our main project.
For example our project looks like this from the root folder.
├── netpalm
│ ├── CODE_OF_CONDUCT.md
│ ├── config
│ ├── CONTRIBUTING.md
│ ├── docker-compose.ci.yml
│ ├── docker-compose.dev.yml
│ ├── docker-compose.yml
│ ├── dockerfiles
│ ├── gunicorn.conf.py
│ ├── LICENSE
│ ├── netpalm
│ ├── netpalm.postman_collection.json
│ ├── NOTICE
│ ├── pytest.ini
│ ├── README.md
│ ├── redis_gen_new_certs.sh
│ ├── RUNNING_TESTS.md
│ ├── static
│ ├── tests
│ └── worker.py
├── README.md
├── templates
│ ├── config
│ └── service
Our build does some ugly text replace in the netpalm dockerfiles before we build it. I'm sure this could be done easier.
- name: change the context of netpalm controller
replace:
path: /conductor/netpalm/docker-compose.yml
regexp: "^ context: ."
replace: " context: .."
- name: edit the context of netpalm controller dockerfile
lineinfile:
path: /conductor/netpalm/docker-compose.yml
insertafter: "^ context: .."
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
loop:
- { regexp: "^ dockerfile: ./dockerfiles/netpalm_controller_dockerfile",
line: " dockerfile: ./netpalm/dockerfiles/netpalm_controller_dockerfile" }
- { regexp: "^ dockerfile: ./dockerfiles/netpalm_pinned_worker_dockerfile",
line: " dockerfile: ./netpalm/dockerfiles/netpalm_pinned_worker_dockerfile" }
- { regexp: "^ dockerfile: ./dockerfiles/netpalm_fifo_worker_dockerfile",
line: " dockerfile: ./netpalm/dockerfiles/netpalm_fifo_worker_dockerfile" }
- name: edit the dockerfile for netpalm and workers
lineinfile:
path: "{{ item.path }}"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
loop:
- { regexp: "^ADD netpalm/requirements.txt /code/",
line: "ADD ./netpalm/netpalm/requirements.txt /code/",
path: "/conductor/netpalm/dockerfiles/netpalm_controller_dockerfile" }
- { regexp: "^ADD netpalm/worker_requirements.txt /code/",
line: "ADD ./netpalm/netpalm/worker_requirements.txt /code/",
path: "/conductor/netpalm/dockerfiles/netpalm_pinned_worker_dockerfile" }
- { regexp: "^ADD netpalm/worker_requirements.txt /code/",
line: "ADD ./netpalm/netpalm/worker_requirements.txt /code/",
path: "/conductor/netpalm/dockerfiles/netpalm_fifo_worker_dockerfile" }
- { regexp: "^ADD . /code",
line: "ADD ./netpalm /code",
path: "/conductor/netpalm/dockerfiles/netpalm_controller_dockerfile" }
- { regexp: "^ADD . /code",
line: "ADD ./netpalm /code",
path: "/conductor/netpalm/dockerfiles/netpalm_pinned_worker_dockerfile" }
- { regexp: "^ADD . /code",
line: "ADD ./netpalm /code",
path: "/conductor/netpalm/dockerfiles/netpalm_fifo_worker_dockerfile" }
- name: add the templates netpalm controller and workers
lineinfile:
path: "{{ item.path }}"
line: "ADD ./templates /code/templates"
insertafter: "^ADD ./netpalm /code"
loop:
- { path: "/conductor/netpalm/dockerfiles/netpalm_controller_dockerfile" }
- { path: "/conductor/netpalm/dockerfiles/netpalm_pinned_worker_dockerfile" }
- { path: "/conductor/netpalm/dockerfiles/netpalm_fifo_worker_dockerfile" }
- name: Update netpalm templates directory in netpalm config
lineinfile:
path: /conductor/netpalm/config/config.json
regexp: "{{ item.regex }}"
line: "{{ item.line }}"
loop:
- { regex: '"jinja2_service_templates":',
line: ' "jinja2_service_templates": "/code/templates/service/",' }
- { regex: '"jinja2_config_templates":',
line: ' "jinja2_config_templates": "/code/templates/config/",' }
from netpalm.
Related Issues (20)
- Out of process by orphan processes HOT 5
- Custom scripts fail at failing HOT 3
- FR - caching on scripts
- Bug for newly updated extensibles - not available in swagger and 404 when called
- Scripts to support model definition in same file
- Allow for customization of Response objects HOT 1
- Ability to set TTL on a per-task basis
- FR: static work queues
- FR: method to scrub logs HOT 1
- FR: new extensibles endpoints
- Can't use https://textfsm.nornir.tech to import textfsm templates HOT 2
- Genie not available as parser HOT 4
- Use multiple ttp templates with multiple commands HOT 4
- read_timeout not working in setconfig HOT 1
- Can't retrieve response HOT 2
- Published Containers have expired certs
- Adding new driver SOAP HOT 4
- Error installing netpalm HOT 2
- Docker containers keep restarting HOT 7
- Swagger documentation now rendered anymore."Please indicate a valid Swagger or OpenAPI version field" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netpalm.