Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to force usage of IP in the nfs mount command #142

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ The access point must be in the "available" state before it can be used to mount
$ sudo mount -t efs -o tls,accesspoint=access-point-id file-system-id efs-mount-point/
```

To not use the DNS name in the mount command, and force the use of the resolved IP instead. This option requires that `fall_back_to_mount_target_ip_address_enabled = true` is set in efs-utils.conf under the `[mount]` section.

```bash
$ sudo mount -t efs -o forceuseip file-system-id efs-mount-point/
```

To mount your file system automatically with any of the options above, you can add entries to `/efs/fstab` like:

```bash
Expand Down
18 changes: 12 additions & 6 deletions src/mount_efs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
"awsprofile",
"az",
"cafile",
"forceuseip",
"iam",
"mounttargetip",
"netns",
Expand Down Expand Up @@ -2343,13 +2344,18 @@ def _validate_replacement_field_count(format_str, expected_ct):
ip_address=ip_address, fallback_message=fallback_message
)

if dns_name_can_be_resolved(dns_name):
return dns_name, None
if "forceuseip" not in options:
if dns_name_can_be_resolved(dns_name):
return dns_name, None

logging.info(
"Failed to resolve %s, attempting to lookup mount target ip address using botocore.",
dns_name,
)
logging.info(
"Failed to resolve %s, attempting to lookup mount target ip address using botocore.",
dns_name,
)
else:
logging.info(
"Forcing the use of IP address in the mount. Attempting to lookup mount target ip address using botocore."
)

try:
fallback_mount_target_ip_address = get_fallback_mount_target_ip_address(
Expand Down