diff --git a/sos/__init__.py b/sos/__init__.py index 9cd7172857..725c003ac3 100644 --- a/sos/__init__.py +++ b/sos/__init__.py @@ -50,13 +50,13 @@ def _default(msg): #: Names of all arguments _arg_names = [ - 'add_preset', 'alloptions', 'all_logs', 'batch', 'build', 'case_id', - 'chroot', 'compression_type', 'config_file', 'desc', 'debug', 'del_preset', - 'dry_run', 'enableplugins', 'encrypt_key', 'encrypt_pass', 'experimental', - 'label', 'list_plugins', 'list_presets', 'list_profiles', 'log_size', - 'noplugins', 'noreport', 'no_env_vars', 'note', 'onlyplugins', - 'plugin_timeout', 'plugopts', 'preset', 'profiles', 'quiet', 'sysroot', - 'threads', 'tmp_dir', 'verbosity', 'verify' + 'add_preset', 'alloptions', 'allow_system_changes', 'all_logs', 'batch', + 'build', 'case_id', 'chroot', 'compression_type', 'config_file', 'desc', + 'debug', 'del_preset', 'dry_run', 'enableplugins', 'encrypt_key', + 'encrypt_pass', 'experimental', 'label', 'list_plugins', 'list_presets', + 'list_profiles', 'log_size', 'noplugins', 'noreport', 'no_env_vars', + 'note', 'onlyplugins', 'plugin_timeout', 'plugopts', 'preset', 'profiles', + 'quiet', 'sysroot', 'threads', 'tmp_dir', 'verbosity', 'verify' ] #: Arguments with non-zero default values @@ -179,6 +179,7 @@ def __init__(self, **kwargs): self.log_size = _arg_defaults["log_size"] self.noplugins = [] self.noreport = False + self.allow_system_changes = False self.no_env_vars = False self.note = "" self.onlyplugins = [] @@ -219,9 +220,9 @@ def _opt_to_args(cls, opt, val): and verbose). """ no_value = ( - "alloptions", "all-logs", "batch", "build", "debug", - "experimental", "list-plugins", "list-presets", "list-profiles", - "noreport", "no-env-vars", "quiet", "verify" + "alloptions", "allow-system-changes", "all-logs", "batch", "build", + "debug", "experimental", "list-plugins", "list-presets", + "list-profiles", "noreport", "no-env-vars", "quiet", "verify" ) count = ("verbose",) if opt in no_value: diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index e51ca6a7ea..66c2647071 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -750,7 +750,10 @@ def get_option(self, optionname, default=0): matches any of the option names is returned. """ - global_options = ('verify', 'all_logs', 'log_size', 'plugin_timeout') + global_options = ( + 'all_logs', 'allow_system_changes', 'log_size', 'plugin_timeout', + 'verify' + ) if optionname in global_options: return getattr(self.commons['cmdlineopts'], optionname) diff --git a/sos/sosreport.py b/sos/sosreport.py index 04cb861557..723e3e583c 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -221,6 +221,10 @@ def _get_parser(): parser.add_argument("-t", "--threads", action="store", dest="threads", help="specify number of concurrent plugins to run" " (default=4)", default=4, type=int) + parser.add_argument("--allow-system-changes", action="store_true", + dest="allow_system_changes", default=False, + help="Run commands even if they can change the " + "system (e.g. load kernel modules)") # Group to make add/del preset exclusive preset_grp = parser.add_mutually_exclusive_group()