Verified Commit 9ed028c1 authored by Karel Koci's avatar Karel Koci 🤘

supervisor: fix old config module usage

parent f58693fe
......@@ -33,13 +33,13 @@ import atexit
import signal
import errno
from threading import Thread, Lock
from . import autorun
from . import approvals
from . import notify
from . import hook
from .utils import setup_alarm, report
from .const import PKGUPDATE_CMD, APPROVALS_ASK_FILE, PKGUPDATE_STATE
from ._pidlock import PidLock
from .config import Config
class Supervisor:
......@@ -72,12 +72,11 @@ class Supervisor:
raise
# Prepare command to be run
cmd = list(PKGUPDATE_CMD)
with Config() as cnf:
if cnf.approvals_need():
cmd.append('--ask-approval=' + APPROVALS_ASK_FILE)
approved = approvals._approved()
if approved is not None:
cmd.append('--approve=' + approved)
if autorun.approvals():
cmd.append('--ask-approval=' + APPROVALS_ASK_FILE)
approved = approvals._approved()
if approved is not None:
cmd.append('--approve=' + approved)
# Clear old dump files
notify.clear_logs()
# Open process
......
......@@ -24,11 +24,11 @@
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import sys
import argparse
from svupdater import autorun
from svupdater.prerun import random_sleep, wait_for_network
from svupdater._supervisor import run
from svupdater.const import PKGUPDATE_TIMEOUT, PKGUPDATE_TIMEOUT_KILL
from svupdater.const import PING_TIMEOUT
from svupdater.config import Config
from svupdater.utils import daemonize
# Script description as help text
......@@ -85,10 +85,9 @@ def parse_arguments():
def main():
"Main function for updater-supervisor run as executable"
with Config() as cnf:
if cnf.disable():
print('Updater disabled.')
sys.exit(0)
if not autorun.enabled():
print('Updater autorun disabled.')
sys.exit(0)
args = parse_arguments()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment