From: Marek 'marx' Grac <mgrac@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 12/15] [cleanup] Remove snmp_define_defaults()
Date: Wed, 2 Apr 2014 13:52:20 +0200 [thread overview]
Message-ID: <1396439543-29533-12-git-send-email-mgrac@redhat.com> (raw)
In-Reply-To: <1396439543-29533-1-git-send-email-mgrac@redhat.com>
This function is always called for SNMP fence agents so it is possible to run it automatically.
---
fence/agents/apc_snmp/fence_apc_snmp.py | 11 +++--------
fence/agents/cisco_mds/fence_cisco_mds.py | 4 +---
fence/agents/eaton_snmp/fence_eaton_snmp.py | 4 +---
fence/agents/ibmblade/fence_ibmblade.py | 3 +--
fence/agents/ifmib/fence_ifmib.py | 3 +--
fence/agents/intelmodular/fence_intelmodular.py | 4 +---
fence/agents/ipdu/fence_ipdu.py | 3 +--
fence/agents/lib/fencing.py.py | 3 +++
fence/agents/lib/fencing_snmp.py.py | 6 +-----
9 files changed, 13 insertions(+), 28 deletions(-)
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index 2461476..29aafe6 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -16,7 +16,7 @@ import sys
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="APC SNMP fence agent"
@@ -169,11 +169,6 @@ def get_outlets_status(conn, options):
return result
-# Define new options
-def apc_snmp_define_defaults():
- all_opt["snmp_version"]["default"] = "1"
- all_opt["community"]["default"] = "private"
-
# Main agent method
def main():
device_opt = [ "ipaddr", "login", "passwd", "no_login", "no_password", \
@@ -181,8 +176,8 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
- apc_snmp_define_defaults()
+ all_opt["snmp_version"]["default"] = "1"
+ all_opt["community"]["default"] = "private"
options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 6cc189f..84adee2 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -11,7 +11,7 @@ import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
from fencing import fail_usage
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="Cisco MDS 9xxx SNMP fence agent"
@@ -84,8 +84,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
-
options = check_input(device_opt, process_input(device_opt))
docs = { }
diff --git a/fence/agents/eaton_snmp/fence_eaton_snmp.py b/fence/agents/eaton_snmp/fence_eaton_snmp.py
index f519be8..970fd69 100644
--- a/fence/agents/eaton_snmp/fence_eaton_snmp.py
+++ b/fence/agents/eaton_snmp/fence_eaton_snmp.py
@@ -10,7 +10,7 @@ import sys
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="Eaton SNMP fence agent"
@@ -204,8 +204,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
-
all_opt["switch"]["default"] = 1
all_opt["power_wait"]["default"] = 2
all_opt["snmp_version"]["default"] = "1"
diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py
index 43bc73e..d1bb065 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -4,7 +4,7 @@ import sys
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="IBM Blade SNMP fence agent"
@@ -57,7 +57,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults()
all_opt["snmp_version"]["default"] = "1"
options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index 350ce71..f8beaa5 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -13,7 +13,7 @@ import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
from fencing import fail_usage
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="IF:MIB SNMP fence agent"
@@ -102,7 +102,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
all_opt["snmp_version"]["default"] = "2c"
options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
index 320b2db..e9ef43c 100644
--- a/fence/agents/intelmodular/fence_intelmodular.py
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -15,7 +15,7 @@ import sys
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="Intel Modular SNMP fence agent"
@@ -68,8 +68,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
-
options = check_input(device_opt, process_input(device_opt))
docs = { }
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
index 62a2df4..83f1dd4 100644
--- a/fence/agents/ipdu/fence_ipdu.py
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -9,7 +9,7 @@ import sys
import atexit
sys.path.append("/usr/share/fence")
from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="IBM iPDU SNMP fence agent"
@@ -133,7 +133,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
all_opt["snmp_version"]["default"] = "3"
all_opt["community"]["default"] = "private"
all_opt["switch"]["default"] = "1"
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 3409b60..fe4d9c4 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -643,6 +643,9 @@ def check_input(device_opt, opt):
if options.has_key("--ipport"):
all_opt["ipport"]["help"] = "-u, --ipport=[port] " + \
"TCP/UDP port to use (default " + options["--ipport"] +")"
+ elif device_opt.count("snmp_version"):
+ all_opt["ipport"]["default"] = "161"
+ all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use (default 161)"
elif options.has_key("--ssh"):
all_opt["ipport"]["default"] = 22
all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use (default 22)"
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index e65a551..98afd30 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -6,7 +6,7 @@ import re, pexpect
from fencing import *
from fencing import fail, fail_usage, EC_TIMED_OUT, LOG_MODE_VERBOSE
-__all__ = [ 'FencingSnmp', 'snmp_define_defaults' ]
+__all__ = [ 'FencingSnmp' ]
## do not add code here.
#BEGIN_VERSION_GENERATION
@@ -15,10 +15,6 @@ REDHAT_COPYRIGHT = ""
BUILD_DATE = ""
#END_VERSION_GENERATION
-# Fix for RHBZ#527844
-def snmp_define_defaults ():
- all_opt["ipport"]["default"] = "161"
-
class FencingSnmp:
def __init__(self, options):
self.options = options
--
1.9.0
next prev parent reply other threads:[~2014-04-02 11:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 02/15] [cleanup] Proper import of atexit Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 03/15] [cleanup] Remove unused variables Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 04/15] [cleanup] Split lines that were too long Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 05/15] [cleanup] Remove unused dependencies Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 06/15] [cleanup] Remove problems with redefining variables/functions Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 07/15] [cleanup] Only symbols that should be used are exported from fencing library Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 08/15] [cleanup] Mark raw strings with r"" Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 09/15] [cleanup] Only symbols that should be used are exported from fencing_snmp library Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 10/15] [cleanup] Errors when encountering mixed space/tab in python Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 11/15] [cleanup] Mark raw strings with r"" in fence_virsh Marek 'marx' Grac
2014-04-02 11:52 ` Marek 'marx' Grac [this message]
2014-04-02 11:52 ` [Cluster-devel] [PATCH 13/15] [cleanup] Remove unused arguments Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 14/15] [cleanup] Remove transfer script used in transition 3.x->4.x Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 15/15] [cleanup] Fix invalid names of variables Marek 'marx' Grac
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=1396439543-29533-12-git-send-email-mgrac@redhat.com \
--to=mgrac@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).