/usr/sbin/dscreate is in 389-ds-base 1.3.7.10-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #!/usr/bin/python3
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
import argparse
import logging
import sys
# This has to happen before we import DirSrv else it tramples our config ... :(
logging.basicConfig(format='%(message)s')
from lib389 import DirSrv
from lib389.cli_ctl import instance as cli_instance
log = logging.getLogger("dscreate")
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose',
help="Display verbose operation tracing during command execution",
action='store_true', default=False
)
subparsers = parser.add_subparsers(help="action")
fromfile_parser = subparsers.add_parser('fromfile', help="Create an instance of Directory Server from an inf answer file")
fromfile_parser.add_argument('file', help="Inf file to use with prepared answers. You can generate an example of this with 'dscreate example'")
fromfile_parser.add_argument('-n', '--dryrun', help="Validate system and configurations only. Do not alter the system.", action='store_true', default=False)
fromfile_parser.add_argument('--IsolemnlyswearthatIamuptonogood', dest="ack",
help="""You are here likely here by mistake! You want setup-ds.pl!
By setting this value you acknowledge and take responsibility for the fact this command is UNTESTED and NOT READY. You are ON YOUR OWN!
""",
action='store_true', default=False)
fromfile_parser.add_argument('-c', '--containerised', help="Indicate to the installer that this is running in a container. Used to disable systemd native components, even if they are installed.", action='store_true', default=False)
fromfile_parser.set_defaults(func=cli_instance.instance_create)
example_parser = subparsers.add_parser('example', help="Display an example ini answer file, with comments")
example_parser.set_defaults(func=cli_instance.instance_example)
args = parser.parse_args()
if args.verbose:
log.setLevel(logging.DEBUG)
else:
log.setLevel(logging.INFO)
log.debug("The 389 Directory Server Creation Tool")
# Leave this comment here: UofA let me take this code with me provided
# I gave attribution. -- wibrown
log.debug("Inspired by works of: ITS, The University of Adelaide")
log.debug("Called with: %s", args)
inst = DirSrv(verbose=args.verbose)
result = False
if args.verbose:
result = args.func(inst, log, args)
else:
try:
result = args.func(inst, log, args)
except Exception as e:
log.debug(e, exc_info=True)
log.error("Error: %s" % str(e))
if result is True:
log.info('FINISH: Command succeeded')
elif result is False:
log.info('FAIL: Command failed. See output for details.')
# Done!
log.debug("dscreate is brought to you by the letter S and the number 22.")
if result is False:
sys.exit(1)
|