Skip to content

Commit

Permalink
In lxc detect boot from /proc/1 stats (canonical#2270)
Browse files Browse the repository at this point in the history
* In lxc detect boot from /proc/1 stats

* Fix style checks
  • Loading branch information
ktsakalozos authored May 18, 2021
1 parent 506c16c commit b6acffb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 3 additions & 1 deletion microk8s-resources/actions/common/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,16 @@ 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
return 1
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
Expand Down
1 change: 0 additions & 1 deletion scripts/cluster/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import subprocess
import sys
import time
from typing import List

import yaml

Expand Down
2 changes: 1 addition & 1 deletion tests/test-addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,6 @@ def test_openebs(self):
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
1 change: 0 additions & 1 deletion tests/validators.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import time
import os
import shutil
import re
import requests
import platform
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ envdir = {toxinidir}/.tox_env
passenv =
MK8S_*
deps =
black
black ==21.4b2
flake8
flake8-colors
pep8-naming
Expand All @@ -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]
Expand Down

0 comments on commit b6acffb

Please sign in to comment.