This is an automated email from the ASF dual-hosted git repository.

amagyar pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new b41df10  AMBARI-25226. tproxy-enabled flag is not used by 
ambari-server setup-trusted-proxy (amagyar) (#2913)
b41df10 is described below

commit b41df103e192ebb5c9b2f8fcaa6beb75ac8887d0
Author: Attila Magyar <m.magy...@gmail.com>
AuthorDate: Tue Apr 9 14:40:49 2019 +0200

    AMBARI-25226. tproxy-enabled flag is not used by ambari-server 
setup-trusted-proxy (amagyar) (#2913)
---
 .../main/python/ambari_server/setupTrustedProxy.py | 32 ++++++++++++++--------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/ambari-server/src/main/python/ambari_server/setupTrustedProxy.py 
b/ambari-server/src/main/python/ambari_server/setupTrustedProxy.py
index d93542e..030f9e9 100644
--- a/ambari-server/src/main/python/ambari_server/setupTrustedProxy.py
+++ b/ambari-server/src/main/python/ambari_server/setupTrustedProxy.py
@@ -108,17 +108,25 @@ def setup_trusted_proxy(options):
   validate_options(options)
   ambari_properties = get_ambari_properties()
 
-  if ambari_properties.get_property(TPROXY_SUPPORT_ENABLED) == 'true':
-    print_info_msg('\nTrusted Proxy support is currently enabled.\n')
-    if not get_YN_input('Do you want to disable Trusted Proxy support [y/n] 
(n)? ', False):
-      return
-    ambari_properties.process_pair(TPROXY_SUPPORT_ENABLED, 'false')
+  if options.tproxy_enabled is None:
+    if ambari_properties.get_property(TPROXY_SUPPORT_ENABLED) == 'true':
+      print_info_msg('\nTrusted Proxy support is currently enabled.\n')
+      if not get_YN_input('Do you want to disable Trusted Proxy support [y/n] 
(n)? ', False):
+        return
+      ambari_properties.process_pair(TPROXY_SUPPORT_ENABLED, 'false')
+    else:
+      print_info_msg('\nTrusted Proxy support is currently disabled.\n')
+      if not get_YN_input('Do you want to configure Trusted Proxy Support 
[y/n] (y)? ', True):
+        return
+      remove_existing_tproxy_properties(ambari_properties)
+      ambari_properties.process_pair(TPROXY_SUPPORT_ENABLED, 'true')
+      update_ambari_properties(ambari_properties, input_tproxy_config(options))
   else:
-    print_info_msg('\nTrusted Proxy support is currently disabled.\n')
-    if not get_YN_input('Do you want to configure Trusted Proxy Support [y/n] 
(y)? ', True):
-      return
-    remove_existing_tproxy_properties(ambari_properties)
-    ambari_properties.process_pair(TPROXY_SUPPORT_ENABLED, 'true')
-    update_ambari_properties(ambari_properties, input_tproxy_config(options))
-
+    configure_tproxy(ambari_properties, options)
   save_ambari_properties(ambari_properties)
+
+def configure_tproxy(ambari_properties, options):
+  ambari_properties.process_pair(TPROXY_SUPPORT_ENABLED, 
options.tproxy_enabled)
+  if options.tproxy_enabled == 'true':
+    remove_existing_tproxy_properties(ambari_properties)
+    update_ambari_properties(ambari_properties, input_tproxy_config(options))
\ No newline at end of file

Reply via email to