[RFC PATCH v2 2/3] s3: net: implement json output for ads info

Andrew Bartlett abartlet at samba.org
Mon Jul 9 20:28:42 UTC 2018


On Mon, 2018-07-09 at 11:08 +0200, Philipp Gesang via samba-technical
wrote:
> Add the switch '-j' to 'net' to format the output as JSON.
> 
> The rationale is to supply the information in a machine-readable
> fashion to complement the text version of the output which is
> neither particularly well defined nor locale-safe.

A good use for JSON output.

> The output differs from that of plain 'info' in that times are
> not formatted as timestamps.

Why is that (given we have utility functions for that)?

Also, we really should have a test.  

Sadly this will reopen the can of worms around which configure options
would require json, in this case the combination of --enable-seftest
but not --without-ads would start to need json.  

See lib/audit_logging/wscript and the attached patch.

However you need to adapt the configure options to explain this is no
longer just for audit.

Attached is my first attempt, please build on that.

CI: https://gitlab.com/catalyst-samba/samba/pipelines/25428061

Thanks,

Andrew Bartlett
-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba
-------------- next part --------------
From 5808400f8af4a99e29b4b9a0023e36de9d2e7525 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet at samba.org>
Date: Tue, 10 Jul 2018 08:26:28 +1200
Subject: [PATCH] build: Reject --without-json-audit --enable-selftest unless
 --without-ads is specified

This allows tests to be written for the new "net ads -j" output

Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
 lib/audit_logging/wscript | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/audit_logging/wscript b/lib/audit_logging/wscript
index d40fc6f079f..41552d0c744 100644
--- a/lib/audit_logging/wscript
+++ b/lib/audit_logging/wscript
@@ -29,8 +29,14 @@ def configure(conf):
                        "formatted audit log feature and the AD DC")
         if not Options.options.without_ad_dc:
             raise Utils.WafError('--without-json-audit requires '
-                                 '--without-ad-dc. '
+                                 '--without-ad-dc --without-ads. '
                                  'Jansson JSON library is required for '
                                  'building the AD DC')
+        if Options.options.with_ads and conf.CONFIG_GET('ENABLE_SELFTEST'):
+            raise Utils.WafError('--enable-selftest and '
+                                 '--without-json-audit requires '
+                                 '--without-ads. '
+                                 'Jansson JSON library is required for '
+                                 'running the ADS tests')
         Logs.info("Building without Jansson JSON log support")
 
-- 
2.14.4



More information about the samba-technical mailing list