slapformat: Don't check root if we don't want to.

parent 7eef339f
...@@ -6,7 +6,7 @@ import sys ...@@ -6,7 +6,7 @@ import sys
from slapos.cli.command import must_be_root from slapos.cli.command import must_be_root
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
class FormatCommand(ConfigCommand): class FormatCommand(ConfigCommand):
""" """
...@@ -61,7 +61,6 @@ class FormatCommand(ConfigCommand): ...@@ -61,7 +61,6 @@ class FormatCommand(ConfigCommand):
help="Console output (obsolete)") help="Console output (obsolete)")
return ap return ap
@must_be_root
def take_action(self, args): def take_action(self, args):
configp = self.fetch_config(args) configp = self.fetch_config(args)
...@@ -69,6 +68,11 @@ class FormatCommand(ConfigCommand): ...@@ -69,6 +68,11 @@ class FormatCommand(ConfigCommand):
conf.mergeConfig(args, configp) conf.mergeConfig(args, configp)
# Parse if we have to check if running from root
# XXX document this feature.
if string_to_boolean(getattr(conf, 'root_check', 'True').lower()):
must_be_root(lambda:None)
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,
# we set up the one from config # we set up the one from config
......
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