[sysadmin-bin] Allow executing foundation-operations.py within OSCP



commit 008915e5bcf3a5675d189471fe4fb91051263ae0
Author: Andrea Veri <averi redhat com>
Date:   Tue Aug 27 12:37:57 2019 +0200

    Allow executing foundation-operations.py within OSCP

 membership/foundation-operations.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/membership/foundation-operations.py b/membership/foundation-operations.py
index 8a93c8b..795ea78 100755
--- a/membership/foundation-operations.py
+++ b/membership/foundation-operations.py
@@ -43,7 +43,15 @@ if len(sys.argv) == 1:
     parser.print_help()
     sys.exit(1)
 
-execfile('/home/admin/secret/freeipa_rw_foundation')
+try:
+    execfile('/home/admin/secret/freeipa_rw_foundation')
+except IOError as e:
+    if e.errno == 2:
+        LDAP_GROUP_BASE = os.environ.get('LDAP_GROUP_BASE')
+        LDAP_USER_BASE = os.environ.get('LDAP_USER_BASE')
+        LDAP_HOST = os.environ.get('LDAP_HOST')
+        LDAP_USER = os.environ.get('LDAP_USER')
+        LDAP_PASSWORD = os.environ.get('LDAP_PASSWORD')
 
 glu = Gnome_ldap_utils(LDAP_GROUP_BASE, LDAP_HOST, LDAP_USER_BASE, LDAP_USER, LDAP_PASSWORD)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]