Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Neil Hanlon
Efs Utils
Commits
b6b0d993
Commit
b6b0d993
authored
Dec 04, 2019
by
Yuan Gao
Browse files
Properly support Python3
parent
243b2583
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/mount_efs/__init__.py
View file @
b6b0d993
...
...
@@ -44,6 +44,11 @@ import threading
from
contextlib
import
contextmanager
from
logging.handlers
import
RotatingFileHandler
try
:
from
ConfigParser
import
NoOptionError
except
Exception
:
from
configparser
import
NoOptionError
try
:
import
ConfigParser
except
ImportError
:
...
...
@@ -74,11 +79,11 @@ DEFAULT_STUNNEL_VERIFY_LEVEL = 2
DEFAULT_STUNNEL_CAFILE
=
'/etc/amazon/efs/efs-utils.crt'
EFS_ONLY_OPTIONS
=
[
'noocsp'
,
'ocsp'
,
'tls'
,
'tlsport'
,
'verify'
,
'ocsp'
,
'noocsp'
'verify'
]
UNSUPPORTED_OPTIONS
=
[
...
...
@@ -437,7 +442,7 @@ def create_state_file_dir(config, state_file_dir):
mode
=
int
(
mode_str
,
8
)
except
ValueError
:
logging
.
warn
(
'Bad state_file_dir_mode "%s" in config file "%s"'
,
mode_str
,
CONFIG_FILE
)
except
ConfigParser
.
NoOptionError
:
except
NoOptionError
:
pass
try
:
...
...
@@ -585,7 +590,10 @@ def assert_root():
def
read_config
(
config_file
=
CONFIG_FILE
):
p
=
ConfigParser
.
SafeConfigParser
()
try
:
p
=
ConfigParser
.
SafeConfigParser
()
except
AttributeError
:
p
=
ConfigParser
()
p
.
read
(
config_file
)
return
p
...
...
@@ -665,7 +673,7 @@ def match_device(config, device):
try
:
primary
,
secondaries
,
_
=
socket
.
gethostbyname_ex
(
remote
)
hostnames
=
filter
(
lambda
e
:
e
is
not
None
,
[
primary
]
+
secondaries
)
hostnames
=
list
(
filter
(
lambda
e
:
e
is
not
None
,
[
primary
]
+
secondaries
)
)
except
socket
.
gaierror
:
fatal_error
(
'Failed to resolve "%s" - check that the specified DNS name is a CNAME record resolving to a valid EFS DNS '
...
...
@@ -698,6 +706,7 @@ def mount_tls(config, init_system, dns_name, path, fs_id, mountpoint, options):
with
bootstrap_tls
(
config
,
init_system
,
dns_name
,
fs_id
,
mountpoint
,
options
)
as
tunnel_proc
:
mount_completed
=
threading
.
Event
()
t
=
threading
.
Thread
(
target
=
poll_tunnel_process
,
args
=
(
tunnel_proc
,
fs_id
,
mount_completed
))
t
.
daemon
=
True
t
.
start
()
mount_nfs
(
dns_name
,
path
,
mountpoint
,
options
)
mount_completed
.
set
()
...
...
src/watchdog/__init__.py
View file @
b6b0d993
...
...
@@ -280,7 +280,10 @@ def assert_root():
def
read_config
(
config_file
=
CONFIG_FILE
):
p
=
ConfigParser
.
SafeConfigParser
()
try
:
p
=
ConfigParser
.
SafeConfigParser
()
except
AttributeError
:
p
=
ConfigParser
()
p
.
read
(
config_file
)
return
p
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment