update_debug_levels.py revision 341a00311680a440d7f979f06c34c70d86c9367a
from __future__ import print_function
import os
import sys
import shutil
import traceback
from optparse import OptionParser
import SSSDConfig
# Older versions of SSSD (1.5 and earlier) would take a debug_level
# value set in the [sssd] section as authoritative for all other
# sections where not explicitly overridden. We changed this so that
# all sections need to set it if they want debug logs set.
# This script can be run to make the new version continue to produce
# the same logs as the old versions did, by explicitly adding
# debug_level to all domains and services that did not have it set
# already.
def parse_options():
parser = OptionParser()
help="""Do not provide backup file after conversion.
The script copies the original file with the suffix .bak.<timestamp>
by default""")
help="Be verbose")
return None
return options
if verbosity:
print(msg)
def main():
options = parse_options()
if not options:
return 1
# Import the current config file
try:
except Exception as e:
print("Error: %s" % e)
return 2
# Check the [sssd] section for debug_level
# Nothing to do, just return success
verbose("No changes required, no backup necessary",
return 0
# Loop through services
# Not explicitly set, so add it
# Loop through domains (active AND inactive)
# Not explicitly set, so add it
# Save the original file
import datetime
# Save the changes
if __name__ == "__main__":
else:
raise ImportError