Skip to contentSkip to conversation

Cluster Project branch, master, updated. cluster-2.99.02-27-gd1d2954

Cluster-devel [email protected] 3 participants 4 messages May 28, 2008 – May 29, 2008

lore
Share & tools
lore
#0 lore raw

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=d1d29545d7efeefbe4cd540bdd3dfd248d2310c0

The branch, master has been updated

       via  d1d29545d7efeefbe4cd540bdd3dfd248d2310c0 (commit)
       via  402682f083cf62426fc1878280a6fabb4be14e7d (commit)
       via  fdcffe0beb6d3f7558993f68f82afd388ccdcf5b (commit)
      from  1413ec43636f18ceeed45d7dcfe68e8a0ec52b6c (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

- Log ----------------------------------------------------------------- commit d1d29545d7efeefbe4cd540bdd3dfd248d2310c0

Author: Ryan McCabe <[email protected]>
Date:   Wed May 28 16:30:42 2008 -0400

libfence: update copyright notice

- Clarify copyright notice so that GPLv2 is specified explicitly.

commit 402682f083cf62426fc1878280a6fabb4be14e7d

Author: Ryan McCabe <[email protected]>
Date:   Wed May 28 16:29:36 2008 -0400

libfence: handle EINTR correctly

- Handle EINTR correctly
- String cleanups

commit fdcffe0beb6d3f7558993f68f82afd388ccdcf5b

Author: Ryan McCabe <[email protected]>
Date:   Wed May 28 16:28:34 2008 -0400

fence: fixes and cleanups to fencing.py library

- Do not report failure if a node is successfully powered off, but fails to power on.

- Change 'pass' to 'continue' so that comments and blank lines from stdin are ignored.

- Use the full path to ssh and telnet when executing the binaries.

-----------------------------------------------------------------------

Summary of changes:

 fence/agents/lib/fencing.py.py |   37 +++++++++++++++++-------------
 fence/libfence/agent.c         |   49 ++++++++++++++++++++++-----------------
 fence/libfence/libfence.h      |    5 +--
 3 files changed, 51 insertions(+), 40 deletions(-)
fence/agents/lib/fencing.py.py +21 -16
index 944553c..300183a 100644
@@ -10,9 +10,9 @@ import telnetlib
 
 ## do not add code here.
 #BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New fence lib agent - test release on steroids"
-REDHAT_COPYRIGHT=""
-BUILD_DATE="March, 2008"
+RELEASE_VERSION = "New fence lib agent - test release on steroids"
+REDHAT_COPYRIGHT = ""
+BUILD_DATE = "March, 2008"
 #END_VERSION_GENERATION
 
 POWER_TIMEOUT = 20
@@ -29,6 +29,9 @@ EC_TIMED_OUT       = 5
 EC_WAITING_ON      = 6
 EC_WAITING_OFF     = 7
 
+TELNET_PATH = "/usr/bin/telnet"
+SSH_PATH    = "/usr/bin/ssh"
+
 all_opt = {
 	"help"    : {
 		"getopt" : "h",
@@ -132,10 +135,10 @@ class fspawn(pexpect.spawn):
 			options["debug_fh"].write(self.before + self.after)
 		return result
 
-def version(command, release, build_date, copyright):
-	print command, " ", release, " ", build_date;
-	if len(copyright) > 0:
-		print copyright
+def version(command, release, build_date, copyright_notice):
+	print command, " ", release, " ", build_date
+	if len(copyright_notice) > 0:
+		print copyright_notice
 
 def fail_usage(message = ""):
 	if len(message) > 0:
@@ -174,7 +177,8 @@ def process_input(avail_opt):
 	##
 	## Set standard environment
 	#####
-	os.unsetenv("LANG")
+	os.putenv("LANG", "C")
+	os.putenv("LC_ALL", "C")
 
 	##
 	## Prepare list of options for getopt
@@ -184,7 +188,7 @@ def process_input(avail_opt):
 		if all_opt.has_key(k):
 			getopt_string += all_opt[k]["getopt"]
 		else:
-			fail_usage("Parse error: unknown option '"+k+"'");
+			fail_usage("Parse error: unknown option '"+k+"'")
 
 	##
 	## Read options from command line or standard input
@@ -209,7 +213,8 @@ def process_input(avail_opt):
 		name = ""
 		for line in sys.stdin.readlines():
 			line = line.strip()
-			if ((line.startswith("#")) or (len(line) == 0)): pass
+			if ((line.startswith("#")) or (len(line) == 0)):
+				continue
 
 			(name, value) = (line + "=").split("=", 1)
 			value = value[:-1]
@@ -302,7 +307,7 @@ def check_input(device_opt, opt):
 	return options
 	
 def wait_power_status(tn, options, get_power_fn):
-	for x in range(POWER_TIMEOUT):
+	for dummy in xrange(POWER_TIMEOUT):
 		if get_power_fn(tn, options) != options["-o"]:
 			time.sleep(1)
 		else:
@@ -339,7 +344,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn):
 		options["-o"] = "on"
 		set_power_fn(tn, options)
 		if wait_power_status(tn, options, get_power_fn) == 0:
-			fail(EC_WAITING_ON)
+			sys.stderr.write('Timed out waiting to power ON\n')
 		print "Success: Rebooted"
 	elif options["-o"] == "status":
 		print "Status: " + status.upper()
@@ -350,10 +355,10 @@ def fence_login(options):
 		re_pass  = re.compile("password", re.IGNORECASE)
 
 		if options.has_key("-x") and 0 == options.has_key("-k"):
-			command = 'ssh ' + options["-l"] + "@" + options["-a"]
+			command = '%s %s@%s' % (SSH_PATH, options["-l"], options["-a"])
 			if options.has_key("ssh_options"):
 				command += ' ' + options["ssh_options"]
-			conn = fspawn (command)
+			conn = fspawn(command)
 			result = conn.log_expect(options, [ "ssword:", "Are you sure you want to continue connecting (yes/no)?" ], LOGIN_TIMEOUT)
 			if result == 1:
 				conn.sendline("yes")
@@ -361,7 +366,7 @@ def fence_login(options):
 			conn.sendline(options["-p"])
 			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
 		elif options.has_key("-x") and 1 == options.has_key("-k"):
-			conn = fspawn ('ssh ' + options["-l"] + "@" + options["-a"] + " -i " + options["-k"])
+			conn = fspawn('%s %s@%s -i %s' % (SSH_PATH, options["-l"], options["-a"], options["-k"]))
 			result = conn.log_expect(options, [ options["-c"], "Are you sure you want to continue connecting (yes/no)?", "Enter passphrase for key '"+options["-k"]+"':" ], LOGIN_TIMEOUT)
 			if result == 1:
 				conn.sendline("yes")
@@ -373,7 +378,7 @@ def fence_login(options):
 				else:
 					fail_usage("Failed: You have to enter passphrase (-p) for identity file")
 		else:
-			conn = fspawn ('telnet ' + options["-a"])
+			conn = fspawn('%s %s' % (TELNET_PATH, options["-a"]))
 			conn.log_expect(options, re_login, LOGIN_TIMEOUT)
 			conn.send(options["-l"]+"\r\n")
 			conn.log_expect(options, re_pass, SHELL_TIMEOUT)
fence/libfence/agent.c +28 -21

83 lines not on this page · raw message

fence/libfence/libfence.h +2 -3
index 6cdbd85..53b9f64 100644
@@ -4,9 +4,8 @@
 **  Copyright (C) 2008 Red Hat, Inc.  All rights reserved.
 **
 **  This library is free software; you can redistribute it and/or
-**  modify it under the terms of the GNU Lesser General Public
-**  License as published by the Free Software Foundation; either
-**  version 2 of the License, or (at your option) any later version.
+**  modify it under the terms of version 2 of the GNU Lesser General
+**  Public License as published by the Free Software Foundation.
 **
 **  This library is distributed in the hope that it will be useful,
 **  but WITHOUT ANY WARRANTY; without even the implied warranty of

hooks/post-receive
--
Cluster Project

#1 lore raw

Hi Ryan,

Quoted 8 lines · rmccabe at sourceware.org

- Log ----------------------------------------------------------------- commit d1d29545d7efeefbe4cd540bdd3dfd248d2310c0

Author: Ryan McCabe <[email protected]>
Date:   Wed May 28 16:30:42 2008 -0400

libfence: update copyright notice

- Clarify copyright notice so that GPLv2 is specified explicitly.

Is there any reason why it's not LGPL? I thought all our shared libraries should be LGPL to make life simpler for other people to use...

Quoted 1 line

- Use the full path to ssh and telnet when executing the binaries.

It's generally better to avoid harcoding paths if we can avoid it. Custom builds would require extra patching if for example ssh is in /usr/local/bin..

Quoted 5 lines
fence/agents/lib/fencing.py.py +0 -0
index 944553c..300183a 100644

fence/agents/lib/fencing.py.py import telnetlib · line 16

Quoted 10 lines
fence/agents/lib/fencing.py.py +3 -3
@@ -10,9 +10,9 @@ import telnetlib
 
 ## do not add code here.
 #BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New fence lib agent - test release on steroids"
-REDHAT_COPYRIGHT=""
-BUILD_DATE="March, 2008"
+RELEASE_VERSION = "New fence lib agent - test release on steroids"
+REDHAT_COPYRIGHT = ""
+BUILD_DATE = "March, 2008"
 #END_VERSION_GENERATION

This change is not respected by the Makefile system. Everything between #BEGIN and #END is virtually ignored. Do we need to respect this spacing? If so, i will just change the build system to do it.

Thanks
Fabio

--
I'm going to make him an offer he can't refuse.

#2 lore raw
Quoted 5 lines · Fabio M. Di Nitto
Quoted 2 lines

- Clarify copyright notice so that GPLv2 is specified explicitly.

Is there any reason why it's not LGPL? I thought all our shared libraries should be LGPL to make life simpler for other people to use...

It is LGPL. I just made a typo in the commit message. I specified the version of the LGPL.

Quoted 5 lines
Quoted 1 line

- Use the full path to ssh and telnet when executing the binaries.

It's generally better to avoid harcoding paths if we can avoid it. Custom builds would require extra patching if for example ssh is in /usr/local/bin..

From a security point of view, I think it's bad practice to be using a relative path in an exec-type call as root. It'd be better to have the makefile system fill in (or change) the paths if we want to allow for builds with ssh and telnet in non-standard places.

Quoted 3 lines

This change is not respected by the Makefile system. Everything between #BEGIN and #END is virtually ignored. Do we need to respect this spacing? If so, i will just change the build system to do it.

Not a big deal either way, really. It can be ignored.

Ryan

#3 lore raw
Quoted 9 lines · Ryan McCabe
Quoted 5 lines · Fabio M. Di Nitto
Quoted 2 lines

- Clarify copyright notice so that GPLv2 is specified explicitly.

Is there any reason why it's not LGPL? I thought all our shared libraries should be LGPL to make life simpler for other people to use...

It is LGPL. I just made a typo in the commit message. I specified the version of the LGPL.

Ok :)

Quoted 11 lines
Quoted 8 lines
Quoted 2 lines

- Use the full path to ssh and telnet when executing the binaries.

It's generally better to avoid harcoding paths if we can avoid it. Custom builds would require extra patching if for example ssh is in /usr/local/bin..

From a security point of view, I think it's bad practice to be using a

relative path in an exec-type call as root. It'd be better to have the makefile system fill in (or change) the paths if we want to allow for builds with ssh and telnet in non-standard places.

Ok. I think you have a point here. We will need to do a review of the code for all those options or find a way to track them because there are tons of them.

Quoted 6 lines
Quoted 4 lines

This change is not respected by the Makefile system. Everything between #BEGIN and #END is virtually ignored. Do we need to respect this spacing? If so, i will just change the build system to do it.

Not a big deal either way, really. It can be ignored.

I am ok either way. whatever is the cleanest should go in.

Thanks
Fabio

--
I'm going to make him an offer he can't refuse.