[Cluster-devel] [PATCH 1/2] code cleanup: Fix minor warning according to pylint

Jan Pokorný jpokorny at redhat.com
Mon Oct 29 20:02:54 UTC 2012


Hello Marx,

On 29/10/12 13:10 +0100, Marek 'marx' Grac wrote:
> diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
> index 9bb9581..c6f16ff 100644
> --- a/fence/agents/rhevm/fence_rhevm.py
> +++ b/fence/agents/rhevm/fence_rhevm.py
> @@ -12,9 +12,9 @@ BUILD_DATE="March, 2008"
>  #END_VERSION_GENERATION
>  
>  
> -re_get_id = re.compile("<vm( .*)? id=\"(.*?)\"", re.IGNORECASE);
> -re_status = re.compile("<state>(.*?)</state>", re.IGNORECASE);
> -re_get_name = re.compile("<name>(.*?)</name>", re.IGNORECASE); 
> +re_get_id = re.compile("<vm( .*)? id=\"(.*?)\"", re.IGNORECASE)
> +re_status = re.compile("<state>(.*?)</state>", re.IGNORECASE)
> +re_get_name = re.compile("<name>(.*?)</name>", re.IGNORECASE) 

3rd line keeps the trailing white-space (might be fixed as well)

> diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
> index 017908f..f583ea5 100644
> --- a/fence/agents/xenapi/fence_xenapi.py
> +++ b/fence/agents/xenapi/fence_xenapi.py
> @@ -137,18 +139,18 @@ def connect_and_login(options):
>  
>  	try:
>  		# Create the XML RPC session to the specified URL.
> -		session = XenAPI.Session(url);
> +		session = XenAPI.Session(url)
>  		# Login using the supplied credentials.
> -		session.xenapi.login_with_password(username, password);
> +		session.xenapi.login_with_password(username, password)
>  	except Exception, exn:
> -		print str(exn);
> +		print str(exn)
>  		# http://sources.redhat.com/cluster/wiki/FenceAgentAPI says that for no connectivity
>  		# the exit value should be 1. It doesn't say anything about failed logins, so 
>  		# until I hear otherwise it is best to keep this exit the same to make sure that
>  		# anything calling this script (that uses the same information in the web page
>  		# above) knows that this is an error condition, not a msg signifying a down port.
> -		sys.exit(EC_BAD_SESSION); 
> -	return session;
> +		sys.exit(EC_BAD_SESSION) 
> +	return session

sys.exit line ditto


BTW. pylint should be capable of trailing whitespace detection
(W291?).

-- 
Jan




More information about the Cluster-devel mailing list