Total Complexity | 4 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import os |
||
2 | |||
3 | # this is where the environment should be taken from |
||
4 | # it makes sure the environment is setup before it is imported |
||
5 | import exabgp.environment.setup |
||
6 | |||
7 | from exabgp.environment.environment import Env |
||
8 | |||
9 | from exabgp.environment.base import APPLICATION |
||
10 | from exabgp.environment.base import ENVFILE |
||
11 | from exabgp.environment.base import ROOT |
||
12 | from exabgp.environment.base import ETC |
||
13 | |||
14 | # As soon as we import anything, a COPY is made in the local |
||
15 | # namespace, it mean that we can not import the GlobalHashTable |
||
16 | # directly but must ask for a copy to be made each time |
||
17 | # at the time of import, so using a function get around it |
||
18 | from exabgp.environment.hashtable import GlobalHashTable as __ |
||
19 | |||
20 | |||
21 | def getenv(): |
||
22 | return __() |
||
23 | |||
24 | |||
25 | def getconf(name): |
||
26 | # some users are using symlinks for atomic change of the configuration file |
||
27 | # using mv may however be better practice :p |
||
28 | # so we must not follow symlink when looking for the file |
||
29 | |||
30 | if name.startswith('etc/exabgp'): |
||
31 | normalised = os.path.join(ETC, name[11:]) |
||
32 | else: |
||
33 | normalised = os.path.normpath(name) |
||
34 | |||
35 | if os.path.isfile(os.path.realpath(normalised)): |
||
36 | return normalised |
||
37 | |||
38 | return '' |
||
39 |