From eafaf473aa48f16b789375564aa4ef0027ca74f8 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Jun 29 2018 16:53:30 +0000 Subject: Ticket 49783 - UI - add server configuration backend Description: This patch pulls in all the cn=config values and poplues the UI. it also allows you to save values to the server. Also cockpit can only pull in strerr messages when things fail, so I had to undue a recent change to redirect stderr to stdout. https://pagure.io/389-ds-base/issue/49783 Reviewed by: spichugi & vashirov(Thanks!!) --- diff --git a/src/cockpit/389-console/backend.html b/src/cockpit/389-console/backend.html index 91e2784..93210de 100644 --- a/src/cockpit/389-console/backend.html +++ b/src/cockpit/389-console/backend.html @@ -130,7 +130,7 @@

@@ -239,7 +239,7 @@ @@ -584,7 +584,7 @@ diff --git a/src/cockpit/389-console/css/ds.css b/src/cockpit/389-console/css/ds.css index 918513e..e5d1adf 100644 --- a/src/cockpit/389-console/css/ds.css +++ b/src/cockpit/389-console/css/ds.css @@ -302,7 +302,6 @@ td { max-height: 400px; margin: 23px 10px 2px 0px; overflow: auto; - border-radius: 5px !important; } .ds-monitor-tree { @@ -317,7 +316,6 @@ td { max-height: 400px; margin: 10px; overflow: auto; - border-radius: 5px !important; } .ds-treenode { diff --git a/src/cockpit/389-console/index.html b/src/cockpit/389-console/index.html index 85a327b..5f69103 100644 --- a/src/cockpit/389-console/index.html +++ b/src/cockpit/389-console/index.html @@ -172,6 +172,19 @@ popup modals from any action dropdown, or right-click option need to be defined here ---------------------------------------- --> + + diff --git a/src/cockpit/389-console/security.html b/src/cockpit/389-console/security.html index eab2bff..1444418 100644 --- a/src/cockpit/389-console/security.html +++ b/src/cockpit/389-console/security.html @@ -257,7 +257,7 @@ diff --git a/src/cockpit/389-console/servers.html b/src/cockpit/389-console/servers.html index d86a286..f65d08b 100644 --- a/src/cockpit/389-console/servers.html +++ b/src/cockpit/389-console/servers.html @@ -52,9 +52,9 @@
+ class="ds-input disk-monitoring" type="text" id="nsslapd-disk-monitoring-grace-period" size="10"/>
@@ -143,7 +143,7 @@
+ class="ds-input" type="password" id="nsslapd-rootpw-confirm" size="40"/>
at :
@@ -556,9 +556,9 @@
@@ -587,7 +587,7 @@ @@ -622,11 +622,11 @@
at :
@@ -646,15 +646,15 @@
@@ -681,11 +681,11 @@
at :
@@ -704,15 +704,15 @@
@@ -738,11 +738,11 @@
at :
@@ -762,9 +762,9 @@
@@ -843,7 +843,7 @@ @@ -951,7 +951,7 @@ @@ -1007,7 +1007,7 @@ diff --git a/src/lib389/cli/dsconf b/src/lib389/cli/dsconf index 800d42e..2748e31 100755 --- a/src/lib389/cli/dsconf +++ b/src/lib389/cli/dsconf @@ -123,7 +123,7 @@ if __name__ == '__main__': except Exception as e: log.debug(e, exc_info=True) if args and args.json: - print(e) + sys.stderr.write(str(e)) else: log.error("Error: %s" % str(e)) result = False diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py index be2a844..590d930 100644 --- a/src/lib389/lib389/__init__.py +++ b/src/lib389/lib389/__init__.py @@ -2778,15 +2778,14 @@ class DirSrv(SimpleLDAPObject, object): cmd.append('-E') try: - result = subprocess.check_output(cmd, stderr=subprocess.STDOUT, encoding='utf-8') - u_result = ensure_str(result) + result = subprocess.check_output(cmd, encoding='utf-8') except subprocess.CalledProcessError as e: self.log.debug("Command: {} failed with the return code {} and the error {}".format( format_cmd_list(cmd), e.returncode, e.output)) return False self.log.debug("ldif2db output: BEGIN") - for line in u_result.split("\n"): + for line in result.split("\n"): self.log.debug(line) self.log.debug("ldif2db output: END") @@ -2847,15 +2846,14 @@ class DirSrv(SimpleLDAPObject, object): ldifname = "/" + self.serverid + "-" + datetime.now().strftime("%Y_%m_%d_%H_%M_%S") cmd.append(self.get_ldif_dir() + ldifname) try: - result = subprocess.check_output(cmd, stderr=subprocess.STDOUT, encoding='utf-8') - u_result = ensure_str(result) + result = subprocess.check_output(cmd, encoding='utf-8') except subprocess.CalledProcessError as e: self.log.debug("Command: {} failed with the return code {} and the error {}".format( format_cmd_list(cmd), e.returncode, e.output)) return False self.log.debug("db2ldif output: BEGIN") - for line in u_result.split("\n"): + for line in result.split("\n"): self.log.debug(line) self.log.debug("db2ldif output: END") @@ -2884,15 +2882,14 @@ class DirSrv(SimpleLDAPObject, object): 'archive2db', '-a', archive_dir, '-D', self.get_config_dir() - ], stderr=subprocess.STDOUT, encoding='utf-8') - u_result = ensure_str(result) + ], encoding='utf-8') except subprocess.CalledProcessError as e: self.log.debug("Command: {} failed with the return code {} and the error {}".format( format_cmd_list(cmd), e.returncode, e.output)) return False self.log.debug("bak2db output: BEGIN") - for line in u_result.split("\n"): + for line in result.split("\n"): self.log.debug(line) self.log.debug("bak2db output: END") @@ -2923,14 +2920,14 @@ class DirSrv(SimpleLDAPObject, object): 'db2archive', '-a', archive_dir, '-D', self.get_config_dir() - ], stderr=subprocess.STDOUT, encoding='utf-8') - u_result = ensure_str(result) + ], encoding='utf-8') except subprocess.CalledProcessError as e: self.log.debug("Command: {} failed with the return code {} and the error {}".format( - format_cmd_list(cmd), e.returncode, e.output)) + format_cmd_list(cmd), e.returncode, e.output)) + return False self.log.debug("db2bak output: BEGIN") - for line in u_result.split("\n"): + for line in result.split("\n"): self.log.debug(line) self.log.debug("db2bak output: END") @@ -2986,15 +2983,14 @@ class DirSrv(SimpleLDAPObject, object): cmd.append(vlvTag) try: - result = subprocess.check_output(cmd, stderr=subprocess.STDOUT, encoding='utf-8') - u_result = ensure_str(result) + result = subprocess.check_output(cmd, encoding='utf-8') except subprocess.CalledProcessError as e: self.log.debug("Command: {} failed with the return code {} and the error {}".format( format_cmd_list(cmd), e.returncode, e.output)) return False self.log.debug("db2index output: BEGIN") - for line in u_result.split("\n"): + for line in result.split("\n"): self.log.debug(line) self.log.debug("db2index output: END") diff --git a/src/lib389/lib389/cli_base/__init__.py b/src/lib389/lib389/cli_base/__init__.py index 0b6ee0c..537b9f7 100644 --- a/src/lib389/lib389/cli_base/__init__.py +++ b/src/lib389/lib389/cli_base/__init__.py @@ -142,7 +142,7 @@ def _generic_get(inst, basedn, log, manager_class, selector, args=None): mc = manager_class(inst, basedn) if args and args.json: o = mc.get(selector, json=True) - log.info(o) + print(o) else: o = mc.get(selector) o_str = o.display() @@ -152,7 +152,7 @@ def _generic_get(inst, basedn, log, manager_class, selector, args=None): def _generic_get_entry(inst, basedn, log, manager_class, args=None): mc = manager_class(inst, basedn) if args and args.json: - log.info(mc.get_all_attrs_json()) + print(mc.get_all_attrs_json()) else: log.info(mc.display()) @@ -161,7 +161,7 @@ def _generic_get_attr(inst, basedn, log, manager_class, args=None): mc = manager_class(inst, basedn) for attr in args.attrs: if args and args.json: - log.info(mc.get_attr_vals_json(attr)) + print(mc.get_attr_vals_json(attr)) else: log.info(mc.display_attr(attr).rstrip()) diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py index a6d41be..79ae710 100644 --- a/src/lib389/lib389/instance/setup.py +++ b/src/lib389/lib389/instance/setup.py @@ -487,8 +487,11 @@ class SetupDs(object): # Change the root password finally # Initialise ldapi socket information. IPA expects this .... - ds_instance.config.set('nsslapd-ldapifilepath', ds_instance.get_ldapi_path()) + ldapi_path = slapd['run_dir'].replace('dirsrv', 'slapd-' + slapd['instance_name'] + '.socket') + ds_instance.config.set('nsslapd-ldapifilepath', ldapi_path) ds_instance.config.set('nsslapd-ldapilisten', 'on') + ds_instance.config.set('nsslapd-ldapiautobind', 'on') + ds_instance.config.set('nsslapd-ldapimaprootdn', slapd['root_dn']) # Complete. ds_instance.config.set('nsslapd-rootpw',