You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "Qiang Zhang (JIRA)" <ji...@apache.org> on 2017/02/04 08:42:55 UTC

[jira] [Updated] (RANGER-1349) Code block was iterated four times, in fact it should only be executed once during initializing InitD for ranger usersync process

     [ https://issues.apache.org/jira/browse/RANGER-1349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Qiang Zhang updated RANGER-1349:
--------------------------------
    Attachment: 0001-RANGER-1349-Code-block-was-iterated-four-times-in-fa.patch

> Code block was iterated four times, in fact it should only be executed once during initializing InitD for ranger usersync process
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: RANGER-1349
>                 URL: https://issues.apache.org/jira/browse/RANGER-1349
>             Project: Ranger
>          Issue Type: Bug
>          Components: kms
>            Reporter: Qiang Zhang
>            Assignee: Qiang Zhang
>              Labels: patch
>         Attachments: 0001-RANGER-1349-Code-block-was-iterated-four-times-in-fa.patch
>
>
> There is logical error during initialize InitD for ranger usersync process. The following code block will be iterated four times. It's reasonable to execute once.
> From following code we can seen that the code block from userSyncScriptName = "ranger-usersync-services.sh" to os.symlink(localScriptName,ubinScriptName) was iterated four times. It only needs be executed one. The error reason is that developer ignores python block syntax.
> for rcDir in rcDirList:
> if (os.path.isdir(rcDir)):
> 	for prefix in initPrefixList:
> 		scriptFn = prefix + initdProgramName
> 		scriptName = join(rcDir, scriptFn)
> 		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) or os.path.islink(ubinScriptName):
> 	os.remove(ubinScriptName)
> 	os.symlink(localScriptName,ubinScriptName)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)