Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c6b0554c7 | ||
|
|
537c205757 | ||
|
|
f07b2477f5 | ||
|
|
5e5531f6d8 | ||
|
|
eadc9ee795 | ||
|
|
0b3f94b6bd | ||
|
|
9f8d30a66c | ||
|
|
2a8eea086c | ||
|
|
bb0bfaee56 | ||
|
|
b8209e8e09 | ||
|
|
a5b87a9067 | ||
|
|
b3e547c60f | ||
|
|
1ead6e2d20 | ||
|
|
016bdd542a | ||
|
|
4dc9d0a536 | ||
|
|
4b11032567 | ||
|
|
0c54eaf176 | ||
|
|
401ebcf685 | ||
|
|
69e5f137a6 | ||
|
|
a0f2079fb5 |
No files matched your search
+7
-6
@@ -7,12 +7,13 @@
|
|||||||
# The file is processed from top to bottom, the first matching line wins. If <tag> or <reference commit> are left out,
|
# The file is processed from top to bottom, the first matching line wins. If <tag> or <reference commit> are left out,
|
||||||
# the lookup table does not apply to the matched branches
|
# the lookup table does not apply to the matched branches
|
||||||
|
|
||||||
# master and staging shall not use the lookup table
|
# master shall not use the lookup table, only tags
|
||||||
master
|
master
|
||||||
staging
|
|
||||||
|
|
||||||
# fix/ branches are fixes for master, so we don't handle those either
|
# maintenance is currently the branch for preparation of maintenance release 1.2.2
|
||||||
fix/.*
|
# so are any fix/... branches
|
||||||
|
maintenance 1.2.2-dev 9f8d30a66c2fcc5cd0e8984c72dc36f7e84fde10
|
||||||
|
fix/.* 1.2.2-dev 9f8d30a66c2fcc5cd0e8984c72dc36f7e84fde10
|
||||||
|
|
||||||
# every other branch is a development branch and thus gets resolved to 1.2.0-dev for now
|
# every other branch is a development branch and thus gets resolved to 1.3.0-dev for now
|
||||||
.* 1.2.0-dev 50cf776e70b9
|
.* 1.3.0-dev 198d3450d94be1a2
|
||||||
+35
-1
@@ -1,5 +1,39 @@
|
|||||||
# OctoPrint Changelog
|
# OctoPrint Changelog
|
||||||
|
|
||||||
|
## 1.2.2 (2015-06-30)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Fixed an admin-only security issue introduced in 1.2.0, updating is strongly advised.
|
||||||
|
|
||||||
|
([Commits](https://github.com/foosel/OctoPrint/compare/1.2.1...1.2.2))
|
||||||
|
|
||||||
|
## 1.2.1 (2015-06-30)
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
* More flexibility when interpreting compatibility data from plugin repository. If compatibility information is provided
|
||||||
|
only as a version number it's prefixed with `>=` for the check (so stating a compatibility of only
|
||||||
|
`1.2.0` will now make the plugin compatible to OctoPrint 1.2.0+, not only 1.2.0). Alternatively the compatibility
|
||||||
|
information may now contain stuff like `>=1.2,<1.3` in which case the plugin will only be shown as compatible
|
||||||
|
to OctoPrint versions 1.2.0 and up but not 1.3.0 or anything above that. See also
|
||||||
|
[the requirement specification format of the `pkg_resources` package](https://pythonhosted.org/setuptools/pkg_resources.html#requirements-parsing).
|
||||||
|
* Only print the commands of configured event handlers to the log when a new `debug` flag is present in the config
|
||||||
|
(see [the docs](http://docs.octoprint.org/en/master/configuration/config_yaml.html#events)). Reduces risk of disclosing sensitive data when sharing log files.
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#956](https://github.com/foosel/OctoPrint/issues/956) - Fixed server crash when trying to configure a default
|
||||||
|
slicing profile for a still unconfigured slicer.
|
||||||
|
* [#957](https://github.com/foosel/OctoPrint/issues/957) - Increased maximum allowed body size for plugin archive uploads.
|
||||||
|
* Bugs without tickets:
|
||||||
|
* Clean exit on `SIGTERM`, calling the shutdown functions provided by plugins.
|
||||||
|
* Don't disconnect on `volume.init` errors from the firmware.
|
||||||
|
* `touch` uploaded files on local file storage to ensure proper "uploaded date" even for files that are just moved
|
||||||
|
from other locations of the file system (e.g. when being added from the `watched` folder).
|
||||||
|
|
||||||
|
([Commits](https://github.com/foosel/OctoPrint/compare/1.2.0...1.2.1))
|
||||||
|
|
||||||
## 1.2.0 (2015-06-25)
|
## 1.2.0 (2015-06-25)
|
||||||
|
|
||||||
### Note for Upgraders
|
### Note for Upgraders
|
||||||
@@ -142,7 +176,7 @@
|
|||||||
changed under "Temperatures" in the Settings ([#343](https://github.com/foosel/OctoPrint/issues/343)).
|
changed under "Temperatures" in the Settings ([#343](https://github.com/foosel/OctoPrint/issues/343)).
|
||||||
* High-DPI support for the GCode viewer ([#837](https://github.com/foosel/OctoPrint/issues/837)).
|
* High-DPI support for the GCode viewer ([#837](https://github.com/foosel/OctoPrint/issues/837)).
|
||||||
* Stop websocket connections from multiplying ([#888](https://github.com/foosel/OctoPrint/pull/888)).
|
* Stop websocket connections from multiplying ([#888](https://github.com/foosel/OctoPrint/pull/888)).
|
||||||
* New setting to rotate webcam by 90° counter clockwise ([#895](https://github.com/foosel/OctoPrint/issues/895) and
|
* New setting to rotate webcam by 90° counter clockwise ([#895](https://github.com/foosel/OctoPrint/issues/895) and
|
||||||
[#906](https://github.com/foosel/OctoPrint/pull/906))
|
[#906](https://github.com/foosel/OctoPrint/pull/906))
|
||||||
* System commands now be set to a) run asynchronized by setting their `async` property to `true` and b) to ignore their
|
* System commands now be set to a) run asynchronized by setting their `async` property to `true` and b) to ignore their
|
||||||
result by setting their `ignore` property to `true`.
|
result by setting their `ignore` property to `true`.
|
||||||
|
|||||||
@@ -366,6 +366,27 @@ Use the following settings to add shell/gcode commands to be executed on certain
|
|||||||
type: gcode
|
type: gcode
|
||||||
enabled: False
|
enabled: False
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
For debugging purposes, you can also add an additional property ``debug`` to your event subscription definitions
|
||||||
|
that if set to true will make the event handler print a log line with your subscription's command after performing
|
||||||
|
all placeholder replacements. Example:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
events:
|
||||||
|
subscriptions:
|
||||||
|
- event: Startup
|
||||||
|
command: "logger 'OctoPrint started up'"
|
||||||
|
type: system
|
||||||
|
debug: true
|
||||||
|
|
||||||
|
This will be logged in OctoPrint's logfile as
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
Executing System Command: logger 'OctoPrint started up'
|
||||||
|
|
||||||
.. _sec-configuration-config_yaml-feature:
|
.. _sec-configuration-config_yaml-feature:
|
||||||
|
|
||||||
Feature
|
Feature
|
||||||
|
|||||||
+17
-13
@@ -254,10 +254,11 @@ class CommandTrigger(GenericEventListener):
|
|||||||
event = subscription["event"]
|
event = subscription["event"]
|
||||||
command = subscription["command"]
|
command = subscription["command"]
|
||||||
commandType = subscription["type"]
|
commandType = subscription["type"]
|
||||||
|
debug = subscription["debug"] if "debug" in subscription else False
|
||||||
|
|
||||||
if not event in self._subscriptions.keys():
|
if not event in self._subscriptions.keys():
|
||||||
self._subscriptions[event] = []
|
self._subscriptions[event] = []
|
||||||
self._subscriptions[event].append((command, commandType))
|
self._subscriptions[event].append((command, commandType, debug))
|
||||||
|
|
||||||
if not event in eventsToSubscribe:
|
if not event in eventsToSubscribe:
|
||||||
eventsToSubscribe.append(event)
|
eventsToSubscribe.append(event)
|
||||||
@@ -275,7 +276,7 @@ class CommandTrigger(GenericEventListener):
|
|||||||
if not event in self._subscriptions:
|
if not event in self._subscriptions:
|
||||||
return
|
return
|
||||||
|
|
||||||
for command, commandType in self._subscriptions[event]:
|
for command, commandType, debug in self._subscriptions[event]:
|
||||||
try:
|
try:
|
||||||
if isinstance(command, (tuple, list, set)):
|
if isinstance(command, (tuple, list, set)):
|
||||||
processedCommand = []
|
processedCommand = []
|
||||||
@@ -283,19 +284,23 @@ class CommandTrigger(GenericEventListener):
|
|||||||
processedCommand.append(self._processCommand(c, payload))
|
processedCommand.append(self._processCommand(c, payload))
|
||||||
else:
|
else:
|
||||||
processedCommand = self._processCommand(command, payload)
|
processedCommand = self._processCommand(command, payload)
|
||||||
self.executeCommand(processedCommand, commandType)
|
self.executeCommand(processedCommand, commandType, debug=debug)
|
||||||
except KeyError, e:
|
except KeyError, e:
|
||||||
self._logger.warn("There was an error processing one or more placeholders in the following command: %s" % command)
|
self._logger.warn("There was an error processing one or more placeholders in the following command: %s" % command)
|
||||||
|
|
||||||
def executeCommand(self, command, commandType):
|
def executeCommand(self, command, commandType, debug=False):
|
||||||
if commandType == "system":
|
if commandType == "system":
|
||||||
self._executeSystemCommand(command)
|
self._executeSystemCommand(command, debug=debug)
|
||||||
elif commandType == "gcode":
|
elif commandType == "gcode":
|
||||||
self._executeGcodeCommand(command)
|
self._executeGcodeCommand(command, debug=debug)
|
||||||
|
|
||||||
def _executeSystemCommand(self, command):
|
def _executeSystemCommand(self, command, debug=False):
|
||||||
def commandExecutioner(command):
|
def commandExecutioner(command):
|
||||||
self._logger.info("Executing system command: %s" % command)
|
if debug:
|
||||||
|
self._logger.info("Executing system command: %s" % command)
|
||||||
|
# we run this with shell=True since we have to trust whatever
|
||||||
|
# our admin configured as command and since we want to allow
|
||||||
|
# shell-alike handling here...
|
||||||
subprocess.Popen(command, shell=True)
|
subprocess.Popen(command, shell=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -306,16 +311,15 @@ class CommandTrigger(GenericEventListener):
|
|||||||
commandExecutioner(command)
|
commandExecutioner(command)
|
||||||
except subprocess.CalledProcessError, e:
|
except subprocess.CalledProcessError, e:
|
||||||
self._logger.warn("Command failed with return code %i: %s" % (e.returncode, str(e)))
|
self._logger.warn("Command failed with return code %i: %s" % (e.returncode, str(e)))
|
||||||
except Exception, ex:
|
except:
|
||||||
self._logger.exception("Command failed")
|
self._logger.exception("Command failed")
|
||||||
|
|
||||||
def _executeGcodeCommand(self, command):
|
def _executeGcodeCommand(self, command, debug=False):
|
||||||
commands = [command]
|
commands = [command]
|
||||||
if isinstance(command, (list, tuple, set)):
|
if isinstance(command, (list, tuple, set)):
|
||||||
self._logger.debug("Executing GCode commands: %r" % command)
|
|
||||||
commands = list(command)
|
commands = list(command)
|
||||||
else:
|
if debug:
|
||||||
self._logger.debug("Executing GCode command: %s" % command)
|
self._logger.info("Executing GCode commands: %r" % command)
|
||||||
self._printer.commands(commands)
|
self._printer.commands(commands)
|
||||||
|
|
||||||
def _processCommand(self, command, payload):
|
def _processCommand(self, command, payload):
|
||||||
|
|||||||
@@ -455,6 +455,9 @@ class LocalFileStorage(StorageInterface):
|
|||||||
|
|
||||||
self._add_links(name, path, links)
|
self._add_links(name, path, links)
|
||||||
|
|
||||||
|
# touch the file to set last access and modification time to now
|
||||||
|
os.utime(file_path, None)
|
||||||
|
|
||||||
return self.path_in_storage((path, name))
|
return self.path_in_storage((path, name))
|
||||||
|
|
||||||
def remove_file(self, path):
|
def remove_file(self, path):
|
||||||
|
|||||||
@@ -1213,15 +1213,15 @@ class Plugin(object):
|
|||||||
class RestartNeedingPlugin(Plugin):
|
class RestartNeedingPlugin(Plugin):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class PluginNeedsRestart(BaseException):
|
class PluginNeedsRestart(Exception):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
BaseException.__init__(self)
|
Exception.__init__(self)
|
||||||
self.name = name
|
self.name = name
|
||||||
self.message = "Plugin {name} cannot be enabled or disabled after system startup".format(**locals())
|
self.message = "Plugin {name} cannot be enabled or disabled after system startup".format(**locals())
|
||||||
|
|
||||||
class PluginLifecycleException(BaseException):
|
class PluginLifecycleException(Exception):
|
||||||
def __init__(self, name, reason, message):
|
def __init__(self, name, reason, message):
|
||||||
BaseException.__init__(self)
|
Exception.__init__(self)
|
||||||
self.name = name
|
self.name = name
|
||||||
self.reason = reason
|
self.reason = reason
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
|||||||
self._pip_caller.on_log_stdout = self._log_stdout
|
self._pip_caller.on_log_stdout = self._log_stdout
|
||||||
self._pip_caller.on_log_stderr = self._log_stderr
|
self._pip_caller.on_log_stderr = self._log_stderr
|
||||||
|
|
||||||
|
##~~ Body size hook
|
||||||
|
|
||||||
|
def increase_upload_bodysize(self, current_max_body_sizes, *args, **kwargs):
|
||||||
|
# set a maximum body size of 50 MB for plugin archive uploads
|
||||||
|
return [("POST", r"/upload_archive", 50 * 1024 * 1024)]
|
||||||
|
|
||||||
##~~ StartupPlugin
|
##~~ StartupPlugin
|
||||||
|
|
||||||
def on_startup(self, host, port):
|
def on_startup(self, host, port):
|
||||||
@@ -115,11 +121,17 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
|||||||
upload_path = flask.request.values[input_upload_path]
|
upload_path = flask.request.values[input_upload_path]
|
||||||
upload_name = flask.request.values[input_upload_name]
|
upload_name = flask.request.values[input_upload_name]
|
||||||
|
|
||||||
|
exts = filter(lambda x: upload_name.lower().endswith(x), (".zip", ".tar.gz", ".tgz", ".tar"))
|
||||||
|
if not len(exts):
|
||||||
|
return flask.make_response("File doesn't have a valid extension for a plugin archive", 400)
|
||||||
|
|
||||||
|
ext = exts[0]
|
||||||
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
|
|
||||||
archive = tempfile.NamedTemporaryFile(delete=False, suffix="-{upload_name}".format(**locals()))
|
archive = tempfile.NamedTemporaryFile(delete=False, suffix="{ext}".format(**locals()))
|
||||||
try:
|
try:
|
||||||
archive.close()
|
archive.close()
|
||||||
shutil.copy(upload_path, archive.name)
|
shutil.copy(upload_path, archive.name)
|
||||||
@@ -191,7 +203,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
|||||||
if url is not None:
|
if url is not None:
|
||||||
pip_args = ["install", sarge.shell_quote(url)]
|
pip_args = ["install", sarge.shell_quote(url)]
|
||||||
elif path is not None:
|
elif path is not None:
|
||||||
pip_args = ["install", path]
|
pip_args = ["install", sarge.shell_quote(path)]
|
||||||
else:
|
else:
|
||||||
raise ValueError("Either url or path must be provided")
|
raise ValueError("Either url or path must be provided")
|
||||||
|
|
||||||
@@ -510,22 +522,40 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
|||||||
|
|
||||||
if "compatibility" in entry:
|
if "compatibility" in entry:
|
||||||
if "octoprint" in entry["compatibility"] and entry["compatibility"]["octoprint"] is not None and len(entry["compatibility"]["octoprint"]):
|
if "octoprint" in entry["compatibility"] and entry["compatibility"]["octoprint"] is not None and len(entry["compatibility"]["octoprint"]):
|
||||||
import semantic_version
|
result["is_compatible"]["octoprint"] = self._is_octoprint_compatible(octoprint_version, entry["compatibility"]["octoprint"])
|
||||||
for octo_compat in entry["compatibility"]["octoprint"]:
|
|
||||||
s = semantic_version.Spec("=={}".format(octo_compat))
|
|
||||||
if semantic_version.Version(octoprint_version) in s:
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
result["is_compatible"]["octoprint"] = False
|
|
||||||
|
|
||||||
if "os" in entry["compatibility"] and entry["compatibility"]["os"] is not None and len(entry["compatibility"]["os"]):
|
if "os" in entry["compatibility"] and entry["compatibility"]["os"] is not None and len(entry["compatibility"]["os"]):
|
||||||
result["is_compatible"]["os"] = current_os in entry["compatibility"]["os"]
|
result["is_compatible"]["os"] = self._is_os_compatible(current_os, entry["compatibility"]["os"])
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
self._repository_plugins = map(map_repository_entry, repo_data)
|
self._repository_plugins = map(map_repository_entry, repo_data)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _is_octoprint_compatible(self, octoprint_version_string, compatibility_entries):
|
||||||
|
"""
|
||||||
|
Tests if the current ``octoprint_version`` is compatible to any of the provided ``compatibility_entries``.
|
||||||
|
"""
|
||||||
|
|
||||||
|
octoprint_version = pkg_resources.parse_version(octoprint_version_string)
|
||||||
|
for octo_compat in compatibility_entries:
|
||||||
|
if not any(octo_compat.startswith(c) for c in ("<", "<=", "!=", "==", ">=", ">", "~=", "===")):
|
||||||
|
octo_compat = ">={}".format(octo_compat)
|
||||||
|
|
||||||
|
s = next(pkg_resources.parse_requirements("OctoPrint" + octo_compat))
|
||||||
|
if octoprint_version in s:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _is_os_compatible(self, current_os, compatibility_entries):
|
||||||
|
"""
|
||||||
|
Tests if the ``current_os`` matches any of the provided ``compatibility_entries``.
|
||||||
|
"""
|
||||||
|
return current_os in compatibility_entries
|
||||||
|
|
||||||
def _get_os(self):
|
def _get_os(self):
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
return "windows"
|
return "windows"
|
||||||
@@ -562,4 +592,12 @@ __plugin_author__ = "Gina Häußge"
|
|||||||
__plugin_url__ = "https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager"
|
__plugin_url__ = "https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager"
|
||||||
__plugin_description__ = "Allows installing and managing OctoPrint plugins"
|
__plugin_description__ = "Allows installing and managing OctoPrint plugins"
|
||||||
__plugin_license__ = "AGPLv3"
|
__plugin_license__ = "AGPLv3"
|
||||||
__plugin_implementation__ = PluginManagerPlugin()
|
|
||||||
|
def __plugin_load__():
|
||||||
|
global __plugin_implementation__
|
||||||
|
__plugin_implementation__ = PluginManagerPlugin()
|
||||||
|
|
||||||
|
global __plugin_hooks__
|
||||||
|
__plugin_hooks__ = {
|
||||||
|
"octoprint.server.http.bodysize": __plugin_implementation__.increase_upload_bodysize
|
||||||
|
}
|
||||||
@@ -147,7 +147,11 @@ $(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.performRepositorySearch = function() {
|
self.performRepositorySearch = function(e) {
|
||||||
|
if (e !== undefined) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
var query = self.repositorySearchQuery();
|
var query = self.repositorySearchQuery();
|
||||||
if (query !== undefined && query.trim() != "") {
|
if (query !== undefined && query.trim() != "") {
|
||||||
self.repositoryplugins.changeSearchFunction(function(entry) {
|
self.repositoryplugins.changeSearchFunction(function(entry) {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<form class="form-search">
|
<form class="form-search" data-bind="submit: performRepositorySearch">
|
||||||
<input type="text" class="input-block search-query" data-bind="value: repositorySearchQuery, valueUpdate: 'input'" placeholder="{{ _('Search...') }}">
|
<input type="text" class="input-block search-query" data-bind="value: repositorySearchQuery, valueUpdate: 'input'" placeholder="{{ _('Search...') }}">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -467,6 +467,6 @@ class PrinterCallback(object):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class UnknownScript(BaseException):
|
class UnknownScript(Exception):
|
||||||
def __init__(self, name, *args, **kwargs):
|
def __init__(self, name, *args, **kwargs):
|
||||||
self.name = name
|
self.name = name
|
||||||
@@ -20,6 +20,7 @@ import os
|
|||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import atexit
|
import atexit
|
||||||
|
import signal
|
||||||
|
|
||||||
SUCCESS = {}
|
SUCCESS = {}
|
||||||
NO_CONTENT = ("", 204)
|
NO_CONTENT = ("", 204)
|
||||||
@@ -440,16 +441,27 @@ class Server():
|
|||||||
|
|
||||||
# prepare our shutdown function
|
# prepare our shutdown function
|
||||||
def on_shutdown():
|
def on_shutdown():
|
||||||
self._logger.info("Goodbye!")
|
# will be called on clean system exit and shutdown the watchdog observer and call the on_shutdown methods
|
||||||
|
# on all registered ShutdownPlugins
|
||||||
|
self._logger.info("Shutting down...")
|
||||||
observer.stop()
|
observer.stop()
|
||||||
observer.join()
|
observer.join()
|
||||||
octoprint.plugin.call_plugin(octoprint.plugin.ShutdownPlugin,
|
octoprint.plugin.call_plugin(octoprint.plugin.ShutdownPlugin,
|
||||||
"on_shutdown")
|
"on_shutdown")
|
||||||
|
self._logger.info("Goodbye!")
|
||||||
atexit.register(on_shutdown)
|
atexit.register(on_shutdown)
|
||||||
|
|
||||||
|
def sigterm_handler(*args, **kwargs):
|
||||||
|
# will stop tornado on SIGTERM, making the program exit cleanly
|
||||||
|
def shutdown_tornado():
|
||||||
|
ioloop.stop()
|
||||||
|
ioloop.add_callback_from_signal(shutdown_tornado)
|
||||||
|
signal.signal(signal.SIGTERM, sigterm_handler)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# this is the main loop - as long as tornado is running, OctoPrint is running
|
||||||
ioloop.start()
|
ioloop.start()
|
||||||
except KeyboardInterrupt:
|
except (KeyboardInterrupt, SystemExit):
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
self._logger.fatal("Now that is embarrassing... Something really really went wrong here. Please report this including the stacktrace below in OctoPrint's bugtracker. Thanks!")
|
self._logger.fatal("Now that is embarrassing... Something really really went wrong here. Please report this including the stacktrace below in OctoPrint's bugtracker. Thanks!")
|
||||||
|
|||||||
@@ -156,12 +156,10 @@ def performSystemAction():
|
|||||||
ignore = availableAction["ignore"] if "ignore" in availableAction else False
|
ignore = availableAction["ignore"] if "ignore" in availableAction else False
|
||||||
logger.info("Performing command: %s" % availableAction["command"])
|
logger.info("Performing command: %s" % availableAction["command"])
|
||||||
try:
|
try:
|
||||||
# Note: we put the command in brackets since sarge (up to the most recently released version) has
|
# we run this with shell=True since we have to trust whatever
|
||||||
# a bug concerning shell=True commands. Once sarge 0.1.4 we can upgrade to that and remove this
|
# our admin configured as command and since we want to allow
|
||||||
# workaround again
|
# shell-alike handling here...
|
||||||
#
|
p = sarge.run(availableAction["command"], stderr=sarge.Capture(), shell=True, async=async)
|
||||||
# See https://bitbucket.org/vinay.sajip/sarge/issue/21/behavior-is-not-like-popen-using-shell
|
|
||||||
p = sarge.run([availableAction["command"]], stderr=sarge.Capture(), shell=True, async=async)
|
|
||||||
if not async:
|
if not async:
|
||||||
if not ignore and p.returncode != 0:
|
if not ignore and p.returncode != 0:
|
||||||
returncode = p.returncode
|
returncode = p.returncode
|
||||||
|
|||||||
@@ -90,11 +90,17 @@ def getInstalledLanguagePacks():
|
|||||||
def uploadLanguagePack():
|
def uploadLanguagePack():
|
||||||
input_name = "file"
|
input_name = "file"
|
||||||
input_upload_path = input_name + "." + settings().get(["server", "uploads", "pathSuffix"])
|
input_upload_path = input_name + "." + settings().get(["server", "uploads", "pathSuffix"])
|
||||||
if not input_upload_path in request.values:
|
input_upload_name = input_name + "." + settings().get(["server", "uploads", "nameSuffix"])
|
||||||
|
if not input_upload_path in request.values or not input_upload_name in request.values:
|
||||||
return make_response("No file included", 400)
|
return make_response("No file included", 400)
|
||||||
|
|
||||||
|
upload_name = request.values[input_upload_name]
|
||||||
upload_path = request.values[input_upload_path]
|
upload_path = request.values[input_upload_path]
|
||||||
|
|
||||||
|
exts = filter(lambda x: upload_name.lower().endswith(x), (".zip", ".tar.gz", ".tgz", ".tar"))
|
||||||
|
if not len(exts):
|
||||||
|
return make_response("File doesn't have a valid extension for a plugin archive", 400)
|
||||||
|
|
||||||
target_path = settings().getBaseFolder("translations")
|
target_path = settings().getBaseFolder("translations")
|
||||||
|
|
||||||
if tarfile.is_tarfile(upload_path):
|
if tarfile.is_tarfile(upload_path):
|
||||||
@@ -143,5 +149,5 @@ def _validate_archive_name(name):
|
|||||||
raise InvalidLanguagePack("Provided language pack contains invalid name {name}".format(**locals()))
|
raise InvalidLanguagePack("Provided language pack contains invalid name {name}".format(**locals()))
|
||||||
|
|
||||||
|
|
||||||
class InvalidLanguagePack(BaseException):
|
class InvalidLanguagePack(Exception):
|
||||||
pass
|
pass
|
||||||
@@ -57,7 +57,7 @@ def slicingListSlicerProfiles(slicer):
|
|||||||
@api.route("/slicing/<string:slicer>/profiles/<string:name>", methods=["GET"])
|
@api.route("/slicing/<string:slicer>/profiles/<string:name>", methods=["GET"])
|
||||||
def slicingGetSlicerProfile(slicer, name):
|
def slicingGetSlicerProfile(slicer, name):
|
||||||
try:
|
try:
|
||||||
profile = slicingManager.load_profile(slicer, name)
|
profile = slicingManager.load_profile(slicer, name, require_configured=False)
|
||||||
except UnknownSlicer:
|
except UnknownSlicer:
|
||||||
return make_response("Unknown slicer {slicer}".format(**locals()), 404)
|
return make_response("Unknown slicer {slicer}".format(**locals()), 404)
|
||||||
except UnknownProfile:
|
except UnknownProfile:
|
||||||
@@ -106,7 +106,7 @@ def slicingPatchSlicerProfile(slicer, name):
|
|||||||
return make_response("Expected content-type JSON", 400)
|
return make_response("Expected content-type JSON", 400)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
profile = slicingManager.load_profile(slicer, name)
|
profile = slicingManager.load_profile(slicer, name, require_configured=False)
|
||||||
except UnknownSlicer:
|
except UnknownSlicer:
|
||||||
return make_response("Unknown slicer {slicer}".format(**locals()), 404)
|
return make_response("Unknown slicer {slicer}".format(**locals()), 404)
|
||||||
except UnknownProfile:
|
except UnknownProfile:
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agp
|
|||||||
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||||
|
|
||||||
|
|
||||||
class SlicingException(BaseException):
|
class SlicingException(Exception):
|
||||||
"""
|
"""
|
||||||
Base exception of all slicing related exceptions.
|
Base exception of all slicing related exceptions.
|
||||||
"""
|
"""
|
||||||
@@ -73,7 +73,7 @@ class UnknownSlicer(SlicerException):
|
|||||||
SlicerException.__init__(self, slicer, *args, **kwargs)
|
SlicerException.__init__(self, slicer, *args, **kwargs)
|
||||||
self.message = "No such slicer: {slicer}".format(slicer=slicer)
|
self.message = "No such slicer: {slicer}".format(slicer=slicer)
|
||||||
|
|
||||||
class ProfileException(BaseException):
|
class ProfileException(Exception):
|
||||||
"""
|
"""
|
||||||
Base exception of all slicing profile related exceptions.
|
Base exception of all slicing profile related exceptions.
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ class ProfileException(BaseException):
|
|||||||
Identifier of the profile for which the exception was raised.
|
Identifier of the profile for which the exception was raised.
|
||||||
"""
|
"""
|
||||||
def __init__(self, slicer, profile, *args, **kwargs):
|
def __init__(self, slicer, profile, *args, **kwargs):
|
||||||
BaseException.__init__(self, *args, **kwargs)
|
Exception.__init__(self, *args, **kwargs)
|
||||||
self.slicer = slicer
|
self.slicer = slicer
|
||||||
self.profile = profile
|
self.profile = profile
|
||||||
|
|
||||||
|
|||||||
@@ -308,7 +308,11 @@ $(function() {
|
|||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.performSearch = function() {
|
self.performSearch = function(e) {
|
||||||
|
if (e !== undefined) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
var query = self.searchQuery();
|
var query = self.searchQuery();
|
||||||
if (query !== undefined && query.trim() != "") {
|
if (query !== undefined && query.trim() != "") {
|
||||||
self.listHelper.changeSearchFunction(function(entry) {
|
self.listHelper.changeSearchFunction(function(entry) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<form class="form-search">
|
<form class="form-search" data-bind="submit: performSearch">
|
||||||
<input type="text" class="input-block search-query" data-bind="value: searchQuery, valueUpdate: 'input'" placeholder="{{ _('Search...') }}">
|
<input type="text" class="input-block search-query" data-bind="value: searchQuery, valueUpdate: 'input'" placeholder="{{ _('Search...') }}">
|
||||||
</form>
|
</form>
|
||||||
<div class="gcode_files" data-bind="slimScrolledForeach: listHelper.paginatedItems">
|
<div class="gcode_files" data-bind="slimScrolledForeach: listHelper.paginatedItems">
|
||||||
|
|||||||
@@ -1298,10 +1298,14 @@ class MachineCom(object):
|
|||||||
if self._regex_minMaxError.match(line):
|
if self._regex_minMaxError.match(line):
|
||||||
line = line.rstrip() + self._readline()
|
line = line.rstrip() + self._readline()
|
||||||
|
|
||||||
#Skip the communication errors, as those get corrected.
|
|
||||||
if 'line number' in line.lower() or 'checksum' in line.lower() or 'expected line' in line.lower():
|
if 'line number' in line.lower() or 'checksum' in line.lower() or 'expected line' in line.lower():
|
||||||
|
#Skip the communication errors, as those get corrected.
|
||||||
self._lastCommError = line[6:] if line.startswith("Error:") else line[2:]
|
self._lastCommError = line[6:] if line.startswith("Error:") else line[2:]
|
||||||
pass
|
pass
|
||||||
|
elif 'volume.init' in line.lower() or "openroot" in line.lower() or 'workdir' in line.lower()\
|
||||||
|
or "error writing to file" in line.lower():
|
||||||
|
#Also skip errors with the SD card
|
||||||
|
pass
|
||||||
elif not self.isError():
|
elif not self.isError():
|
||||||
self._errorValue = line[6:] if line.startswith("Error:") else line[2:]
|
self._errorValue = line[6:] if line.startswith("Error:") else line[2:]
|
||||||
self._changeState(self.STATE_ERROR)
|
self._changeState(self.STATE_ERROR)
|
||||||
@@ -1982,9 +1986,9 @@ class TypedQueue(queue.Queue):
|
|||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
class TypeAlreadyInQueue(BaseException):
|
class TypeAlreadyInQueue(Exception):
|
||||||
def __init__(self, t, *args, **kwargs):
|
def __init__(self, t, *args, **kwargs):
|
||||||
BaseException.__init__(self, *args, **kwargs)
|
Exception.__init__(self, *args, **kwargs)
|
||||||
self.type = t
|
self.type = t
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,11 +65,10 @@ class PipCaller(object):
|
|||||||
command = [self._command] + list(args)
|
command = [self._command] + list(args)
|
||||||
|
|
||||||
joined_command = " ".join(command)
|
joined_command = " ".join(command)
|
||||||
|
|
||||||
self._logger.debug(u"Calling: {}".format(joined_command))
|
self._logger.debug(u"Calling: {}".format(joined_command))
|
||||||
self.on_log_call(joined_command)
|
self.on_log_call(joined_command)
|
||||||
|
|
||||||
p = sarge.run(joined_command, shell=True, async=True, stdout=sarge.Capture(), stderr=sarge.Capture())
|
p = sarge.run(command, async=True, stdout=sarge.Capture(), stderr=sarge.Capture())
|
||||||
p.wait_events()
|
p.wait_events()
|
||||||
|
|
||||||
all_stdout = []
|
all_stdout = []
|
||||||
@@ -140,8 +139,7 @@ class PipCaller(object):
|
|||||||
|
|
||||||
if pip_command is not None:
|
if pip_command is not None:
|
||||||
self._logger.debug("Found pip at {}, going to figure out its version".format(pip_command))
|
self._logger.debug("Found pip at {}, going to figure out its version".format(pip_command))
|
||||||
command = [pip_command, "--version"]
|
p = sarge.run([pip_command, "--version"], stdout=sarge.Capture(), stderr=sarge.Capture())
|
||||||
p = sarge.run(" ".join(command), shell=True, stdout=sarge.Capture(), stderr=sarge.Capture())
|
|
||||||
|
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
self._logger.warn("Error while trying to run pip --version: {}".format(p.stderr.text))
|
self._logger.warn("Error while trying to run pip --version: {}".format(p.stderr.text))
|
||||||
|
|||||||
Reference in new issue
Block a user