CLI: fix root check for slapgrid and format.

parent 9766a78a
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import logging import logging
import sys import sys
from slapos.cli.command import must_be_root from slapos.cli.command import check_root_user
from slapos.cli.config import ConfigCommand from slapos.cli.config import ConfigCommand
from slapos.format import do_format, FormatConfig, tracing_monkeypatch, UsageError from slapos.format import do_format, FormatConfig, tracing_monkeypatch, UsageError
from slapos.util import string_to_boolean from slapos.util import string_to_boolean
...@@ -69,7 +69,7 @@ class FormatCommand(ConfigCommand): ...@@ -69,7 +69,7 @@ class FormatCommand(ConfigCommand):
# Parse if we have to check if running from root # Parse if we have to check if running from root
# XXX document this feature. # XXX document this feature.
if string_to_boolean(getattr(conf, 'root_check', 'True').lower()): if string_to_boolean(getattr(conf, 'root_check', 'True').lower()):
must_be_root(lambda:None) check_root_user(self)
if not self.app.options.log_file and conf.log_file: if not self.app.options.log_file and conf.log_file:
# no log file is provided by argparser, # no log file is provided by argparser,
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from slapos.cli.command import must_be_root from slapos.cli.command import check_root_user
from slapos.cli.config import ConfigCommand from slapos.cli.config import ConfigCommand
from slapos.grid.utils import setRunning, setFinished from slapos.grid.utils import setRunning, setFinished
...@@ -70,7 +70,7 @@ class SlapgridCommand(ConfigCommand): ...@@ -70,7 +70,7 @@ class SlapgridCommand(ConfigCommand):
# Parse if we have to check if running from root # Parse if we have to check if running from root
# XXX document this feature. # XXX document this feature.
if string_to_boolean(options.get('root_check', 'True').lower()): if string_to_boolean(options.get('root_check', 'True').lower()):
must_be_root(lambda:None) check_root_user(self)
check_missing_parameters(options) check_missing_parameters(options)
check_missing_files(options) check_missing_files(options)
......
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