Skip to content

Commit

Permalink
BF: do not rely on scripts being under /usr -- might differ eg on Fed…
Browse files Browse the repository at this point in the history
…ora -- rely on import of common.version (Closes gh-112)

This is also not ideal, since if there happens to be some systemwide common.version -- we are doomed

but otherwise, we cannot keep extending comparison check to /bin, /sbin whatelse
  • Loading branch information
yarikoptic committed Jan 28, 2013
1 parent acab23b commit d561a4c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
9 changes: 5 additions & 4 deletions fail2ban-client
Expand Up @@ -27,12 +27,13 @@ import getopt, time, shlex, socket

# Inserts our own modules path first in the list
# fix for bug #343821
if os.path.abspath(__file__).startswith('/usr/'):
# makes sense to use system-wide library iff -client is also under /usr/
try:
from common.version import version
except ImportError, e:
sys.path.insert(1, "/usr/share/fail2ban")
from common.version import version

# Now we can import our modules
from common.version import version
# Now we can import the rest of modules
from common.protocol import printFormatted
from client.csocket import CSocket
from client.configurator import Configurator
Expand Down
9 changes: 5 additions & 4 deletions fail2ban-regex
Expand Up @@ -26,13 +26,14 @@ import getopt, sys, time, logging, os

# Inserts our own modules path first in the list
# fix for bug #343821
if os.path.abspath(__file__).startswith('/usr/'):
# makes sense to use system-wide library iff -regex is also under /usr/
sys.path.insert(1, "/usr/share/fail2ban")
try:
from common.version import version
except ImportError, e:
sys.path.insert(1, "/usr/share/fail2ban")
from common.version import version

from client.configparserinc import SafeConfigParserWithIncludes
from ConfigParser import NoOptionError, NoSectionError, MissingSectionHeaderError
from common.version import version
from server.filter import Filter
from server.failregex import RegexException

Expand Down
7 changes: 4 additions & 3 deletions fail2ban-server
Expand Up @@ -26,11 +26,12 @@ import getopt, sys, logging, os

# Inserts our own modules path first in the list
# fix for bug #343821
if os.path.abspath(__file__).startswith('/usr/'):
# makes sense to use system-wide library iff -server is also under /usr/
try:
from common.version import version
except ImportError, e:
sys.path.insert(1, "/usr/share/fail2ban")
from common.version import version

from common.version import version
from server.server import Server

# Gets the instance of the logger.
Expand Down

0 comments on commit d561a4c

Please sign in to comment.