From 1d48d494536968be655ad7144333b79f406a5602 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?=
Date: Fri, 12 Jun 2020 11:52:20 +0200
Subject: [PATCH 01/85] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F?=
=?UTF-8?q?=20Use=20build=20matrix=20for=20test=20installs?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/test_install.yml | 79 ++++++++++++++++++++++++++
.github/workflows/test_install_py2.yml | 61 --------------------
2 files changed, 79 insertions(+), 61 deletions(-)
create mode 100644 .github/workflows/test_install.yml
delete mode 100644 .github/workflows/test_install_py2.yml
diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml
new file mode 100644
index 000000000..16a23037c
--- /dev/null
+++ b/.github/workflows/test_install.yml
@@ -0,0 +1,79 @@
+name: Test install of branches and latest release
+
+on:
+ push:
+ branches:
+ - master
+ repository_dispatch:
+ types: [test_install]
+ schedule:
+ - cron: '0 */12 * * *'
+
+jobs:
+ install-branch:
+ name: Install branch
+ strategy:
+ matrix:
+ os: ["ubuntu-latest"]
+ python: ["2.7", "3.7", "3.8"]
+ branch: ["master"]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: 🐍 Set up Python ${{ matrix.python }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python }}
+ - name: ⬇ Checkout code
+ uses: actions/checkout@v2
+ with:
+ ref: ${{ matrix.branch }}
+ - name: 👷 Build and install checkout
+ run: |
+ pip install .
+ - name: 📧 Discord success notification
+ env:
+ DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
+ uses: Ilshidur/action-discord@master
+ with:
+ args: '☑️ Test install on Python {{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` was successful'
+ - name: 📧 Discord failure notification
+ if: failure()
+ env:
+ DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
+ uses: Ilshidur/action-discord@master
+ with:
+ args: '🚫 Test install on Python {{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` failed'
+
+ install-latest:
+ name: Install latest release
+ strategy:
+ matrix:
+ os: ["ubuntu-latest"]
+ python: ["2.7", "3.7", "3.8"]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: 👀 Determine latest release
+ id: latest
+ uses: foosel/github-action-get-latest-release@master
+ with:
+ repository: "OctoPrint/OctoPrint"
+ - name: 🐍 Set up Python ${{ matrix.python }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python }}
+ - name: 👷 Build and install latest release
+ run: |
+ pip install https://github.com/OctoPrint/OctoPrint/archive/${{ steps.latest.outputs.release }}.zip
+ - name: 📧 Discord success notification
+ env:
+ DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
+ uses: Ilshidur/action-discord@master
+ with:
+ args: '☑️ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ steps.latest.outputs.release }}` was successful'
+ - name: 📧 Discord failure notification
+ if: failure()
+ env:
+ DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
+ uses: Ilshidur/action-discord@master
+ with:
+ args: '🚫 Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ steps.latest.outputs.release }}` failed'
diff --git a/.github/workflows/test_install_py2.yml b/.github/workflows/test_install_py2.yml
deleted file mode 100644
index d6b2290db..000000000
--- a/.github/workflows/test_install_py2.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-name: Test install on Python 2
-
-on:
- push:
- branches:
- - master
- repository_dispatch:
- types: [test_install_py2]
- schedule:
- - cron: '0 */12 * * *'
-
-jobs:
- install-master:
- runs-on: ubuntu-latest
- steps:
- - name: 🐍 Set up Python 2.7
- uses: actions/setup-python@v2
- with:
- python-version: 2.7
- - name: ⬇ Checkout code
- uses: actions/checkout@v2
- - name: 👷 Build and install checkout
- run: |
- pip install .
- - name: 📧 Discord success notification
- env:
- DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
- uses: Ilshidur/action-discord@master
- with:
- args: '☑️ Test install on Python 2 for `OctoPrint/OctoPrint:master` was successful'
- - name: 📧 Discord failure notification
- if: failure()
- env:
- DISCORD_WEBHOOK: ${{ secrets.discord_webhook_foosel }}
- uses: Ilshidur/action-discord@master
- with:
- args: '🚫 Test install on Python 2 for `OctoPrint/OctoPrint:master` failed'
-
- install-latest:
- runs-on: ubuntu-latest
- steps:
- - name: 🐍 Set up Python 2.7
- uses: actions/setup-python@v2
- with:
- python-version: 2.7
- - name: 👷 Build and install latest from PyPI
- run: |
- pip install OctoPrint
- - name: 📧 Discord success notification
- env:
- DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
- uses: Ilshidur/action-discord@master
- with:
- args: '☑️ Test install on Python 2 for latest OctoPrint release was successful'
- - name: 📧 Discord failure notification
- if: failure()
- env:
- DISCORD_WEBHOOK: ${{ secrets.discord_webhook_foosel }}
- uses: Ilshidur/action-discord@master
- with:
- args: '🚫 Test install on Python 2 for latest OctoPrint release failed'
From 143cffd0603c5c01644e800d09d5c867da31d108 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?=
Date: Fri, 12 Jun 2020 12:10:35 +0200
Subject: [PATCH 02/85] =?UTF-8?q?=F0=9F=92=9A=20Fix=20discord=20CI=20messa?=
=?UTF-8?q?ge=20format?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/test_install.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml
index 16a23037c..68cf094b3 100644
--- a/.github/workflows/test_install.yml
+++ b/.github/workflows/test_install.yml
@@ -35,14 +35,14 @@ jobs:
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
uses: Ilshidur/action-discord@master
with:
- args: '☑️ Test install on Python {{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` was successful'
+ args: '☑️ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` was successful'
- name: 📧 Discord failure notification
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
uses: Ilshidur/action-discord@master
with:
- args: '🚫 Test install on Python {{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` failed'
+ args: '🚫 Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` failed'
install-latest:
name: Install latest release
From 44154816045525417546f84b2a60763c4425a671 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?=
Date: Wed, 17 Jun 2020 13:44:20 +0200
Subject: [PATCH 03/85] Add notice about where to find old wiki content
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index b040e5cbb..018efe60f 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ and released under the [GNU Affero General Public License V3](http://www.gnu.org
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
-The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme).
+The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme) (also contains the old wiki content).
An invite to the Discord server can be found at [discord.octoprint.org](https://discord.octoprint.org).
From 45552000277661282fdd81497262fa2b269319b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?=
Date: Wed, 17 Jun 2020 13:59:43 +0200
Subject: [PATCH 04/85] =?UTF-8?q?=E2=9C=8F=20Change=20wording?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 018efe60f..7404a5779 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ and released under the [GNU Affero General Public License V3](http://www.gnu.org
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
-The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme) (also contains the old wiki content).
+The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme). It also serves as central knowledge base.
An invite to the Discord server can be found at [discord.octoprint.org](https://discord.octoprint.org).
From 7290a6d35063ff9bbc08e6427be087e2bdae6c87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?=
Date: Wed, 17 Jun 2020 16:47:25 +0200
Subject: [PATCH 05/85] =?UTF-8?q?=E2=99=BB=20Refactor=20buffered=20readlin?=
=?UTF-8?q?e=20&=20add=20null=20byte=20logging?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As suggested in #2454
---
src/octoprint/util/comm.py | 43 ++++++++++++++++----------------------
1 file changed, 18 insertions(+), 25 deletions(-)
diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py
index f3c3aab95..673affa72 100644
--- a/src/octoprint/util/comm.py
+++ b/src/octoprint/util/comm.py
@@ -691,9 +691,9 @@ class MachineCom(object):
self._logger.info(text)
self._callback.on_comm_state_change(newState)
- def _dual_log(self, message, level=logging.ERROR):
+ def _dual_log(self, message, level=logging.ERROR, prefix=""):
self._logger.log(level, message)
- self._log(message)
+ self._log(prefix + message)
def _log(self, message):
message = to_unicode(message)
@@ -2895,6 +2895,8 @@ class MachineCom(object):
self.close(is_error=True)
return None
+ null_pos = ret.find(b'\x00')
+
try:
ret = ret.decode('utf-8')
except UnicodeDecodeError:
@@ -2907,6 +2909,14 @@ class MachineCom(object):
self._log("WARN: While reading last line: {}".format(e))
self._log("Recv: {!r}".format(ret))
+ if null_pos >= 0:
+ self._logger.warning("Received line:")
+ self._logger.warning("| {}".format(ret.replace('\0', '\\x00').rstrip()))
+ self._dual_log("The received line contains at least one null byte character at position {}, "
+ "this hints at some data corruption going on".format(null_pos),
+ level=logging.WARNING,
+ prefix="WARN")
+
for name, hook in self._received_message_hooks.items():
try:
ret = hook(self, ret)
@@ -5009,36 +5019,19 @@ class BufferedReadlineWrapper(wrapt.ObjectProxy):
def readline(self, terminator=serial.LF):
termlen = len(terminator)
- data = self._buffered
timeout = serial.Timeout(self._timeout)
- while True:
- # make sure we always read everything that is waiting
- data += bytearray(self.read(self.in_waiting))
+ while not timeout.expired():
+ self._buffered += self.read(self.in_waiting)
# check for terminator, if it's there we have found our line
- termpos = data.find(terminator)
+ termpos = self._buffered.find(terminator)
if termpos >= 0:
- # line: everything up to and incl. the terminator
- line = data[:termpos + termlen]
- # buffered: everything after the terminator
- self._buffered = data[termpos + termlen:]
+ # line: everything up to and incl. the terminator, buffered: rest
+ line = self._buffered[:termpos + termlen]
+ del self._buffered[:termpos + termlen]
return bytes(line)
- # check if timeout expired
- if timeout.expired():
- break
-
- # if we arrive here we so far couldn't read a full line, wait for more data
- c = self.read(1)
- if not c:
- # EOF
- break
-
- # add to data and loop
- data += bytearray(c)
-
- self._buffered = data
return b""
From 6625f81b6e6e0fcbd7bd7571898856e5f94d97b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?=
Date: Thu, 18 Jun 2020 10:50:20 +0200
Subject: [PATCH 06/85] =?UTF-8?q?=E2=9C=8F=20Remove=20references=20to=20wi?=
=?UTF-8?q?ki=20&=20update=20generic=20setup?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 7404a5779..f82bd38fb 100644
--- a/README.md
+++ b/README.md
@@ -30,17 +30,17 @@ If you enjoy OctoPrint, please consider becoming a regular supporter!**
You are currently looking at the source code repository of OctoPrint. If you already installed it
(e.g. by using the Raspberry Pi targeted distribution [OctoPi](https://github.com/guysoft/OctoPi)) and only
-want to find out how to use it, [the documentation](http://docs.octoprint.org/) and [the public wiki](https://github.com/OctoPrint/OctoPrint/wiki)
-might be of more interest for you. You might also want to subscribe to join
+want to find out how to use it, [the documentation](http://docs.octoprint.org/) might be of more interest for you. You might also want to subscribe to join
[the community forum at community.octoprint.org](https://community.octoprint.org) where there are other active users who might be
able to help you with any questions you might have.
## Contributing
Contributions of all kinds are welcome, not only in the form of code but also with regards to the
-[official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/OctoPrint/OctoPrint/wiki), debugging help
+[official documentation](http://docs.octoprint.org/), debugging help
in the [bug tracker](https://github.com/OctoPrint/OctoPrint/issues), support of other users on
-[the community forum at community.octoprint.org](https://community.octoprint.org)
+[the community forum at community.octoprint.org](https://community.octoprint.org) or
+[the official discord at discord.octoprint.org](https://discord.octoprint.org)
and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
If you think something is bad about OctoPrint or its documentation the way it is, please help
@@ -53,7 +53,7 @@ For information about how to go about submitting bug reports or pull requests, p
## Installation
Installation instructions for installing from source for different operating
-systems can be found [on the wiki](https://github.com/OctoPrint/OctoPrint/wiki#assorted-guides).
+systems can be found [on the forum](https://community.octoprint.org/tags/c/support/guides/15/setup).
If you want to run OctoPrint on a Raspberry Pi, you might want to take a look at [OctoPi](https://github.com/guysoft/OctoPi)
which is a custom SD card image that includes OctoPrint plus dependencies.
@@ -61,9 +61,11 @@ which is a custom SD card image that includes OctoPrint plus dependencies.
The generic steps that should basically be done regardless of operating system
and runtime environment are the following (as *regular
user*, please keep your hands *off* of the `sudo` command here!) - this assumes
-you already have Python 2.7, 3.6 or 3.7, pip and virtualenv set up on your system:
+you already have Python 2.7, 3.6 or 3.7, pip and virtualenv and their dependencies set up on your system:
-1. Create a user-owned virtual environment therein: `virtualenv venv`.
+1. Create a user-owned virtual environment therein: `virtualenv venv`. If you want to specify a specific python
+ to use instead of whatever version your system defaults to, you can also explicitly require that via the `--python`
+ parameter, e.g. `virtualenv --python=python3 venv`.
2. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install OctoPrint`
Or alternatively, for an install from source:
From a6fc4b6c7f10b13eb78ab3715182f1b13729aff7 Mon Sep 17 00:00:00 2001
From: cp2004 <31997505+cp2004@users.noreply.github.com>
Date: Thu, 18 Jun 2020 10:16:22 +0100
Subject: [PATCH 07/85] Display entire path to backup on CLI command
---
src/octoprint/plugins/backup/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/octoprint/plugins/backup/__init__.py b/src/octoprint/plugins/backup/__init__.py
index cb30f048c..fdd4bce30 100644
--- a/src/octoprint/plugins/backup/__init__.py
+++ b/src/octoprint/plugins/backup/__init__.py
@@ -378,7 +378,7 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
if not os.path.isdir(datafolder):
os.makedirs(datafolder)
- click.echo("Creating backup at {}, please wait...".format(backup_file))
+ click.echo("Creating backup at {}{}, please wait...".format(datafolder, backup_file))
self._create_backup(backup_file,
exclude=exclude,
settings=settings,
From 462f2e602b641f29349172f7f5c0ddc28cba3c9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?=
Date: Thu, 18 Jun 2020 13:50:32 +0200
Subject: [PATCH 08/85] =?UTF-8?q?=E2=98=82=20SWU:=20Minimum=20free=20stora?=
=?UTF-8?q?ge=20requirement?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We now need to have at least 150MB (configurable) of free disk space on
all of site-packages, plugins and temp folder locations available in
order to enable updates.
Closes #2312
---
.../plugins/softwareupdate/__init__.py | 100 ++++++++++++++++--
.../static/js/softwareupdate.js | 18 +++-
.../templates/softwareupdate_settings.jinja2 | 29 ++++-
3 files changed, 136 insertions(+), 11 deletions(-)
diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py
index eab67039c..debb9bd0d 100644
--- a/src/octoprint/plugins/softwareupdate/__init__.py
+++ b/src/octoprint/plugins/softwareupdate/__init__.py
@@ -29,7 +29,7 @@ from octoprint.server.util.flask import no_firstrun_access, with_revalidation_ch
from octoprint.server import VERSION, REVISION, BRANCH
from octoprint.access import USER_GROUP, ADMIN_GROUP
from octoprint.access.permissions import Permissions
-from octoprint.util import dict_merge, to_unicode
+from octoprint.util import dict_merge, to_unicode, get_formatted_size
from octoprint.util.version import get_comparable_version, get_python_version_string
from octoprint.util.pip import LocalPipCaller
import octoprint.settings
@@ -79,6 +79,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
self._environment_versions = dict()
self._environment_ready = threading.Event()
+ self._storage_sufficient = True
+ self.storage_info = dict()
+
self._console_logger = None
self._get_throttled = lambda: False
@@ -133,6 +136,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
def on_after_startup(self):
self._check_environment()
+ self._check_storage()
self.get_current_versions()
def _get_configured_checks(self):
@@ -220,6 +224,45 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
self._environment_versions = versions
self._environment_ready.set()
+ def _check_storage(self):
+ import distutils.sysconfig
+ import tempfile
+ import psutil
+
+ storage_info = dict()
+ paths = dict(python=distutils.sysconfig.get_python_lib(),
+ plugins=self._settings.global_get_basefolder("plugins"),
+ temp=tempfile.gettempdir())
+
+ for key, path in paths.items():
+ info = dict(path=path,
+ free=None)
+
+ try:
+ data = psutil.disk_usage(path)
+ info["free"] = data.free
+ except:
+ self._logger.exception("Error while determining disk usage of {}".format(path))
+ continue
+
+ storage_info[key] = info
+
+ if len(storage_info):
+ free_storage = min(*list(map(lambda x: x["free"], storage_info.values())))
+ else:
+ free_storage = None
+
+ self._storage_sufficient = free_storage is None or free_storage >= self._settings.get_int(["minimum_free_storage"]) * 1024 * 1024
+ self._storage_info = storage_info
+
+ self._logger.info("Minimum free storage across all update relevant locations is {}. "
+ "That is considered {} for updating.".format(get_formatted_size(free_storage)
+ if free_storage is not None
+ else "unknown",
+ "sufficient"
+ if self._storage_sufficient
+ else "insufficient"))
+
def _load_version_cache(self):
if not os.path.isfile(self._version_cache_path):
return
@@ -303,7 +346,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
"notify_users": True,
- "ignore_throttled": False
+ "ignore_throttled": False,
+
+ "minimum_free_storage": 150
}
def on_settings_load(self):
@@ -352,7 +397,8 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
def on_settings_save(self, data):
for key in self.get_settings_defaults():
- if key in ("checks", "cache_ttl", "notify_user", "octoprint_checkout_folder", "octoprint_type", "octoprint_release_channel"):
+ if key in ("checks", "cache_ttl", "notify_user", "minimum_free_storage",
+ "octoprint_checkout_folder", "octoprint_type", "octoprint_release_channel"):
continue
if key in data:
self._settings.set([key], data[key])
@@ -364,6 +410,10 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
if "notify_users" in data:
self._settings.set_boolean(["notify_users"], data["notify_users"])
+ if "minimum_free_storage" in data:
+ self._settings.set_int(["minimum_free_storage"], data["minimum_free_storage"])
+ self._check_storage()
+
defaults = dict(
plugins=dict(softwareupdate=dict(
checks=dict(
@@ -583,13 +633,42 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
try:
information, update_available, update_possible = self.get_current_versions(check_targets=check_targets, force=force)
- return flask.jsonify(dict(status="inProgress" if self._update_in_progress else "updatePossible" if update_available and update_possible and self._environment_supported else "updateAvailable" if update_available else "current",
+
+ storage = list()
+ for key, name in (("python", gettext("Python package installation folder")),
+ ("plugins", gettext("Plugin folder")),
+ ("temp", gettext("System temporary files"))):
+ data = self._storage_info.get(key)
+ if not data:
+ continue
+
+ s = dict(name=name)
+ s.update(**data)
+ storage.append(s)
+
+ status = "current"
+ if self._update_in_progress:
+ status = "inProgress"
+ elif update_available and update_possible and self._environment_supported and self._storage_sufficient:
+ status = "updatePossible"
+ elif update_available:
+ status = "updateAvailable"
+
+ return flask.jsonify(dict(status=status,
information=information,
timestamp=self._version_cache_timestamp,
environment=dict(supported=self._environment_supported,
- versions=[dict(name=gettext("Python"), current=self._environment_versions.get("python", "unknown"), minimum=MINIMUM_PYTHON),
- dict(name=gettext("pip"), current=self._environment_versions.get("pip", "unknown"), minimum=MINIMUM_PIP),
- dict(name=gettext("setuptools"), current=self._environment_versions.get("setuptools", "unknown"), minimum=MINIMUM_SETUPTOOLS)])))
+ versions=[dict(name=gettext("Python"),
+ current=self._environment_versions.get("python", "unknown"),
+ minimum=MINIMUM_PYTHON),
+ dict(name=gettext("pip"),
+ current=self._environment_versions.get("pip", "unknown"),
+ minimum=MINIMUM_PIP),
+ dict(name=gettext("setuptools"),
+ current=self._environment_versions.get("setuptools", "unknown"),
+ minimum=MINIMUM_SETUPTOOLS)]),
+ storage=dict(sufficient=self._storage_sufficient,
+ free=storage)))
except exceptions.ConfigurationInvalid as e:
return flask.make_response("Update not properly configured, can't proceed: %s" % e.message, 500)
@@ -651,6 +730,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
if not self._environment_supported:
return flask.make_response("Direct updates are not supported in this Python environment", 409)
+ if not self._storage_sufficient:
+ return flask.make_response("Not enough free disk space for updating", 409)
+
if not "application/json" in flask.request.headers["Content-Type"]:
return flask.make_response("Expected content-type JSON", 400)
@@ -914,6 +996,10 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
self._logger.error("Direct updates are unsupported in this environment")
return [], dict()
+ if not self._storage_sufficient:
+ self._logger.error("Not enough free disk space for updating")
+ return [], dict()
+
targets = kwargs.get("targets", kwargs.get("check_targets", None))
checks = self._get_configured_checks()
diff --git a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js
index d9057556d..da81c859f 100644
--- a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js
+++ b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js
@@ -41,6 +41,9 @@ $(function() {
self.environmentSupported = ko.observable(true);
self.environmentVersions = ko.observableArray([]);
+ self.storageSufficient = ko.observable(true);
+ self.storageFree = ko.observableArray([]);
+
self.cacheTimestamp = ko.observable();
self.cacheTimestampText = ko.pureComputed(function() {
return formatDate(self.cacheTimestamp());
@@ -54,6 +57,7 @@ $(function() {
self.config_checkType = ko.observable();
self.config_releaseChannel = ko.observable();
self.config_pipEnableCheck = ko.observable();
+ self.config_minimumFreeStorage = ko.observable();
self.error_checkoutFolder = ko.pureComputed(function() {
return self.config_checkType() === "git_commit"
@@ -61,7 +65,7 @@ $(function() {
});
self.enableUpdate = ko.pureComputed(function() {
- return !self.updateInProgress && self.environmentSupported() && !self.printerState.isPrinting() && !self.throttled();
+ return !self.updateInProgress && self.environmentSupported() && self.storageSufficient() && !self.printerState.isPrinting() && !self.throttled();
});
self.enable_configSave = ko.pureComputed(function() {
@@ -166,7 +170,8 @@ $(function() {
octoprint_checkout_folder: self.config_checkoutFolder(),
octoprint_tracked_branch: self.config_trackedBranch(),
octoprint_pip_target: self.config_pipTarget(),
- pip_enable_check: self.config_pipEnableCheck()
+ pip_enable_check: self.config_pipEnableCheck(),
+ minimum_free_storage: self.config_minimumFreeStorage()
}
}
};
@@ -205,6 +210,8 @@ $(function() {
self.config_pipTarget(self.settings.settings.plugins.softwareupdate.octoprint_pip_target());
self.config_pipEnableCheck(self.settings.settings.plugins.softwareupdate.pip_enable_check());
+
+ self.config_minimumFreeStorage(self.settings.settings.plugins.softwareupdate.minimum_free_storage());
};
self._copyConfigBack = function() {
@@ -248,6 +255,9 @@ $(function() {
self.environmentSupported(data.environment.supported);
self.environmentVersions(data.environment.versions);
+ self.storageSufficient(data.storage.sufficient);
+ self.storageFree(data.storage.free);
+
if (data.status === "inProgress") {
self._markWorking(gettext("Updating..."), gettext("Updating, please wait."));
return;
@@ -262,7 +272,7 @@ $(function() {
_.each(self.versions.items(), function(update_info) {
if (update_info.updateAvailable) {
text += "
";
@@ -272,6 +282,8 @@ $(function() {
if (!self.environmentSupported()) {
text += "
" + gettext("This version of the Python environment is not supported for direct updates.") + "
";
+ } else if (!self.storageSufficient()) {
+ text += "
" + gettext("There's currently not enough free disk space available for a direct update.") + "
";
} else {
text += "
" + gettext("Those components marked with can be updated directly.") + "
";
}
diff --git a/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2 b/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2
index f743f749e..63996cb8f 100644
--- a/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2
+++ b/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2
@@ -32,6 +32,23 @@
Please take a look at this FAQ entry on how to proceed.
{% endtrans %}
+
{% trans min_free_storage='' %}
+
+ There is not enough free disk space available to run an update.
+
+
+ To reduce the likelihood of running into update problems due to insuffient disk space, OctoPrint requires
+ a minimum of {{ min_free_storage }} free disk space in various locations:
+
OctoPrint is running on a throttled system, updates are disabled.
@@ -110,7 +127,7 @@
-
+
min
@@ -123,6 +140,16 @@
+
+
+
+
+
+ MB
+ {{ _('The minimum amount of free disk space that has to be available on various locations for OctoPrint to allow updates. Should not be set to 0.') }}
+