From: Ondrej Mular <omular@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/4] fencing: add function is_executale
Date: Mon, 30 Dec 2013 11:24:46 -0500 (EST) [thread overview]
Message-ID: <126010627.7770283.1388420686881.JavaMail.root@redhat.com> (raw)
In-Reply-To: <2064701903.7768150.1388419511153.JavaMail.root@redhat.com>
New function is_executable added to fencing library.
Function checks if path is reachable and executable.
Used for example in fence_amt to check path to amttool.
---
fence/agents/lib/fencing.py.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index ab14cb7..f4150ff 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-import sys, getopt, time, os, uuid, pycurl
+import sys, getopt, time, os, uuid, pycurl, stat
import pexpect, re, atexit, syslog
import __main__
@@ -1065,3 +1065,10 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name: )|(userna
except pexpect.TIMEOUT:
fail(EC_LOGIN_DENIED)
return conn
+
+def is_executable(path):
+ if os.path.exists(path):
+ stats = os.stat(path)
+ if stat.S_ISREG(stats.st_mode) and os.access(path, os.X_OK):
+ return True
+ return False
--
1.8.3.1
parent reply other threads:[~2013-12-30 16:24 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <2064701903.7768150.1388419511153.JavaMail.root@redhat.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=126010627.7770283.1388420686881.JavaMail.root@redhat.com \
--to=omular@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.