diff --git a/microk8s-resources/actions/common/utils.sh b/microk8s-resources/actions/common/utils.sh index 986cba8e..9cf7b79e 100644 --- a/microk8s-resources/actions/common/utils.sh +++ b/microk8s-resources/actions/common/utils.sh @@ -674,6 +674,7 @@ is_first_boot() { # The last-start-date file contains a date in seconds # if that date is prior to the creation date of /proc/1 we assume this is the first # time after the host booted + # Note, lxc shares the same /proc/stat as the host if ! [ -e "$1/last-start-date" ] || ! [ -e /proc/1 ] then @@ -681,7 +682,8 @@ is_first_boot() { else last_start=$("$SNAP/bin/cat" "$1/last-start-date") if [ -e /proc/stat ] && - grep btime /proc/stat + grep btime /proc/stat && + ! grep lxc /proc/1/environ then boot_time=$(grep btime /proc/stat | cut -d' ' -f2) else diff --git a/scripts/cluster/agent.py b/scripts/cluster/agent.py index 9708d940..43808c10 100644 --- a/scripts/cluster/agent.py +++ b/scripts/cluster/agent.py @@ -9,7 +9,6 @@ import string import subprocess import sys import time -from typing import List import yaml diff --git a/tests/test-addons.py b/tests/test-addons.py index 0605b824..7e259d07 100644 --- a/tests/test-addons.py +++ b/tests/test-addons.py @@ -429,6 +429,6 @@ class TestAddons(object): validate_openebs() print("Disabling OpenEBS") microk8s_disable("openebs:force") - except CalledProcessError as err: + except CalledProcessError: print("Nothing to do, since iscsid is not available") return diff --git a/tests/validators.py b/tests/validators.py index d1ea3ed8..e87d4f16 100644 --- a/tests/validators.py +++ b/tests/validators.py @@ -1,6 +1,5 @@ import time import os -import shutil import re import requests import platform diff --git a/tox.ini b/tox.ini index 78edcf23..efde3759 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ envdir = {toxinidir}/.tox_env passenv = MK8S_* deps = - black + black ==21.4b2 flake8 flake8-colors pep8-naming @@ -19,7 +19,7 @@ deps = [testenv:lint] commands = -flake8 - codespell --ignore-words-list="aks" --quiet-level=2 --skip="*.patch,*.spec,.tox_env" + codespell --ignore-words-list="aks" --quiet-level=2 --skip="*.patch,*.spec,.tox_env,.git" black --diff --check --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" . [testenv:func]