mirror of
https://github.com/ubuntu/microk8s.git
synced 2021-05-23 02:23:41 +03:00
In lxc detect boot from /proc/1 stats (#2270)
* In lxc detect boot from /proc/1 stats * Fix style checks
This commit is contained in:
committed by
GitHub
parent
506c16cb3e
commit
b6acffb66f
@@ -674,6 +674,7 @@ is_first_boot() {
|
|||||||
# The last-start-date file contains a date in seconds
|
# 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
|
# if that date is prior to the creation date of /proc/1 we assume this is the first
|
||||||
# time after the host booted
|
# time after the host booted
|
||||||
|
# Note, lxc shares the same /proc/stat as the host
|
||||||
if ! [ -e "$1/last-start-date" ] ||
|
if ! [ -e "$1/last-start-date" ] ||
|
||||||
! [ -e /proc/1 ]
|
! [ -e /proc/1 ]
|
||||||
then
|
then
|
||||||
@@ -681,7 +682,8 @@ is_first_boot() {
|
|||||||
else
|
else
|
||||||
last_start=$("$SNAP/bin/cat" "$1/last-start-date")
|
last_start=$("$SNAP/bin/cat" "$1/last-start-date")
|
||||||
if [ -e /proc/stat ] &&
|
if [ -e /proc/stat ] &&
|
||||||
grep btime /proc/stat
|
grep btime /proc/stat &&
|
||||||
|
! grep lxc /proc/1/environ
|
||||||
then
|
then
|
||||||
boot_time=$(grep btime /proc/stat | cut -d' ' -f2)
|
boot_time=$(grep btime /proc/stat | cut -d' ' -f2)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import string
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|||||||
@@ -429,6 +429,6 @@ class TestAddons(object):
|
|||||||
validate_openebs()
|
validate_openebs()
|
||||||
print("Disabling OpenEBS")
|
print("Disabling OpenEBS")
|
||||||
microk8s_disable("openebs:force")
|
microk8s_disable("openebs:force")
|
||||||
except CalledProcessError as err:
|
except CalledProcessError:
|
||||||
print("Nothing to do, since iscsid is not available")
|
print("Nothing to do, since iscsid is not available")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
import platform
|
import platform
|
||||||
|
|||||||
4
tox.ini
4
tox.ini
@@ -9,7 +9,7 @@ envdir = {toxinidir}/.tox_env
|
|||||||
passenv =
|
passenv =
|
||||||
MK8S_*
|
MK8S_*
|
||||||
deps =
|
deps =
|
||||||
black
|
black ==21.4b2
|
||||||
flake8
|
flake8
|
||||||
flake8-colors
|
flake8-colors
|
||||||
pep8-naming
|
pep8-naming
|
||||||
@@ -19,7 +19,7 @@ deps =
|
|||||||
[testenv:lint]
|
[testenv:lint]
|
||||||
commands =
|
commands =
|
||||||
-flake8
|
-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)/" .
|
black --diff --check --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" .
|
||||||
|
|
||||||
[testenv:func]
|
[testenv:func]
|
||||||
|
|||||||
Reference in New Issue
Block a user