You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2015/12/03 00:19:32 UTC

[16/26] incubator-ranger git commit: RANGER-751: Fix for Ranger admin setup fails with TypeError

RANGER-751: Fix for Ranger admin setup fails with TypeError

Signed-off-by: sneethiraj <sn...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/5fec40fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/5fec40fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/5fec40fe

Branch: refs/heads/tag-policy
Commit: 5fec40fe64e16142b17cc1d9bac24f626919d053
Parents: 5216a89
Author: Velmurugan Periasamy <ve...@apache.org>
Authored: Sat Nov 28 10:31:27 2015 -0500
Committer: sneethiraj <sn...@apache.org>
Committed: Sat Nov 28 11:07:21 2015 -0500

----------------------------------------------------------------------
 security-admin/scripts/install.properties       | 23 ++++----
 security-admin/scripts/setup.sh                 | 56 ++++++++++++--------
 .../conf.dist/security-applicationContext.xml   |  1 -
 unixauthservice/scripts/setup.py                |  4 +-
 4 files changed, 49 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/5fec40fe/security-admin/scripts/install.properties
----------------------------------------------------------------------
diff --git a/security-admin/scripts/install.properties b/security-admin/scripts/install.properties
index 2d52890..cb10769 100644
--- a/security-admin/scripts/install.properties
+++ b/security-admin/scripts/install.properties
@@ -107,17 +107,6 @@ unix_group=ranger
 #
 # ------- UNIX User CONFIG  - END ----------------
 #
-
-#
-#-------- SSO CONFIG - Start ------------------
-#
-sso_enabled=false
-sso_providerurl=https://localhost:8443/gateway/knoxsso/api/v1/websso
-sso_publickey=
-sso_cookiename=hadoop-jwt
-sso_query_param_originalurl=originalUrl
-#
-#-------- SSO CONFIG - Start ------------------
 #
 
 #
@@ -179,6 +168,18 @@ xa_ldap_ad_bind_dn=
 xa_ldap_ad_bind_password=
 xa_ldap_ad_referral=
 xa_ldap_ad_userSearchFilter=
+
+#
+#-------- SSO CONFIG - Start ------------------
+#
+sso_enabled=false
+sso_providerurl=https://127.0.0.1:8443/gateway/knoxsso/api/v1/websso
+sso_publickey=
+sso_cookiename=hadoop-jwt
+sso_query_param_originalurl=originalUrl
+#
+#-------- SSO CONFIG - END ------------------
+
 # -----------------------------------------------------------
 #
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/5fec40fe/security-admin/scripts/setup.sh
----------------------------------------------------------------------
diff --git a/security-admin/scripts/setup.sh b/security-admin/scripts/setup.sh
index f77a1f5..6753d8d 100755
--- a/security-admin/scripts/setup.sh
+++ b/security-admin/scripts/setup.sh
@@ -344,27 +344,6 @@ update_properties() {
 		log "[E] $to_file_default does not exists" ; exit 1;
     fi
 
- 	propertyName=ranger.sso.enabled
-	newPropertyValue="${sso_enabled}"
-        updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
- 
-        propertyName=ranger.sso.providerurl
-        newPropertyValue="${sso_providerurl}"
-        updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
- 
-        propertyName=ranger.sso.publicKey
-        newPropertyValue="${sso_publickey}"
-        updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
- 
-        propertyName=ranger.sso.cookiename
-        newPropertyValue="${sso_cookiename}"
-        updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
- 
-        propertyName=ranger.sso.query.param.originalurl
-        newPropertyValue="${sso_query_param_originalurl}"
-        updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
-
-
 	if [ "${DB_FLAVOR}" == "MYSQL" ]
 	then
 		propertyName=ranger.jpa.jdbc.url
@@ -675,6 +654,41 @@ update_properties() {
 			fi
 		fi
 	fi
+
+	if [ "${sso_enabled}" == "" ]
+	then
+		sso_enabled="false"
+	fi
+
+	sso_enabled=`echo $sso_enabled | tr '[:upper:]' '[:lower:]'`
+
+	if [ "${sso_enabled}" == "true" ]
+	then
+		if [ "${sso_providerurl}" == "" ] || [ "${sso_publickey}" == "" ] || [ "${sso_cookiename}" == "" ] || [ "${sso_query_param_originalurl}" == "" ]
+		then
+			log "[E] Please provide valid values in SSO config properties!";
+			exit 1
+		fi
+		propertyName=ranger.sso.enabled
+		newPropertyValue="${sso_enabled}"
+		updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
+	 
+		propertyName=ranger.sso.providerurl
+		newPropertyValue="${sso_providerurl}"
+		updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
+	 
+		propertyName=ranger.sso.publicKey
+		newPropertyValue="${sso_publickey}"
+		updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
+	 
+		propertyName=ranger.sso.cookiename
+		newPropertyValue="${sso_cookiename}"
+		updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
+	 
+		propertyName=ranger.sso.query.param.originalurl
+		newPropertyValue="${sso_query_param_originalurl}"
+		updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
+	fi
 }
 
 do_unixauth_setup() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/5fec40fe/security-admin/src/main/resources/conf.dist/security-applicationContext.xml
----------------------------------------------------------------------
diff --git a/security-admin/src/main/resources/conf.dist/security-applicationContext.xml b/security-admin/src/main/resources/conf.dist/security-applicationContext.xml
index 329053f..1aead32 100644
--- a/security-admin/src/main/resources/conf.dist/security-applicationContext.xml
+++ b/security-admin/src/main/resources/conf.dist/security-applicationContext.xml
@@ -90,7 +90,6 @@ http://www.springframework.org/schema/security/spring-security-oauth2-1.0.xsd">
 	</beans:bean>
 
 	<beans:bean id="ssoAuthenticationFilter" class="org.apache.ranger.security.web.filter.RangerSSOAuthenticationFilter">
-            <beans:property name="ssoEnabled" value="${ranger.sso.enabled}"/>
     </beans:bean>
 	
 	<beans:bean id="userContextFormationFilter" class="org.apache.ranger.security.web.filter.RangerSecurityContextFormationFilter"/>

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/5fec40fe/unixauthservice/scripts/setup.py
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/setup.py b/unixauthservice/scripts/setup.py
index b35a261..fface25 100755
--- a/unixauthservice/scripts/setup.py
+++ b/unixauthservice/scripts/setup.py
@@ -267,13 +267,13 @@ def initializeInitD(ownerName):
 				for  prefix in initPrefixList:
 					scriptFn = prefix + initdProgramName
 					scriptName = join(rcDir, scriptFn)
-					if isfile(scriptName):
+					if isfile(scriptName) or os.path.islink(scriptName):
 						os.remove(scriptName)
 					os.symlink(initdFn,scriptName)
 			userSyncScriptName = "ranger-usersync-services.sh"
 			localScriptName = os.path.abspath(join(installPropDirName,userSyncScriptName))
 			ubinScriptName = join("/usr/bin",initdProgramName)
-			if isfile(ubinScriptName):
+			if isfile(ubinScriptName) or os.path.islink(ubinScriptName):
 				os.remove(ubinScriptName)
 			os.symlink(localScriptName,ubinScriptName)