This is an automated email from the git hooks/post-receive script.
firstyear pushed a commit to branch master
in repository lib389.
commit 1c7a29f8399da78f9ce6de726f217db704e201b4
Author: William Brown <firstyear(a)redhat.com>
Date: Fri Mar 10 10:32:12 2017 +1000
Ticket 5 - Fix container build on fedora
Bug Description: We need lib389 to help us build containerised versions of DS.
To resolve this, we need to fix a number of fedora build issues with the rpm.
Additionally, containers don't allow docs install, so we have to be able to
generate a working example setup.inf from the cli tools.
Fix Description: Remove shebangs that cause rpm to generate incorrect
dependencies, shutdown ds at end of a container install, fix the example
generator to uncomment needed options.
https://pagure.io/lib389/issue/5
Author: wibrown
Review by: mreynolds (Thanks!)
---
cli/dsadm | 2 +-
cli/dsconf | 2 +-
cli/dsidm | 2 +-
examples/ds-setup.inf | 40 --------------------------------
lib389/cli_adm/instance.py | 3 +++
lib389/cli_conf/schema.py | 2 --
lib389/cli_idm/group.py | 2 --
lib389/cli_idm/organisationalunit.py | 2 --
lib389/cli_idm/posixgroup.py | 2 --
lib389/cli_idm/user.py | 2 --
lib389/clitools/ds_setup | 2 --
lib389/instance/options.py | 45 ++++++++++++++++++++++++++++++++----
lib389/instance/setup.py | 4 ++++
setup.py | 2 +-
14 files changed, 51 insertions(+), 61 deletions(-)
diff --git a/cli/dsadm b/cli/dsadm
index 77262f0..0ee0970 100755
--- a/cli/dsadm
+++ b/cli/dsadm
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/python
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016 Red Hat, Inc.
diff --git a/cli/dsconf b/cli/dsconf
index c74698d..72ec909 100755
--- a/cli/dsconf
+++ b/cli/dsconf
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/python
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016 Red Hat, Inc.
diff --git a/cli/dsidm b/cli/dsidm
index 64f10ed..fd697ba 100755
--- a/cli/dsidm
+++ b/cli/dsidm
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/python
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016, William Brown <william at blackhats.net.au>
diff --git a/examples/ds-setup.inf b/examples/ds-setup.inf
deleted file mode 100644
index 1f1778b..0000000
--- a/examples/ds-setup.inf
+++ /dev/null
@@ -1,40 +0,0 @@
-; --- BEGIN COPYRIGHT BLOCK ---
-; Copyright (C) 2015 Red Hat, Inc.
-; All rights reserved.
-;
-; License: GPL (version 3 or any later version).
-; See LICENSE for details.
-; --- END COPYRIGHT BLOCK ---
-
-; Author: firstyear at
redhat.com
-
-; This is a version 2 ds setup inf file.
-; It is used by the python versions of setup-ds-*
-; Most options map 1 to 1 to the original .inf file.
-; However, there are some differences that I envision
-; For example, note the split backend section.
-; You should be able to create, one, many or no backends in an install
-
-[general]
-config_version=2
-full_machine_name=localhost.localdomain
-strict_host_checking=False
-
-[slapd]
-instance_name=localhost
-user=dirsrv
-group=dirsrv
-port=389
-secure_port=636
-root_dn=cn=Directory Manager
-root_password=password
-prefix=/opt/dirsrv
-
-[backend-userRoot]
-suffix=dc=example,dc=com
-; this is controlled by slapd.InstallLdifFile == none, suggest or path in setup-ds.pl
-sample_entries=999999999
-
-
-
-
diff --git a/lib389/cli_adm/instance.py b/lib389/cli_adm/instance.py
index 1d44e3c..e14fa79 100644
--- a/lib389/cli_adm/instance.py
+++ b/lib389/cli_adm/instance.py
@@ -103,6 +103,9 @@ def instance_example(inst, log, args):
; However, there are some differences that I envision
; For example, note the split backend section.
; You should be able to create, one, many or no backends in an install
+;
+; The special value {instance_name} is substituted at installation time.
+;
""")
g2b = General2Base(log)
diff --git a/lib389/cli_conf/schema.py b/lib389/cli_conf/schema.py
index c2427c4..0e1f2a4 100644
--- a/lib389/cli_conf/schema.py
+++ b/lib389/cli_conf/schema.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python3
-
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016, William Brown <william at blackhats.net.au>
# All rights reserved.
diff --git a/lib389/cli_idm/group.py b/lib389/cli_idm/group.py
index d41205f..373d1de 100644
--- a/lib389/cli_idm/group.py
+++ b/lib389/cli_idm/group.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python3
-
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016, William Brown <william at blackhats.net.au>
# All rights reserved.
diff --git a/lib389/cli_idm/organisationalunit.py b/lib389/cli_idm/organisationalunit.py
index bcc2232..46ec267 100644
--- a/lib389/cli_idm/organisationalunit.py
+++ b/lib389/cli_idm/organisationalunit.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python3
-
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016, William Brown <william at blackhats.net.au>
# All rights reserved.
diff --git a/lib389/cli_idm/posixgroup.py b/lib389/cli_idm/posixgroup.py
index 5c9331a..2f5cbda 100644
--- a/lib389/cli_idm/posixgroup.py
+++ b/lib389/cli_idm/posixgroup.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python3
-
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016, William Brown <william at blackhats.net.au>
# All rights reserved.
diff --git a/lib389/cli_idm/user.py b/lib389/cli_idm/user.py
index 07e4853..197a035 100644
--- a/lib389/cli_idm/user.py
+++ b/lib389/cli_idm/user.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python3
-
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016, William Brown <william at blackhats.net.au>
# All rights reserved.
diff --git a/lib389/clitools/ds_setup b/lib389/clitools/ds_setup
index 7cec5c7..212a34a 100755
--- a/lib389/clitools/ds_setup
+++ b/lib389/clitools/ds_setup
@@ -1,5 +1,3 @@
-#!/usr/bin/python3
-
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2015 Red Hat, Inc.
# All rights reserved.
diff --git a/lib389/instance/options.py b/lib389/instance/options.py
index 07bb196..1acbbe4 100644
--- a/lib389/instance/options.py
+++ b/lib389/instance/options.py
@@ -52,6 +52,7 @@ class Options2(object):
self._options = {} # this takes the default
self._type = {} # Lists the type the item should be.
self._helptext = {} # help text for the option, MANDATORY.
+ self._example_comment = {} # If this is a commented value in the example.
self._valid_func = {} # options verification function.
self._section = None
self.log = log
@@ -88,10 +89,13 @@ class Options2(object):
def collect_help(self):
helptext = "[%s]\n" % self._section
- for k in self._options.keys():
+ for k in sorted(self._options.keys()):
helptext += "# %s: %s\n" % (k, self._helptext[k])
helptext += "# type: %s\n" % (self._type[k].__name__)
- helptext += "; %s = %s\n\n" % (k, self._options[k])
+ if self._example_comment[k]:
+ helptext += "; %s = %s\n\n" % (k, self._options[k])
+ else:
+ helptext += "%s = %s\n\n" % (k, self._options[k])
return helptext
#
@@ -106,27 +110,32 @@ class General2Base(Options2):
self._options['config_version'] = 2
self._type['config_version'] = int
self._helptext['config_version'] = "The format version of the inf
answer file."
+ self._example_comment['config_version'] = False
self._options['full_machine_name'] = socket.gethostname()
self._type['full_machine_name'] = str
self._helptext['full_machine_name'] = "The fully qualified hostname
of this system."
+ self._example_comment['full_machine_name'] = False
self._options['strict_host_checking'] = True
self._type['strict_host_checking'] = bool
self._helptext['strict_host_checking'] = "If true, will validate
forward and reverse dns names for full_machine_name"
+ self._example_comment['strict_host_checking'] = True
self._options['selinux'] = True
self._type['selinux'] = bool
self._helptext['selinux'] = "Enable SELinux detection and
integration. Normally, this should always be True, and will correctly detect when SELinux
is not present."
+ self._example_comment['selinux'] = True
self._options['systemd'] = ds_paths.with_systemd
self._type['systemd'] = bool
self._helptext['systemd'] = "Enable systemd platform features. This
is autodetected on your platform. You should not alter this value without good
reason."
+ self._example_comment['systemd'] = True
self._options['defaults'] = INSTALL_LATEST_CONFIG
self._type['defaults'] = str
self._helptext['defaults'] = "Set the configuration defaults
version. If set to %{LATEST}, always use the latest values available for the slapd
section. This allows pinning default values in cn=config to specific Directory Server
releases. This maps to our versions such as 1.3.5 -> 001003005 ->
1003005".format(LATEST=INSTALL_LATEST_CONFIG)
-
+ self._example_comment['defaults'] = True
#
# This module contains the base options and configs for Director Server
@@ -138,111 +147,137 @@ class Slapd2Base(Options2):
super(Slapd2Base, self).__init__(log)
self._section = 'slapd'
- self._options['instance_name'] = None
+ self._options['instance_name'] = 'localhost'
self._type['instance_name'] = str
self._helptext['instance_name'] = "The name of the instance. Cannot
be changed post installation."
+ self._example_comment['instance_name'] = False
self._options['user'] = ds_paths.user
self._type['user'] = str
self._helptext['user'] = "The user account ns-slapd will drop
privileges to during operation."
+ self._example_comment['user'] = True
self._options['group'] = ds_paths.group
self._type['group'] = str
self._helptext['group'] = "The group ns-slapd will drop privilleges
to during operation."
+ self._example_comment['group'] = True
self._options['root_dn'] = ds_paths.root_dn
self._type['root_dn'] = str
self._helptext['root_dn'] = "The Distinquished Name of the
Administrator account. This is equivalent to root of your Directory Server."
+ self._example_comment['root_dn'] = True
- self._options['root_password'] = None
+ self._options['root_password'] = 'directory manager password'
self._type['root_password'] = str
self._helptext['root_password'] = "The password for the root_dn
account. "
+ self._example_comment['root_password'] = False
self._options['prefix'] = ds_paths.prefix
self._type['prefix'] = str
self._helptext['prefix'] = "The filesystem prefix for all other
locations. Unless you are developing DS, you likely never need to set this. This value can
be reffered to in other fields with {prefix}, and can be set with the environment variable
PREFIX."
+ self._example_comment['prefix'] = True
self._options['port'] = 389
self._type['port'] = int
self._helptext['port'] = "The TCP port that Directory Server will
listen on for LDAP connections."
+ self._example_comment['port'] = True
self._options['secure_port'] = 636
self._type['secure_port'] = int
self._helptext['secure_port'] = "The TCP port that Directory Server
will listen on for TLS secured LDAP connections."
+ self._example_comment['secure_port'] = True
# In the future, make bin and sbin /usr/[s]bin, but we may need autotools
assistance from Ds
self._options['bin_dir'] = ds_paths.bin_dir
self._type['bin_dir'] = str
self._helptext['bin_dir'] = "The location Directory Server can find
binaries. You should not need to alter this value."
+ self._example_comment['bin_dir'] = True
self._options['sbin_dir'] = ds_paths.sbin_dir
self._type['sbin_dir'] = str
self._helptext['sbin_dir'] = "The location Directory Server can find
systemd administration binaries. You should not need to alter this value."
+ self._example_comment['sbin_dir'] = True
self._options['sysconf_dir'] = ds_paths.sysconf_dir
self._type['sysconf_dir'] = str
self._helptext['sysconf_dir'] = "The location of the system
configuration directory. You should not need to alter this value."
+ self._example_comment['sysconf_dir'] = True
self._options['initconfig_dir'] = ds_paths.initconfig_dir
self._type['initconfig_dir'] = str
self._helptext['initconfig_dir'] = "The location of the system rc
configuration directory. You should not need to alter this value."
+ self._example_comment['initconfig_dir'] = True
# In the future, make bin and sbin /usr/[s]bin, but we may need autotools
assistance from Ds
self._options['data_dir'] = ds_paths.data_dir
self._type['data_dir'] = str
self._helptext['data_dir'] = "The location of shared static data.
You should not need to alter this value."
+ self._example_comment['data_dir'] = True
self._options['local_state_dir'] = ds_paths.local_state_dir
self._type['local_state_dir'] = str
self._helptext['local_state_dir'] = "The location prefix to variable
data. You should not need to alter this value."
+ self._example_comment['local_state_dir'] = True
self._options['lib_dir'] = ds_paths.lib_dir
self._type['lib_dir'] = str
self._helptext['lib_dir'] = "The location to Directory Server shared
libraries. You should not need to alter this value."
+ self._example_comment['lib_dir'] = True
self._options['cert_dir'] = ds_paths.cert_dir
self._type['cert_dir'] = str
self._helptext['cert_dir'] = "The location where NSS will store
certificates."
+ self._example_comment['cert_dir'] = True
self._options['config_dir'] = ds_paths.config_dir
self._type['config_dir'] = str
self._helptext['config_dir'] = "The location where dse.ldif and
other configuration will be stored. You should not need to alter this value."
+ self._example_comment['config_dir'] = True
self._options['inst_dir'] = ds_paths.inst_dir
self._type['inst_dir'] = str
self._helptext['inst_dir'] = "The location of the Directory Server
databases, ldif and backups. You should not need to alter this value."
+ self._example_comment['inst_dir'] = True
self._options['backup_dir'] = ds_paths.backup_dir
self._type['backup_dir'] = str
self._helptext['backup_dir'] = "The location where Directory Server
will export and import backups from. You should not need to alter this value."
+ self._example_comment['backup_dir'] = True
self._options['db_dir'] = ds_paths.db_dir
self._type['db_dir'] = str
self._helptext['db_dir'] = "The location where Directory Server will
store databases. You should not need to alter this value."
+ self._example_comment['db_dir'] = True
self._options['ldif_dir'] = ds_paths.ldif_dir
self._type['ldif_dir'] = str
self._helptext['ldif_dir'] = "The location where Directory Server
will export and import ldif from. You should not need to alter this value."
+ self._example_comment['ldif_dir'] = True
self._options['lock_dir'] = ds_paths.lock_dir
self._type['lock_dir'] = str
self._helptext['lock_dir'] = "The location where Directory Server
will store lock files. You should not need to alter this value."
+ self._example_comment['lock_dir'] = True
self._options['log_dir'] = ds_paths.log_dir
self._type['log_dir'] = str
self._helptext['log_dir'] = "The location where Directory Server
will write log files. You should not need to alter this value."
+ self._example_comment['log_dir'] = True
self._options['run_dir'] = ds_paths.run_dir
self._type['run_dir'] = str
self._helptext['run_dir'] = "The location where Directory Server
will create pid files. You should not need to alter this value."
+ self._example_comment['run_dir'] = True
self._options['schema_dir'] = ds_paths.schema_dir
self._type['schema_dir'] = str
self._helptext['schema_dir'] = "The location where Directory Server
will store and write schema. You should not need to alter this value."
+ self._example_comment['schema_dir'] = True
self._options['tmp_dir'] = ds_paths.tmp_dir
self._type['tmp_dir'] = str
self._helptext['tmp_dir'] = "The location where Directory Server
will write temporary files. You should not need to alter this value."
+ self._example_comment['tmp_dir'] = True
def _format(self, d):
new_d = {}
diff --git a/lib389/instance/setup.py b/lib389/instance/setup.py
index 0907aab..50c3cfe 100644
--- a/lib389/instance/setup.py
+++ b/lib389/instance/setup.py
@@ -437,6 +437,10 @@ class SetupDs(object):
ds_instance.config.set('nsslapd-rootpw',
ensure_str(slapd['root_password']))
+ # In a container build we need to stop DirSrv at the end
+ if self.containerised:
+ ds_instance.stop()
+
def _remove_ds(self):
"""
The opposite of install: Removes an instance from the system.
diff --git a/setup.py b/setup.py
index dfcd498..c10347c 100644
--- a/setup.py
+++ b/setup.py
@@ -51,11 +51,11 @@ setup(
# find lib389/clitools -name ds\* -exec echo \''{}'\', \;
data_files=[
- ('/usr/share/lib389/examples/', ['examples/ds-setup.inf']),
('/usr/sbin/', [
# 'lib389/clitools/ds_setup',
'cli/dsadm',
'cli/dsconf',
+ 'cli/dsidm',
]),
],
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.