bundlewrap/bundles/octoprint/items.py

46 lines
1.3 KiB
Python
Raw Normal View History

2020-09-20 13:05:17 +00:00
actions = {
'octoprint_create_virtualenv': {
'command': 'sudo -u octoprint /usr/bin/python3 -m virtualenv -p python3 /opt/octoprint/venv/',
'unless': 'test -d /opt/octoprint/venv/',
'needs': {
'directory:/opt/octoprint', # provided by bundle:users
'user:octoprint',
},
},
'octoprint_install_octoprint': {
'command': 'sudo -u octoprint /opt/octoprint/venv/bin/pip install OctoPrint',
'unless': 'test -f /opt/octoprint/venv/bin/octoprint',
'needs': {
'action:octoprint_create_virtualenv',
},
},
}
svc_systemd = {
'octoprint': {
'needs': {
'file:/etc/systemd/system/octoprint.service',
'action:octoprint_install_octoprint',
},
},
}
files = {
'/etc/systemd/system/octoprint.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:octoprint:restart',
2020-09-20 13:05:17 +00:00
},
},
'/opt/octoprint/systemd-wrapper': {
'mode': '0755',
},
2020-11-21 19:35:29 +00:00
'/usr/local/share/icinga/plugins/check_octoprint_update': {
'mode': '0755',
'content_type': 'mako',
'context': {
'api_key': node.metadata.get('octoprint', {}).get('api_key', ''),
},
},
2020-09-20 13:05:17 +00:00
}