mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add root-only warning when exporting system with Kiwi
This commit is contained in:
parent
9bd80f02fc
commit
c87fff3680
1 changed files with 11 additions and 8 deletions
|
@ -20,6 +20,7 @@ Module for full system inspection.
|
|||
from __future__ import absolute_import
|
||||
import logging
|
||||
import os
|
||||
import getpass
|
||||
from salt.modules.inspectlib.exceptions import (InspectorQueryException,
|
||||
InspectorSnapshotException,
|
||||
InspectorKiwiProcessorException)
|
||||
|
@ -206,11 +207,13 @@ def export(local=False, path="/tmp", format='qcow2'):
|
|||
* **path**: If `local=True`, then specifies the path where file with the Kiwi description is written.
|
||||
Default: `/tmp`.
|
||||
'''
|
||||
#try:
|
||||
description = _("query").Query('all', cachedir=__opts__['cachedir'])()
|
||||
return _("collector").Inspector().export(description, local=local, path=path, format=format)
|
||||
#except InspectorKiwiProcessorException as ex:
|
||||
# raise CommandExecutionError(ex)
|
||||
#except Exception as ex:
|
||||
# log.error(_get_error_message(ex))
|
||||
# raise Exception(ex)
|
||||
if getpass.getuser() != 'root':
|
||||
raise CommandExecutionError('In order to export system, the minion should run as "root".')
|
||||
try:
|
||||
description = _("query").Query('all', cachedir=__opts__['cachedir'])()
|
||||
return _("collector").Inspector().export(description, local=local, path=path, format=format)
|
||||
except InspectorKiwiProcessorException as ex:
|
||||
raise CommandExecutionError(ex)
|
||||
except Exception as ex:
|
||||
log.error(_get_error_message(ex))
|
||||
raise Exception(ex)
|
||||
|
|
Loading…
Add table
Reference in a new issue