Alon Bar-Lev has uploaded a new change for review.

Change subject: core: support suppress log of environment variables
......................................................................

core: support suppress log of environment variables

Change-Id: I30c48fbbbe8611fa1f53e6052ad4a433d96e507b
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M README.environment
M src/otopi/constants.py
M src/otopi/context.py
3 files changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/16/16016/1

diff --git a/README.environment b/README.environment
index 381ba4a..aaf512b 100644
--- a/README.environment
+++ b/README.environment
@@ -46,6 +46,9 @@
     Directory where instaler was executed.
     Installer changes to '/' to avoid errors during program execution.
 
+BASE/suppressEnvironmentKeys(list)
+    Suppress output of environment keys.
+
 BASE/pluginGroups(str)
     Plugin groups to load. ':' separated.
 
diff --git a/src/otopi/constants.py b/src/otopi/constants.py
index 7f9fefd..b77bb65 100644
--- a/src/otopi/constants.py
+++ b/src/otopi/constants.py
@@ -101,6 +101,7 @@
     PLUGIN_GROUPS = 'BASE/pluginGroups'
     DEBUG = 'BASE/debug'
     EXECUTION_DIRECTORY = 'BASE/executionDirectory'
+    SUPPRESS_ENVIRONMENT_KEYS = 'BASE/suppressEnvironmentKeys'
     COMMAND_PREFIX = 'COMMAND/'
 
 
diff --git a/src/otopi/context.py b/src/otopi/context.py
index 6441e11..c152b6d 100644
--- a/src/otopi/context.py
+++ b/src/otopi/context.py
@@ -190,6 +190,7 @@
             constants.BaseEnv.ABORTED: False,
             constants.BaseEnv.EXCEPTION_INFO: [],
             constants.BaseEnv.EXECUTION_DIRECTORY: '.',
+            constants.BaseEnv.SUPPRESS_ENVIRONMENT_KEYS: [],
             constants.BaseEnv.LOG: False,
             constants.BaseEnv.PLUGIN_PATH: config.otopiplugindir,
             constants.BaseEnv.PLUGIN_GROUPS: 'otopi',
@@ -423,11 +424,14 @@
                 old is None or
                 self.environment[key] != old.get(key)
             ):
+                value = self.environment[key]
+                if key in constants.BaseEnv.SUPPRESS_ENVIRONMENT_KEYS:
+                    value = '***'
                 self.logger.debug(
                     "ENV %s=%s:'%s'",
                     key,
                     type(self.environment[key]).__name__,
-                    self.environment[key],
+                    value,
                 )
         self.logger.debug('ENVIRONMENT DUMP - END')
 


-- 
To view, visit http://gerrit.ovirt.org/16016
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I30c48fbbbe8611fa1f53e6052ad4a433d96e507b
Gerrit-PatchSet: 1
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to