summaryrefslogtreecommitdiffstats
path: root/src/sbin/bcfg2-info
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-03-22 11:13:10 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-03-22 11:13:10 -0400
commit84cdfc50da10ff57f896e051b3bfdfa3ae52ffa8 (patch)
treec5977862a8db696e078853cd12581d4d72ed9cf1 /src/sbin/bcfg2-info
parent26567899f7095e9404254d1430f1d87456d3fb41 (diff)
downloadbcfg2-84cdfc50da10ff57f896e051b3bfdfa3ae52ffa8.tar.gz
bcfg2-84cdfc50da10ff57f896e051b3bfdfa3ae52ffa8.tar.bz2
bcfg2-84cdfc50da10ff57f896e051b3bfdfa3ae52ffa8.zip
bcfg2-info: fixed building help message on 2.4 (from Michael Fenn)
Diffstat (limited to 'src/sbin/bcfg2-info')
-rwxr-xr-xsrc/sbin/bcfg2-info11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index 5bbe5b43b..cfcc95be2 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -736,10 +736,13 @@ def build_usage():
usage = dict()
for attrname in dir(InfoCore):
attr = getattr(InfoCore, attrname)
- if (hasattr(attr, "__func__") and
- attr.__func__.func_name not in cmd_blacklist and
- attr.__func__.func_name.startswith("do_") and
- attr.__func__.func_doc):
+
+ # shim for python 2.4, __func__ is im_func
+ funcattr = getattr(attr, "__func__", getattr(attr, "im_func", None))
+ if (funcattr != None and
+ funcattr.func_name not in cmd_blacklist and
+ funcattr.func_name.startswith("do_") and
+ funcattr.func_doc):
usage[attr.__name__] = re.sub(r'\s+', ' ', attr.__doc__)
return "Commands:\n" + "\n".join(usage[k] for k in sorted(usage.keys()))