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

portability: patch mac os dns issues #4296

Merged
merged 1 commit into from
Jul 13, 2021
Merged
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
3 changes: 0 additions & 3 deletions .github/workflows/test_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ jobs:
- name: Brew Install
if: startsWith(matrix.os, 'macos')
run: |
# apply DNS patch
patch cylc/flow/hostuserutil.py < etc/conf/macos-patch

brew update
brew install shellcheck sqlite3 bash coreutils

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test_functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ jobs:
- name: Brew Install
if: startsWith(matrix.os, 'macos')
run: |
# apply DNS patch
patch cylc/flow/hostuserutil.py < etc/conf/macos-patch

# install system deps
brew update
brew install bash coreutils gnu-sed
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ respectively.

### Fixes

[#4296](https://github.com/cylc/cylc-flow/pull/4296) -
Patches DNS issues with newer versions of Mac OS.

[#4273](https://github.com/cylc/cylc-flow/pull/4273)
- Remove obsolete Cylc 7 visualization config section.

Expand Down
19 changes: 18 additions & 1 deletion cylc/flow/hostuserutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@

"""

from contextlib import suppress
import os
import pwd
import socket
from contextlib import suppress
import sys
from time import time

from cylc.flow.cfgspec.glbl_cfg import glbl_cfg


IS_MAC_OS = 'darwin' in sys.platform.lower()


class HostUtil:
"""host and user ID utility."""

Expand Down Expand Up @@ -114,6 +118,19 @@ def _get_host_info(self, target=None):
if target not in self._host_exs:
if target is None:
target = socket.getfqdn()
if (
IS_MAC_OS
and target == (
'1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.'
'0.0.0.0.0.0.ip6.arpa'
)
):
# Python's socket bindings don't play nicely with mac os
# so by default we get the above ip6.arpa adresss from
# socket.getfqdn, note this does *not* match `hostname -f`.
# https://github.com/cylc/cylc-flow/issues/2689
# https://github.com/cylc/cylc-flow/issues/3595
target = socket.gethostname()
try:
self._host_exs[target] = socket.gethostbyname_ex(target)
except IOError as exc:
Expand Down
13 changes: 0 additions & 13 deletions etc/conf/macos-patch

This file was deleted.