Skip to content

Commit

Permalink
Fixes the mount issue with full DNS name in the AWS China Regions; Up…
Browse files Browse the repository at this point in the history
…grades unit test coverage version dependency to enable accurate python3.8 coverage test
  • Loading branch information
Cappuccinuo committed Jan 24, 2020
1 parent cfd6a54 commit d692ffe
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![CircleCI](https://circleci.com/gh/aws/efs-utils.svg?style=svg)](https://circleci.com/gh/aws/efs-utils)

# efs-utils

Utilities for Amazon Elastic File System (EFS)
Expand Down
2 changes: 1 addition & 1 deletion build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set -ex

BASE_DIR=$(pwd)
BUILD_ROOT=${BASE_DIR}/build/debbuild
VERSION=1.19
VERSION=1.20

echo 'Cleaning deb build workspace'
rm -rf ${BUILD_ROOT}
Expand Down
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
#

[global]
version=1.19
version=1.20
2 changes: 1 addition & 1 deletion dist/amazon-efs-utils.control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: amazon-efs-utils
Architecture: all
Version: 1.19
Version: 1.20
Section: utils
Depends: python|python2, nfs-common, stunnel4 (>= 4.56)
Priority: optional
Expand Down
2 changes: 1 addition & 1 deletion dist/amazon-efs-utils.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
%endif

Name : amazon-efs-utils
Version : 1.19
Version : 1.20
Release : 1%{?dist}
Summary : This package provides utilities for simplifying the use of EFS file systems

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
attrs==17.4.0
configparser==3.5.0
coverage==4.5
coverage==4.5.4
enum34==1.1.6
flake8==3.7.9
funcsigs==1.0.2
Expand Down
4 changes: 2 additions & 2 deletions src/mount_efs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
from urllib.error import URLError
from urllib.request import urlopen

VERSION = '1.19'
VERSION = '1.20'
SERVICE = 'elasticfilesystem'

CONFIG_FILE = '/etc/amazon/efs/efs-utils.conf'
Expand Down Expand Up @@ -130,7 +130,7 @@
REQUEST_PAYLOAD = ''

FS_ID_RE = re.compile('^(?P<fs_id>fs-[0-9a-f]+)$')
EFS_FQDN_RE = re.compile(r'^(?P<fs_id>fs-[0-9a-f]+)\.efs\.(?P<region>[a-z0-9-]+)\.amazonaws.com$')
EFS_FQDN_RE = re.compile(r'^(?P<fs_id>fs-[0-9a-f]+)\.efs\.(?P<region>[a-z0-9-]+)\.(?P<dns_name_suffix>[a-z0-9.]+)$')
AP_ID_RE = re.compile('^fsap-[0-9a-f]{17}$')

INSTANCE_METADATA_SERVICE_URL = 'http://169.254.169.254/latest/dynamic/instance-identity/document/'
Expand Down
2 changes: 1 addition & 1 deletion src/watchdog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from urllib.error import URLError
from urllib.request import urlopen

VERSION = '1.19'
VERSION = '1.20'
SERVICE = 'elasticfilesystem'

CONFIG_FILE = '/etc/amazon/efs/efs-utils.conf'
Expand Down
Binary file modified test/.DS_Store
Binary file not shown.
10 changes: 10 additions & 0 deletions test/mount_efs_test/test_match_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ def test_match_device_correct_descriptors_fs_id(mocker):
assert (fs_id, path) == mount_efs.match_device(None, device)


def test_match_device_correct_descriptors_cname_dns_suffix_override_region(mocker):
get_dns_name_mock = mocker.patch('mount_efs.get_dns_name', return_value='fs-deadbeef.efs.cn-north-1.amazonaws.com.cn')
gethostbyname_ex_mock = mocker.patch('socket.gethostbyname_ex',
return_value=('fs-deadbeef.efs.cn-north-1.amazonaws.com.cn', [], None))
for device, (fs_id, path) in CORRECT_DEVICE_DESCRIPTORS_CNAME_DNS:
assert (fs_id, path) == mount_efs.match_device(None, device)
utils.assert_called(get_dns_name_mock)
utils.assert_called(gethostbyname_ex_mock)


def test_match_device_correct_descriptors_cname_dns_primary(mocker):
get_dns_name_mock = mocker.patch('mount_efs.get_dns_name', return_value='fs-deadbeef.efs.us-east-1.amazonaws.com')
gethostbyname_ex_mock = mocker.patch('socket.gethostbyname_ex',
Expand Down

0 comments on commit d692ffe

Please sign in to comment.